Show TOC

Example: End RoutineLocate this document in the navigation structure

Use

You use DataSource General Ledger: Transaction Figures (0FI_GL_1) to load data into DataStore object FIGL: Transaction Figures (0FIGL_O06).

You want to create an end routine to fill the additional InfoObject Plan/Actual Indicator (ZPLACTUAL). You also want the routine to read the Value Type field. If the value is 10 (actual), value A is written to the Plan/Actual Indicator InfoObject; if the value is 20 (plan), value P is written to the Plan/Actual Indicator InfoObject.

  1. You are in transformation maintenance. Choose Create End Routine. The routine editor opens.

  2. You enter the following lines of code:

Sample Code
*----------------------------------------------------------------------*
  METHOD end_routine.
*=== Segments ===

    FIELD-SYMBOLS:
      <RESULT_FIELDS>    TYPE _ty_s_TG_1.

*$*$ begin of routine - insert your code only below this line        *-*
 
    loop at RESULT_PACKAGE assigning <RESULT_FIELDS>
      where vtype eq '010' or vtype eq '020'.
      case <RESULT_FIELDS>-vtype.
        when '010'.
          <RESULT_FIELDS>-/bic/zplactual = 'A'. "Actual
        when '020'.
          <RESULT_FIELDS>-/bic/zplactual = 'P'. "Plan 
      endcase.
    endloop.
*$*$ end of routine - insert your code only before this line         *-*
  ENDMETHOD.                    "end_routine
*----------------------------------------------------------------------*

The code loops through the result_package searching for values that have the value type 10 or 20. For these values, the appropriate value is passed on to InfoObject Plan/Actual Indicator (ZPLACTUAL).

  1. You quit the routine editor.

  2. You save the transformation. An edit icon next to the End Routine indicates that an end routine is available.