Link between PLKO and PLPO for Routine in SAP will be explain in this post with the definition of each tables involved and a sample ABAP Code to retrieve for a Production Version the Routine.
SAP Routines Tables
Let first introduce the SAP Tables used for Production:
Table | SAP Routine Tables |
---|---|
PLKO |  Task list – header |
PLPO |  Task list – operation/activity |
PLMZ |  Allocation of bill of material items to operations |
PLAS |  Task list – selection of operations/activities |
PLAB | Relationships |
PLAF | Planned order |
PLFH | Task list – production resources/tools |
PLFL | Task list – sequences |
PLFT | Process Instructions |
PLFV | PI Characteristics/Sub-Operation Parameter Values |
PLKV | View of planned order header data |
PLKZ | Task list main header |
PLMK | Inspection plan characteristics |
PLMW | MAPL-Dependent Charac. Specifications (Inspection Plan)Â |
PLPH | CAPPÂ Sub-operations |
PLPB | Long-term planning Independent requirements versions |
PLPW | Index of the production/delivery plant in the planned order |
PLSR | Scheduling results |
PLST | Status table for planned order processing |
PLZU | Routing data for group |
The next step is how to link between theses SAP main tables in SAP PP.
Main Keys fields for
In order to figure out the Link Between PLKO and PLPO, it is important to know the Main keys fields for are:
Key Fields | SAP Routines Tables Key Fields |
---|---|
PLNTY | Task List Type Number (for orders from AFKO, for notifications from |
PLNNR | Group (for orders from AFKO, for notifications from QMIH) |
PLNAL | Group Counter (for orders from AFKO, for notifications from QMIH) |
Link between PLKO and PLPO
This section will cover the relationship between PLPO and PLKO.
The link between PLKO : Routine Header and PLPO Routine Post is done in the table PLAS.
An example of SAP Select how to retrieve PLAS : Link between PLPO and PLKO
1 2 3 4 5 6 7 8 9 10 11 12 13 |
*----------------------------------------------------* * READ PLAS *----------------------------------------------------* IF NOT lt_plko[] IS INITIAL.   SELECT * FROM plas INTO TABLE lt_plas   FOR ALL ENTRIES IN lt_plko   WHERE plnty = lt_plko-plnty     AND plnnr = lt_plko-plnnr     AND plnal = lt_plko-plnal     AND loekz NE 'X'.    DELETE ADJACENT DUPLICATES FROM lt_plas COMPARING ALL FIELDS. ENDIF. |
An example SAP Select to retrieve the PLPO with the PLAS-link to PLKO.
1 2 3 4 5 6 7 8 9 10 11 12 |
*----------------------------------------------------* * READ PLPO *----------------------------------------------------* IF NOT lt_plas[] IS INITIAL.   SELECT * FROM plpo INTO TABLE lt_plpo     FOR ALL ENTRIES IN lt_plas     WHERE plnty = lt_plas-plnty       AND plnnr = lt_plas-plnnr       AND plnkn = lt_plas-plnkn       AND zaehl = lt_plas-zaehl.   DELETE ADJACENT DUPLICATES FROM lt_plpo COMPARING ALL FIELDS. ENDIF. |
An ABAP sample code to retrieve the different link between PLKO and PLPO using PLAS can be :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
READ TABLE lt_plko INTO ls_plko     WITH KEY plnnr = IV_plnnr " Input             plnty = IV_plnty " Input . IF sy-subrc = 0 . " write your ABAP Custom Logic ENDIF.   " LINK BETWEEN PLKO AND PLPO -> PLAS LOOP AT lt_plas INTO ls_plas WHERE plnnr = ls_plko-plnnr                               AND plnty = ls_plko-plnty.    READ TABLE lt_plpo INTO ls_plpo   WITH KEY plnty = ls_plas-plnty             plnnr = ls_plas-plnnr             plnkn = ls_plas-plnkn             zaehl = ls_plas-zaehl.   IF sy-subrc = 0 .   " CUSTOM LOGIC HERE   ENDIF. ENDLOOP |
Link Between PLKO and PLMZ
PLPO is the SAP Table Routine lines and PLMZ Table stores the relationship between the Routine line and the BOM Component.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
*----------------------------------------------------* * READ PLMZ *----------------------------------------------------* IF NOT lt_plpo[] IS INITIAL. SELECT * FROM plmz INTO TABLE lt_plmz   FOR ALL ENTRIES IN lt_plpo   WHERE plnty = lt_plpo-plnty     AND plnnr = lt_plpo-plnnr     AND loekz NE 'X'     AND plnkn = lt_plpo-plnkn.   DELETE ADJACENT DUPLICATES FROM lt_plmz COMPARING ALL FIELDS. ENDIF.  LOOP AT lt_plmz INTO ls_plmz WHERE plnnr = ls_plko-plnnr                               AND plnty = ls_plko-plnty.    READ TABLE lt_plpo INTO ls_plpo_2     WITH KEY plnty = ls_plmz-plnty             plnnr = ls_plmz-plnnr             plnkn = ls_plmz-plnkn.   IF SY-SUBRC = 0.   ENDIF. ENDLOOP |
PLPO Table in SAP, PLKO Table in SAP, PLPO & PLKO Link, PLOK Task List