Hypertext: Object Class - Class to which a document belongs.
Document Name
ISH_SURCHARGESERVICE
The following is a simple example of how to set up a customer-specific service adjustment rule. In this example, surcharges are calculated for certain services when specific conditions are met.
Overview of activities to be carried out
Set up a service adjustment action which generates the necessary surcharges automatically. The service code of the generated surcharge is placed in the comment field (technical name NLEI-REMRK) of the service on which the surcharge calculation is based. The start date and time of the surcharge and the corresponding service are identical.
Overview of steps
Procedure to set up a service adjustment action which generates necessary surcharge services automatically.
In the check procedure, set up a service rule by means of which the surcharge services are generated. Note that the check applying to the service rule will only be executed if you select Actv.. If you select Adjus. w/o confirmation, the surcharge services are generated in service entry without you having to confirm this action. Rule attributes:
Event NLRG00: service check during service entry
Rule type: specify a customer-specific rule type
Function module: name of your function module which generates the surcharge
Using inclusions for service pairs, define which surcharges must be generated for which services. To do this, use the rule type you specified in the check procedure. You can assign several surcharges to one service by creating a line with the corresponding underlying service for each surcharge service.
Create a function module with the name you specified in the check procedure. This function module generates the surcharge services automatically. Please note that the function module must use a standard interface. This is described in the function module ISH_CHECK_SERVICES_MAX_VALUES.
Example
Example of implementing the automatic generation of surcharge services:
Please note that this is simply an example of how a surcharge can be generated.
data: abr_nlei like nlei occurs 100 with header line, inlpa like nlpa occurs 1 with header line.
move: 0 to errors, 0 to warnings.
* Do not collect messages at actions if action = 'X'. messages_collect = ' '. endif.
describe table abr_nlei. if sy-tfill = 0. exit. endif.
read table abr_nlei index 1.
* Determine all entries for rule type select * from nlpa into table inlpa where einri = einri and tar_1 = abr_nlei-haust and tar_2 = abr_nlei-haust and rgart = rgart.
loop at inlpa.
* Check if service requiring surcharge exists loop at abr_nlei where leist = inlpa-lst_1 and abrkz = 'X' and stals = ' ' and ibzt >= '200000' and ibzt <= '220000'. * Check whether required surcharge service exists loop at abr_nlei where einri = einri and leist = inlpa-lst_2 and ibgdt = abr_nlei-ibgdt and ibzt = abr_nlei-ibzt and abrkz = 'X' and stals = ' '. endloop. if sy-subrc <> 0. * service requiring surcharge exists but surcharge missing if messages_collect = 'X'. * FM 001(ZZ): surcharge & for service & missing on & perform message_store (rnsform0) using 'ZZ' inlpa-msgty '001' inlpa-lst_1 inlpa-lst_2 abr_nlei-ibgdt ' '. endif. if action = 'X'. * Surcharge service entry in service comment field clear ernlsr. * FM 002(ZZ): write surcharge & in comment field of & move: rgart to ernlsr-rgart, 'U' to ernlsr-aktion, abr_nlei-lnrls to ernlsr-lnrls, '#SURCHARGE#' to ernlsr-remrk, inlpa-lst_2 to ernlsr-remrk+10, 'X' to ernlsr-remrk_x, 'ZZ' to ernlsr-arbgb, '002' to ernlsr-msgnr, inlpa-lst_2 to ernlsr-msgv1, inlpa-lst_1 to ernlsr-msgv2, 'X' to ernlsr-aktdf. append ernlsr. * Generate surcharge service clear ernlsr. move: inlpa-rgart to ernlsr-rgart, 'I' to ernlsr-aktion, inlpa-lst_2 to ernlsr-leist, '0001' to ernlsr-imeng, 'X' to ernlsr-imeng_x, abr_nlei-ibgdt to ernlsr-ibgdt, 'X' to ernlsr-ibgdt_x, abr_nlei-ibzt to ernlsr-ibzt, 'X' to ernlsr-ibzt_x, 'X' to ernlsr-abrkz, 'X' to ernlsr-abrkz_x, 'ZZ' to ernlsr-arbgb, '003' to ernlsr-msgnr, inlpa-lst_2 to ernlsr-msgv1, 'X' to ernlsr-aktdf. append ernlsr. endif. endif. endloop. endloop.
if messages_collect = 'X' and messages_show = 'X'. call function 'MESSAGES_SHOW' exporting show_linno = ' ' exceptions inconsistent_range = 1 no_messages = 2 others = 3. call function 'MESSAGES_INITIALIZE' exceptions others = 1. endif.