3. Now Start to add the code below code in end routine. -
TYPES: BEGIN OF ls_plnt,
MAT_PLANT TYPE /BI0/OIMAT_PLANT,
PLANT TYPE /BI0/OIPLANT,
END OF ls_plnt,
BEGIN OF ls_wctr,
PLANT TYPE /BI0/OIPLANT,
WORKCENTER TYPE /BI0/OIWORKCENTER,
WRKCT_RESP TYPE /BI0/OIWRKCT_RESP,
END OF ls_wctr.
DATA: lt_plnt TYPE STANDARD TABLE OF ls_plnt,
wa_plnt TYPE ls_plnt,
lt_wctr TYPE STANDARD TABLE OF ls_wctr,
wa_wctr TYPE ls_wctr.
*----------------------------------------------------------------------
*prepare Plant master data
SELECT MAT_PLANT PLANT FROM
/BI0/PMAT_PLANT
INTO CORRESPONDING FIELDS OF TABLE lt_plnt FOR ALL ENTRIES IN
RESULT_PACKAGE
WHERE MAT_PLANT = RESULT_PACKAGE-MATERIAL.
*Populate Plant and workcenter from material master data
CLEAR wa_plnt.
LOOP at RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_plnt INTO wa_plnt
WITH KEY MAT_PLANT = <result_fields>-MATERIAL .
IF sy-subrc = 0.
<result_fields>-PLANT = wa_plnt-PLANT.
ENDIF.
ENDLOOP.
*----------------------------------------------------------------------*
*prepare workcenter master data
SELECT PLANT WORKCENTER WRKCT_RESP FROM
/BI0/PWORKCENTER
INTO CORRESPONDING FIELDS OF TABLE lt_wctr FOR ALL ENTRIES IN
RESULT_PACKAGE
WHERE PLANT = RESULT_PACKAGE-PLANT.
*populate from material master data
CLEAR wa_wctr.
LOOP at RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_wctr INTO wa_wctr
WITH KEY PLANT = <result_fields>-PLANT .
IF sy-subrc = 0.
<result_fields>-WORKCENTER = wa_wctr-WORKCENTER.
<result_fields>-WRKCT_RESP = wa_wctr-WRKCT_RESP.
ENDIF.
ENDLOOP.
*--------------------------------------------------------
4. The sub steps inside the ABAP code describe below -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |