SAP ABAP Data Element RSAN_WB_DST_ROUTINE (Transformation "Routine")
Hierarchy
SAP_BW (Software Component) SAP Business Warehouse
   BW-EI-APD (Application Component) Analysis Process Designer
     RSAN_WB (Package) APD - Tool - User Interface
Basic Data
Data Element RSAN_WB_DST_ROUTINE
Short Description Transformation "Routine"  
Data Type
Category of Dictionary Type     Direct Type Entry
Type of Object Referenced     No Information
Domain / Name of Reference Type      
Data Type STRG   Character String of Variable Length 
Length 0    
Decimal Places 0    
Output Length 0    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 10 Text 
Medium 20 Description 
Long 40 Description 
Heading 60 Description 
Documentation

Use

A transformation node transforms the data of an input table into an output table. You can use the routine node to implement any transformation with ABAP.

In the ABAP routine, you can access all the lines of the input table. The output table can contain as many lines as necessary. The following calculations, for example, are possible:

  • Determination of an ABC class
  • Determination of a lifetime period
  • Statistical functions, such as "Number of customers per period who made a purchase"

You can use different types of fields in your ABAP routine:

  • Grouping Fields

    Grouping fields are available as input fields in the routine and are returned unchanged in the output table of the node.

    You use grouping fields to define a group of data records. All data records that share the same values in the grouping fields constitute a group. The data in the input table of a node is grouped on the basis of the grouping fields, and the routine is only called up with the data for each group. If, for example, the ABC class is to be determined per customer group, the data can be partitioned by customer groups using the routine node. The routine is then called up several times, each time with the data for a specific customer group.

  • Source Fields

    Source fields are available as input fields in the routine but they are not returned in the output table of the node.

    In the routine, you can transform source fields into other fields. If you would like to return a source field as unchanged in the output table of the node, it needs to be defined as a target field. All selected source fields are transferred as a proposal into the list of target fields.

  • Target Fields

    Target fields are not available in the routine as input fields: They are only returned in the output table of the node.

    You can use a target field, for example, to include an additional column in the output table. You define a target field by entering a unique field name, a description, and an InfoObject.

The fields reappear with the same field name and description in subsequent nodes. The InfoObject is used to assign type properties (type, field length, check table) to the field.

Routine

In the routine, the grouping fields are available in a structure. However, they cannot be changed. The output structure of the routine therefore does not contain the fields. The grouping fields are later added automatically to the columns in the output table of the node.

The data transformation is implemented in the Routine tab page. Here, you implement a subprogram that is called up for each group of data records. The data transfer occurs using three parameters:

  • is_group contains the structure with the grouping fields
  • it_source contains the input table without the grouping fields
  • ir_context enables output of messages that are displayed later in the execution log. If there are error messages, the analysis process is ended intentionally (see below for more details).
  • et_target is the output table of the routine. This table has to be filled in the routine. When the routine is completed, the columns with the grouping fields are added to the data in this table and then the data is forwarded to the subsequent nodes.

Note the following restrictions:

  • The sequence of data records in data packages cannot be guaranteed. Before calling the transformation, the data is sorted according to grouping fields. This sorting usually destroys an organization that already exists from a previous transformation.
  • The sequence of data packages is not guaranteed.
  • Global variables cannot be used to exchange data between different calls of routines.
  • The sequence of fields in the data structures is not guaranteed.

Message Output and Error Handling

You can output messages from your routine when you call the method add_message for parameter ir_context and transfer the message data then. The messages appear in the log later.

With error messages (message type 'E', 'A' or 'X'), the analysis process ends immediately after the current call of the routine.

Activities

  1. Specify the grouping fields and source fields by completing the corresponding lists in the Source Fields tab page.
  2. In the Target Fields tab page, define the target fields by specifying a unique field name, a description, and an InfoObject.
    If you previously selected source fields in the Source Fields tab page, the fields are transferred as a proposal into the target field list. You can then delete these fields or add to them.
  3. Implement the data transformation in the Routine tab page.
    Program coding is generated as a proposal and it copies the data from the input table into the data of the output table.

Example

Example for the message output (message data from the system fields):

ir_context->add_message( i_msgty = sy-msgty
i_msgid = sy-msgid
i_msgid = sy-msgid
i_msgno = sy-msgno
i_msgv1 = sy-msgv1
i_msgv2 = sy-msgv2
i_msgv3 = sy-msgv3
i_msgv4 = sy-msgv4 ).

History
Last changed by/on SAP  20130604 
SAP Release Created in 30B