SAP Function Modules

CO_MP_BOM_READ SAP Function module - BOM selection using number and material







CO_MP_BOM_READ is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CO_MP_BOM_READ into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: COMP
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM CO_MP_BOM_READ - CO MP BOM READ





CALL FUNCTION 'CO_MP_BOM_READ' "BOM selection using number and material
* EXPORTING
*   emeng_imp =                 " stko-bmeng
*   matnr_imp =                 " mast-matnr
*   werks_imp =                 " mast-werks
*   capid_imp =                 " t399x-capid
*   flg_bom_only =              " rc27x-flg_sel
*   datum_imp =                 " resbd-bdter
*   stlan_imp =                 " mast-stlan
*   vbeln_imp =                 " resbd-kdauf
*   vbpos_imp =                 " resbd-kdpos
*   pspel_imp =                 " resbd-pspel
*   kokrs_imp =                 " caufvd-kokrs
*   flg_project_imp =           " rc27x-flg_sel
*   flg_sales_imp =             " rc27x-flg_sel
*   stlal_imp =                 " stko-stlal
  IMPORTING
    datuv_exp =                 " stko-datuv
    stlal_exp =                 " stko-stlal
    stlnr_exp =                 " stpo-stlnr
    stlty_exp =                 " stpo-stlty
    matnr_exp =                 " mast-matnr
    capid_exp =                 " t399x-capid
    werks_exp =                 " mast-werks
    stlan_exp =                 " mast-stlan
    flg_kdauf_exp =             " rc27x-flg_sel
    emeng_exp =                 " stko-bmeng
    flg_multi_exp =             " rc27x-flg_sel
    flg_psp_exp =               " rc27x-flg_sel
    pspel_exp =                 " resbd-pspel
    vbeln_exp =                 " resbd-kdauf
    vbpos_exp =                 " resbd-kdpos
    rc29l_exp =                 " rc29l
    not_valid =                 " c
  EXCEPTIONS
    NOT_FOUND = 1               "
    NO_CHOICE = 2               "
    PROVISION_PROHIBITED = 3    "
    .  "  CO_MP_BOM_READ

ABAP code example for Function Module CO_MP_BOM_READ





The ABAP code below is a full code listing to execute function module CO_MP_BOM_READ including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_datuv_exp  TYPE STKO-DATUV ,
ld_stlal_exp  TYPE STKO-STLAL ,
ld_stlnr_exp  TYPE STPO-STLNR ,
ld_stlty_exp  TYPE STPO-STLTY ,
ld_matnr_exp  TYPE MAST-MATNR ,
ld_capid_exp  TYPE T399X-CAPID ,
ld_werks_exp  TYPE MAST-WERKS ,
ld_stlan_exp  TYPE MAST-STLAN ,
ld_flg_kdauf_exp  TYPE RC27X-FLG_SEL ,
ld_emeng_exp  TYPE STKO-BMENG ,
ld_flg_multi_exp  TYPE RC27X-FLG_SEL ,
ld_flg_psp_exp  TYPE RC27X-FLG_SEL ,
ld_pspel_exp  TYPE RESBD-PSPEL ,
ld_vbeln_exp  TYPE RESBD-KDAUF ,
ld_vbpos_exp  TYPE RESBD-KDPOS ,
ld_rc29l_exp  TYPE RC29L ,
ld_not_valid  TYPE C .


SELECT single BMENG
FROM STKO
INTO @DATA(ld_emeng_imp).


SELECT single MATNR
FROM MAST
INTO @DATA(ld_matnr_imp).


SELECT single WERKS
FROM MAST
INTO @DATA(ld_werks_imp).


SELECT single CAPID
FROM T399X
INTO @DATA(ld_capid_imp).


DATA(ld_flg_bom_only) = some text here

DATA(ld_datum_imp) = 20210129

SELECT single STLAN
FROM MAST
INTO @DATA(ld_stlan_imp).


DATA(ld_vbeln_imp) = some text here

DATA(ld_vbpos_imp) = Check type of data required

DATA(ld_pspel_imp) = Check type of data required

DATA(ld_kokrs_imp) = some text here

DATA(ld_flg_project_imp) = some text here

DATA(ld_flg_sales_imp) = some text here

