Skip to Content
0
Jul 06, 2020 at 03:55 PM

Correct FM for reading BOM items?

354 Views

What is the correct way when I want to read Sales BOM item?

Digging through the standard code I found following piece in several places:

    CALL FUNCTION 'CSAP_MAT_BOM_SELECT'
         EXPORTING
              material             = lv_pricat_k003-matnr_extern
              plant                = is_pricat_pro-bom_plant
              bom_usage            = is_pricat_pro-bom_usage
        TABLES
            t_mast                 = lt_mast_api02
        EXCEPTIONS
             error                 = 1
             OTHERS                = 2
			 
LOOP AT it_mast_api02 ASSIGNING <ls_mast_api02> WHERE bom_alt = 1.
* Es wird nur die erste Alternative verwendet.
    CALL FUNCTION 'CSAP_MAT_BOM_READ'
         EXPORTING
              material       = <ls_mast_api02>-material
              plant          = <ls_mast_api02>-plant
              bom_usage      = <ls_mast_api02>-bom_usage
              alternative    = <ls_mast_api02>-bom_alt
*           VALID_FROM     =
*           VALID_TO       =
*           CHANGE_NO      =
*           REVISION_LEVEL =
*      IMPORTING
*           ls_WARNING     =
        TABLES
             t_stpo         = lt_tstpo
             t_stko         = lt_tstko
*           T_DEP_DATA     =
*           T_DEP_DESCR    =
*           T_DEP_ORDER    =
*           T_DEP_SOURCE   =
*           T_DEP_DOC      =
        EXCEPTIONS
             error          = 1
             OTHERS         = 2
             .
      APPEND LINES OF lt_tstpo TO rt_tstpo.
  ENDLOOP.

Selecting BOM via CSAP_MAT_BOM_SELECT and then reading it with CSAP_MAT_BOM_READ is it correct way?

Then why the heck we need CSAP_MAT_BOM_ITEM_SELECT?

It does almost the same as CSAP_MAT_BOM_READ except that latter returns STKO and STPO (header + item) and CSAP_MAT_BOM_ITEM_SELECT returns only item.

Should I use CSAP_MAT_BOM_ITEM_SELECT or CSAP_MAT_BOM_READ for reading BOM?