Professional Documents
Culture Documents
Example: End Routine
Example: End Routine
Example: End Routine
In the SAP ERP system, you are loading data using the General Ledger:
Transaction Figures Data Source (0FI_GL_1) into the Data Store object FIGL:
Transaction Figures (0FIGL_O06).
You want to create an end routine to fill the additional Info Object Plan/Actual
Indicator (ZPLACTUAL). You also want the routine to read field Value Type.
If the value is 10 (actual), value A is written to the Plan/Actual
IndicatorInfoObject; if the value is 20 (plan), value P is written to
the Plan/Actual Indicator Info Object.
1. You are in transformation maintenance. Choose Create End
Routine. The routine editor opens.
2. You enter the following lines of 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 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).
3. You exit the routine editor.
4. You save the transformation. An edit icon next to the End
Routine indicates that an end routine is available.