SAP MGW1_READ_BOM Function Module for NOTRANSL: Lesen der Stückliste zu einem strukt. Artikel und Alternative









MGW1_READ_BOM is a standard mgw1 read bom SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Lesen der Stückliste zu einem strukt. Artikel und Alternative processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for mgw1 read bom FM, simply by entering the name MGW1_READ_BOM into the relevant SAP transaction such as SE37 or SE38.

Function Group: MGW1
Program Name: SAPLMGW1
Main Program: SAPLMGW1
Appliation area: W
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MGW1_READ_BOM pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'MGW1_READ_BOM'"NOTRANSL: Lesen der Stückliste zu einem strukt. Artikel und Alternative
EXPORTING
* BOM_TYP = 'M' "Maintenance mode
STRUC_MATERIAL = "structured matl
STRUC_UNIT = "Unit of Measure
STRUC_TYPE = "DE-EN-LANG-SWITCH-NO-TRANSLATION
STRUC_ALTERNATIVE = "DE-EN-LANG-SWITCH-NO-TRANSLATION
* VALID_FROM = SY-DATUM "Valid From
* VALID_TO = '99991231' "Valid To
BOM_USAGE = "BOM Usage

IMPORTING
RETURNCODE = "Return Code

TABLES
COMPONENT = "Components
HEAD = "Header

EXCEPTIONS
BOM_NOT_EXIST = 1
.



IMPORTING Parameters details for MGW1_READ_BOM

BOM_TYP - Maintenance mode

Data type: CSIN-STLTY
Default: 'M'
Optional: Yes
Call by Reference: No ( called with pass by value option)

STRUC_MATERIAL - structured matl

Data type: CSIN-MATNR
Optional: No
Call by Reference: No ( called with pass by value option)

STRUC_UNIT - Unit of Measure

Data type: RMGW2-MEINH
Optional: No
Call by Reference: No ( called with pass by value option)

STRUC_TYPE - DE-EN-LANG-SWITCH-NO-TRANSLATION

Data type: TMGW2-STRTP
Optional: No
Call by Reference: No ( called with pass by value option)

STRUC_ALTERNATIVE - DE-EN-LANG-SWITCH-NO-TRANSLATION

Data type: CSIN-STLAL
Optional: No
Call by Reference: No ( called with pass by value option)

VALID_FROM - Valid From

Data type: CSIN-DATUV
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

VALID_TO - Valid To

Data type: CSIN-DATUB
Default: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)

BOM_USAGE - BOM Usage

Data type: CSIN-STLAN
Optional: No
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for MGW1_READ_BOM

RETURNCODE - Return Code

Data type: SY-SUBRC
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for MGW1_READ_BOM

COMPONENT - Components

Data type: STPOB
Optional: No
Call by Reference: No ( called with pass by value option)

HEAD - Header

Data type: STKOB
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

BOM_NOT_EXIST - Bill of material does not exist

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for MGW1_READ_BOM Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.

DATA:
lv_bom_typ  TYPE CSIN-STLTY, "   'M'
lt_component  TYPE STANDARD TABLE OF STPOB, "   
lv_returncode  TYPE SY-SUBRC, "   
lv_bom_not_exist  TYPE SY, "   
lt_head  TYPE STANDARD TABLE OF STKOB, "   
lv_struc_material  TYPE CSIN-MATNR, "   
lv_struc_unit  TYPE RMGW2-MEINH, "   
lv_struc_type  TYPE TMGW2-STRTP, "   
lv_struc_alternative  TYPE CSIN-STLAL, "   
lv_valid_from  TYPE CSIN-DATUV, "   SY-DATUM
lv_valid_to  TYPE CSIN-DATUB, "   '99991231'
lv_bom_usage  TYPE CSIN-STLAN. "   

  CALL FUNCTION 'MGW1_READ_BOM'  "NOTRANSL: Lesen der Stückliste zu einem strukt. Artikel und Alternative
    EXPORTING
         BOM_TYP = lv_bom_typ
         STRUC_MATERIAL = lv_struc_material
         STRUC_UNIT = lv_struc_unit
         STRUC_TYPE = lv_struc_type
         STRUC_ALTERNATIVE = lv_struc_alternative
         VALID_FROM = lv_valid_from
         VALID_TO = lv_valid_to
         BOM_USAGE = lv_bom_usage
    IMPORTING
         RETURNCODE = lv_returncode
    TABLES
         COMPONENT = lt_component
         HEAD = lt_head
    EXCEPTIONS
        BOM_NOT_EXIST = 1
. " MGW1_READ_BOM




ABAP code using 7.40 inline data declarations to call FM MGW1_READ_BOM

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single STLTY FROM CSIN INTO @DATA(ld_bom_typ).
DATA(ld_bom_typ) = 'M'.
 
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_returncode).
 
 
 
"SELECT single MATNR FROM CSIN INTO @DATA(ld_struc_material).
 
"SELECT single MEINH FROM RMGW2 INTO @DATA(ld_struc_unit).
 
"SELECT single STRTP FROM TMGW2 INTO @DATA(ld_struc_type).
 
"SELECT single STLAL FROM CSIN INTO @DATA(ld_struc_alternative).
 
"SELECT single DATUV FROM CSIN INTO @DATA(ld_valid_from).
DATA(ld_valid_from) = SY-DATUM.
 
"SELECT single DATUB FROM CSIN INTO @DATA(ld_valid_to).
DATA(ld_valid_to) = '99991231'.
 
"SELECT single STLAN FROM CSIN INTO @DATA(ld_bom_usage).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!