You use routines to define complex transformation rules.
Routines are local ABAP classes that consist of a predefined definition area and an implementation area. The TYPES for the inbound and outbound parameters and the signature of the routine (ABAP method) are stored in the definition area. The routine itself is created in the implementation area. ABAP object statements are available in the coding of the routine. Upon generation, the coding is embedded in the local class of the transformation program as the method.
The following graphic shows the position of these routines in the data flow:
The routine has a global part and a local part. In the global part, you define global data declarations 'CLASS DATA'. These are available in all routines.
You can create function modules, methods or external subprograms in the ABAP Workbench if you want to reuse source code in routines. You can call these in the local part of the routine. If you want to transport a routine that includes calls of this type, the routine and the object called should be included in the same transport request.
There are various types of routine in the transformation: start routine, routine for key figures or characteristics, end routine and expert routine.
The following figure shows the structure of the transformation program with transformation rules, start routine, and end routine:
The following figure shows the structure of the transformation program with expert routine:
The start routine is run for each data package at the start of the transformation. The start routine has a table in the format of the source structure as input and output parameters. It is used to perform preliminary calculations and store these in a global data structure or in a table. You can access this structure or table from other routines. You can modify or delete data in the data package.
Routine for Key Figures or Characteristics
This routine is available as a rule type; you can define the routine as a transformation rule for a key figure or a characteristic. The input and output values depend on the selected field in the transformation rule. For more information, see the Routine section under Rule Type.
An end routine is a routine with a table in the target structure format as an inbound parameter and an outbound parameter. You can use an end routine to post-process data, package-by-package, after transformation. For example, you can delete records that are not to be updated, or perform data checks.
If the target of the transformation is a DataStore object, key figures are updated by default with the aggregation behavior Overwrite (MOVE). You have to use a dummy rule to override this.
This type of routine is only intended for use in special cases. You can use the expert routine if the other transformation functions are not sufficient. You can use the expert routine as an interim solution until the necessary functions are available in the standard routine.
You can use this to program the transformation yourself without using the existing rule types. You must transfer the messages to the monitor yourself.
If you have already created transformation rules, the system deletes them once you have created an expert routine.
Navigation attributes of the source of the transformation are not available in the expert routine.
If the target of the transformation is a DataStore object, key figures are updated by default with the aggregation behavior Overwrite (MOVE).