Start of Content Area

Function documentation Routines in Transformations  Locate the document in its SAP Library structure

Use

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 actual routine 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:

This graphic is explained in the accompanying text

Features

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.

Transformations include different types of routine: Start routines, routines for key figures or characteristics, end routines and expert routines.

The following figure shows the structure of the transformation program with transformation rules, start routine and end routine:

This graphic is explained in the accompanying text

The following figure shows the structure of the transformation program with expert routine:

This graphic is explained in the accompanying text

Start 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. This structure or table can be accessed 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. More information: the Routine section under Rule Type.

End Routine

An end routine is a routine with a table in the target structure format as input and output parameters. You can use an end routine to postprocess data after transformation on a package-by-package basis. For example, you can delete records that are not to be updated, or perform data checks.

Caution

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.

Expert Routine

This type of routine is only intended for use in special cases. You can use the expert routine if there are not sufficient functions to perform a transformation. The expert routine should be used 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 available rule types. You must implement the message transfer to the monitor yourself.

If you have already created transformation rules, the system deletes them once you have created an expert routine.

Caution

If the target of the transformation is a DataStore object, key figures are updated by default with the aggregation behavior Overwrite (MOVE).

More Information:

Example: Start Routine

Example: Characteristic Routines

Example: End Routine

 

End of Content Area