How to link STKO and STPO : Find the link between STKO and STPO is a common requirement in SAP PP for example. This post will guide through the SAP Tables Diagram for SAP BOM.
Table of Contents
The main SAP tables involved in this topic will be
You can also, just use the following join without using the STAS link Table.
? ? ? ? STKO-STLTY = STPO-STLTY
AND STKO-STLNR = STPO-STLNR
Check SAP BOM Overview for details or Bill of Material (BOM)?.
Here an example how to retrieve Data with a sample ABAP Select code
Read Data for BOM Header STKO from a SAP Production Version:
*----------------------------------------------------* * READ STKO *----------------------------------------------------* IF NOT lt_mast[] IS INITIAL. SELECT * FROM stko INTO TABLE lt_stko WHERE stlnr = IV_stlnr AND stlal = IV_stlal. DELETE ADJACENT DUPLICATES FROM lt_stko COMPARING ALL FIELDS. ENDIF.
Read the different link STAS between BOM header STKO and BOM components STPO.
*----------------------------------------------------* * READ STAS *----------------------------------------------------* IF NOT lt_stko[] IS INITIAL. SELECT * FROM stas INTO TABLE lt_stas FOR ALL ENTRIES IN lt_stko WHERE stlty = lt_stko-stlty AND stlnr = lt_stko-stlnr AND stlal = lt_stko-stlal. DELETE ADJACENT DUPLICATES FROM lt_stas COMPARING ALL FIELDS. ENDIF.
Read the BOM Components STPO using the link from STAS
*----------------------------------------------------* * READ STPO *----------------------------------------------------* IF NOT lt_stas[] IS INITIAL. SELECT * FROM stpo INTO TABLE lt_stpo FOR ALL ENTRIES IN lt_stas WHERE stlty = lt_stas-stlty AND stlnr = lt_stas-stlnr AND stlkn = lt_stas-stlkn. DELETE ADJACENT DUPLICATES FROM lt_stpo COMPARING ALL FIELDS. SORT lt_stpo BY posnr DESCENDING. ENDIF.
Here a sample ABAP code to retrieve the SAP BOM component used for Production version
READ TABLE lt_stko INTO ls_stko WITH KEY stlnr = ls_mast-stlnr stlal = ls_mast-stlal. IF SY-SUBRC = 0 . LOOP AT lt_stpo INTO ls_stpo WHERE stlty = ls_stko-stlty AND stlnr = ls_stko-stlnr. ENDLOOP. ENDIF.
STPO Table in SAP, STKO Table in SAP, STPO BOM Component, STKO BOM
SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…
SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…
Dunning is the business practice of informing a customer of past due payment. Dunning letters…
SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…
What are the main SAP Payment Terms Tables ? What are the related Tables in…
Work center consists of master data related to routing of products. It contains data related…