SELECT single STLAL
FROM STKO
INTO @DATA(ld_stlal_imp).
. CALL FUNCTION 'CO_MP_BOM_READ' * EXPORTING * emeng_imp = ld_emeng_imp * matnr_imp = ld_matnr_imp * werks_imp = ld_werks_imp * capid_imp = ld_capid_imp * flg_bom_only = ld_flg_bom_only * datum_imp = ld_datum_imp * stlan_imp = ld_stlan_imp * vbeln_imp = ld_vbeln_imp * vbpos_imp = ld_vbpos_imp * pspel_imp = ld_pspel_imp * kokrs_imp = ld_kokrs_imp * flg_project_imp = ld_flg_project_imp * flg_sales_imp = ld_flg_sales_imp * stlal_imp = ld_stlal_imp IMPORTING datuv_exp = ld_datuv_exp stlal_exp = ld_stlal_exp stlnr_exp = ld_stlnr_exp stlty_exp = ld_stlty_exp matnr_exp = ld_matnr_exp capid_exp = ld_capid_exp werks_exp = ld_werks_exp stlan_exp = ld_stlan_exp flg_kdauf_exp = ld_flg_kdauf_exp emeng_exp = ld_emeng_exp flg_multi_exp = ld_flg_multi_exp flg_psp_exp = ld_flg_psp_exp pspel_exp = ld_pspel_exp vbeln_exp = ld_vbeln_exp vbpos_exp = ld_vbpos_exp rc29l_exp = ld_rc29l_exp not_valid = ld_not_valid EXCEPTIONS NOT_FOUND = 1 NO_CHOICE = 2 PROVISION_PROHIBITED = 3 . " CO_MP_BOM_READ
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_datuv_exp  TYPE STKO-DATUV ,
ld_emeng_imp  TYPE STKO-BMENG ,
ld_stlal_exp  TYPE STKO-STLAL ,
ld_matnr_imp  TYPE MAST-MATNR ,
ld_werks_imp  TYPE MAST-WERKS ,
ld_stlnr_exp  TYPE STPO-STLNR ,
ld_stlty_exp  TYPE STPO-STLTY ,
ld_capid_imp  TYPE T399X-CAPID ,
ld_flg_bom_only  TYPE RC27X-FLG_SEL ,
ld_matnr_exp  TYPE MAST-MATNR ,
ld_capid_exp  TYPE T399X-CAPID ,
ld_datum_imp  TYPE RESBD-BDTER ,
ld_werks_exp  TYPE MAST-WERKS ,
ld_stlan_imp  TYPE MAST-STLAN ,
ld_stlan_exp  TYPE MAST-STLAN ,
ld_vbeln_imp  TYPE RESBD-KDAUF ,
ld_vbpos_imp  TYPE RESBD-KDPOS ,
ld_flg_kdauf_exp  TYPE RC27X-FLG_SEL ,
ld_pspel_imp  TYPE RESBD-PSPEL ,
ld_emeng_exp  TYPE STKO-BMENG ,
ld_flg_multi_exp  TYPE RC27X-FLG_SEL ,
ld_kokrs_imp  TYPE CAUFVD-KOKRS ,
ld_flg_psp_exp  TYPE RC27X-FLG_SEL ,
ld_flg_project_imp  TYPE RC27X-FLG_SEL ,
ld_pspel_exp  TYPE RESBD-PSPEL ,
ld_flg_sales_imp  TYPE RC27X-FLG_SEL ,
ld_vbeln_exp  TYPE RESBD-KDAUF ,
ld_stlal_imp  TYPE STKO-STLAL ,
ld_vbpos_exp  TYPE RESBD-KDPOS ,
ld_rc29l_exp  TYPE RC29L ,
ld_not_valid  TYPE C .


SELECT single BMENG
FROM STKO
INTO ld_emeng_imp.


SELECT single MATNR
FROM MAST
INTO ld_matnr_imp.


SELECT single WERKS
FROM MAST
INTO ld_werks_imp.


SELECT single CAPID
FROM T399X
INTO ld_capid_imp.


ld_flg_bom_only = some text here

ld_datum_imp = 20210129

SELECT single STLAN
FROM MAST
INTO ld_stlan_imp.


ld_vbeln_imp = some text here

ld_vbpos_imp = Check type of data required

ld_pspel_imp = Check type of data required

ld_kokrs_imp = some text here

ld_flg_project_imp = some text here

ld_flg_sales_imp = some text here

SELECT single STLAL
FROM STKO
INTO ld_stlal_imp.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CO_MP_BOM_READ or its description.