0% found this document useful (0 votes)
124 views2 pages

Start Routine To Populate All Columns at Once

Start Routine: Scenario: Looking up for the sales document information from a DSO 0CDS_DS02 and populating the fields in a transformation. The lookup is done globally instart routine so that all the other fields in the transformation can be assigned from the global data type gs_sa_item in the individual rules as RESULT= gs_sa_item-field name This is the code to be placed in start routine *$*$ begin of global - insert your declaration only below this line *-* DATA: gs_sa_item TYPE /bi0/acds_ds02

Uploaded by

kalyaniJ
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF or read online on Scribd
0% found this document useful (0 votes)
124 views2 pages

Start Routine To Populate All Columns at Once

Start Routine: Scenario: Looking up for the sales document information from a DSO 0CDS_DS02 and populating the fields in a transformation. The lookup is done globally instart routine so that all the other fields in the transformation can be assigned from the global data type gs_sa_item in the individual rules as RESULT= gs_sa_item-field name This is the code to be placed in start routine *$*$ begin of global - insert your declaration only below this line *-* DATA: gs_sa_item TYPE /bi0/acds_ds02

Uploaded by

kalyaniJ
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF or read online on Scribd
You are on page 1/ 2

Start Routine:

Scenario: Looking up for the sales document information from a DSO 0CDS_DS02 and
populating the fields in a transformation.
The lookup is done globally instart routine so that all the other fields in the
transformation can be assigned from the global data type gs_sa_item in the individual rules as
RESULT= gs_sa_item-field name
This is the code to be placed in start routine
*$*$ begin of global - insert your declaration only below this line *-*
DATA: gs_sa_item TYPE /bi0/acds_ds0200.
DATA: gt_orders TYPE STANDARD TABLE OF /bi0/acds_ds0200.
DATA: gs_orders TYPE /bi0/acds_ds0200.

DATA: gv_matnr TYPE /BI0/OIMATERIAL.


DATA: gv_doc_type TYPE /BI0/OIDOC_TYPE.
DATA: gv_ord_reason TYPE /BI0/OIORD_REASON.
DATA: gv_comp_code TYPE /BI0/OICOMP_CODE.
DATA: gv_sold_to TYPE /BI0/OISOLD_TO.
DATA: gv_cust_grp1 TYPE /BI0/OICUST_GRP1.
DATA: gv_cust_grp2 TYPE /BI0/OICUST_GRP2.
DATA: gv_cust_grp3 TYPE /BI0/OICUST_GRP3.
*$*$ end of global - insert your declaration only before this line *-*
METHOD start_routine.
*=== Segments ===

FIELD-SYMBOLS:
<SOURCE_FIELDS> TYPE _ty_s_SC_1.
DATA:
MONITOR_REC TYPE rstmonitor.

*$*$ begin of routine - insert your code only below this line *-*
DATA: ls_buffer TYPE _TY_S_SC_1.
DATA: lt_buffer TYPE STANDARD TABLE OF _TY_S_SC_1.
DATA: lv_idx TYPE sy-tabix.
DATA: ls_orders TYPE /bi0/acds_ds0200.

DATA: ls_sa_item TYPE /bi0/acds_ds0200,


ls_co_scl TYPE /bi0/acds_ds0400,
ls_monitor TYPE rsmonitor.
CONSTANTS: gc_message_id TYPE sy-msgid VALUE 'RS_BCT_APO_CDS'.
CLEAR ls_orders.

LT_BUFFER[] = SOURCE_PACKAGE[].

LOOP AT lt_buffer into ls_buffer.


lv_idx = sy-tabix.
IF ls_buffer-vbtyp NE 'C' AND
ls_buffer-vbtyp NE 'I'.
DELETE lt_buffer.
ELSE.
IF ls_buffer-rocancel EQ 'R'.
ls_buffer-rocancel = 'X'.
MODIFY lt_buffer FROM ls_buffer INDEX lv_idx
TRANSPORTING rocancel.

ENDIF.
ENDIF.
ENDLOOP.

SOURCE_PACKAGE[] = LT_BUFFER[].
IF SOURCE_PACKAGE[] IS NOT INITIAL.
SELECT * FROM /bi0/acds_ds0200
INTO TABLE gt_orders
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE doc_number = SOURCE_PACKAGE-vbeln
AND s_ord_item = SOURCE_PACKAGE-posnr.

IF gt_orders[] IS NOT INITIAL.


SORT gt_orders
BY doc_number s_ord_item.
ENDIF.

ENDIF.

Place the code below in one of the field mapping routine which ever comes first.

DATA: ls_orders TYPE /bi0/acds_ds0200.


CLEAR ls_orders.
CLEAR gs_sa_item.

READ TABLE gt_orders INTO ls_orders


WITH KEY
doc_number = SOURCE_FIELDS-vbeln
s_ord_item = SOURCE_FIELDS-posnr
BINARY SEARCH.

IF sy-subrc = 0.
gs_sa_item = ls_orders.
ENDIF.

RESULT = gs_sa_item-lowr_bnd

For all other fields you can just assign as

RESULT = gs_sa_item-sold_to

*------------------------------------------------------------------------------------------------------- *

You might also like