SAP MGW1_CREATE_BOM Function Module for NOTRANSL: Anlage einer Stückliste zu einem strukt. Artikel









MGW1_CREATE_BOM is a standard mgw1 create 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: Anlage einer Stückliste zu einem strukt. Artikel 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 create bom FM, simply by entering the name MGW1_CREATE_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_CREATE_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_CREATE_BOM'"NOTRANSL: Anlage einer Stückliste zu einem strukt. Artikel
EXPORTING
* BOM_TYP = 'M' "Change Mode
* HEAD = "BOM Header Data
* TLES = "
* FL_COMMIT_AND_WAIT = ' ' "
* NO_COMMIT = ' ' "Simulation
STRUC_MATERIAL = "Material
* STRUC_UNIT = ' ' "Unit of Measure
STRUC_TYPE = "BOM Category
STRUC_ALTERNATIVE = "Alternative BOM
BOM_TEXT = "Bill of material text
BOM_USAGE = "BOM Usage
* VALID_FROM = SY-DATUM "Valid-From Date
* VALID_TO = '99991231' "Valid-To Date

IMPORTING
BOM_NO = "Bill of Materials No.
RETURNCODE = "

TABLES
* COMPONENT = "BOM Items

EXCEPTIONS
NO_BOM_CREATE = 1
.



IMPORTING Parameters details for MGW1_CREATE_BOM

BOM_TYP - Change Mode

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

HEAD - BOM Header Data

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

TLES -

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

FL_COMMIT_AND_WAIT -

Data type: CAPIFLAG-COMM_WAIT
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

NO_COMMIT - Simulation

Data type: CSDATA-XFELD
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

STRUC_MATERIAL - Material

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
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

STRUC_TYPE - BOM Category

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

STRUC_ALTERNATIVE - Alternative BOM

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

BOM_TEXT - Bill of material text

Data type: MAKT-MAKTX
Optional: No
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)

VALID_FROM - Valid-From Date

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

VALID_TO - Valid-To Date

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

EXPORTING Parameters details for MGW1_CREATE_BOM

BOM_NO - Bill of Materials No.

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

RETURNCODE -

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

TABLES Parameters details for MGW1_CREATE_BOM

COMPONENT - BOM Items

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

EXCEPTIONS details

NO_BOM_CREATE - Terminate processing

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

Copy and paste ABAP code example for MGW1_CREATE_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_no  TYPE STZUB-STLNR, "   
lv_bom_typ  TYPE CSIN-STLTY, "   'M'
lt_component  TYPE STANDARD TABLE OF STPOB, "   
lv_no_bom_create  TYPE STPOB, "   
lv_head  TYPE STKOB, "   
lv_tles  TYPE STZUB, "   
lv_fl_commit_and_wait  TYPE CAPIFLAG-COMM_WAIT, "   SPACE
lv_no_commit  TYPE CSDATA-XFELD, "   SPACE
lv_returncode  TYPE SY-SUBRC, "   
lv_struc_material  TYPE CSIN-MATNR, "   
lv_struc_unit  TYPE RMGW2-MEINH, "   SPACE
lv_struc_type  TYPE TMGW2-STRTP, "   
lv_struc_alternative  TYPE CSIN-STLAL, "   
lv_bom_text  TYPE MAKT-MAKTX, "   
lv_bom_usage  TYPE CSIN-STLAN, "   
lv_valid_from  TYPE CSIN-DATUV, "   SY-DATUM
lv_valid_to  TYPE CSIN-DATUB. "   '99991231'

  CALL FUNCTION 'MGW1_CREATE_BOM'  "NOTRANSL: Anlage einer Stückliste zu einem strukt. Artikel
    EXPORTING
         BOM_TYP = lv_bom_typ
         HEAD = lv_head
         TLES = lv_tles
         FL_COMMIT_AND_WAIT = lv_fl_commit_and_wait
         NO_COMMIT = lv_no_commit
         STRUC_MATERIAL = lv_struc_material
         STRUC_UNIT = lv_struc_unit
         STRUC_TYPE = lv_struc_type
         STRUC_ALTERNATIVE = lv_struc_alternative
         BOM_TEXT = lv_bom_text
         BOM_USAGE = lv_bom_usage
         VALID_FROM = lv_valid_from
         VALID_TO = lv_valid_to
    IMPORTING
         BOM_NO = lv_bom_no
         RETURNCODE = lv_returncode
    TABLES
         COMPONENT = lt_component
    EXCEPTIONS
        NO_BOM_CREATE = 1
. " MGW1_CREATE_BOM




ABAP code using 7.40 inline data declarations to call FM MGW1_CREATE_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 STLNR FROM STZUB INTO @DATA(ld_bom_no).
 
"SELECT single STLTY FROM CSIN INTO @DATA(ld_bom_typ).
DATA(ld_bom_typ) = 'M'.
 
 
 
 
 
"SELECT single COMM_WAIT FROM CAPIFLAG INTO @DATA(ld_fl_commit_and_wait).
DATA(ld_fl_commit_and_wait) = ' '.
 
"SELECT single XFELD FROM CSDATA INTO @DATA(ld_no_commit).
DATA(ld_no_commit) = ' '.
 
"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).
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 MAKTX FROM MAKT INTO @DATA(ld_bom_text).
 
"SELECT single STLAN FROM CSIN INTO @DATA(ld_bom_usage).
 
"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'.
 


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!