Example: End Routine
In the SAP ERP system, you are loading data using the General Ledger: Transaction Figures DataSource (0FI_GL_1) into the 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 field Value Type . 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.
-
You are in transformation maintenance. Choose
Create End Routine. The routine editor opens. -
You enter the following lines of code:

*----------------------------------------------------------------------*
METHODend_routine. *===Segments===
FIELD-SYMBOLS:
<RESULT_FIELDS>TYPE_ty_s_TG_1.
*$*$beginofroutine-insertyourcodeonlybelowthisline*-*
loopatRESULT_PACKAGEassigning<RESULT_FIELDS>
wherevtypeeq'010'orvtypeeq'020'.
case<RESULT_FIELDS>-vtype. when'010'. <RESULT_FIELDS>-/bic/zplactual='A'."Actual
when'020'. <RESULT_FIELDS>-/bic/zplactual='P'."Plan
endcase. endloop. *$*$endofroutine-insertyourcodeonlybeforethisline*-*
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).
-
You exit the routine editor.
-
You save the transformation. An edit icon
next to the End Routine indicates that an end routine is available.