SAP MGW0_PACKAGING_COMPONENTS Function Module for
MGW0_PACKAGING_COMPONENTS is a standard mgw0 packaging components SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 mgw0 packaging components FM, simply by entering the name MGW0_PACKAGING_COMPONENTS into the relevant SAP transaction such as SE37 or SE38.
Function Group: MGW0
Program Name: SAPLMGW0
Main Program:
Appliation area: W
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function MGW0_PACKAGING_COMPONENTS 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 'MGW0_PACKAGING_COMPONENTS'".
EXPORTING
MGW0_ARTICLE = "Material
* MGW0_DATE_FROM = SY-DATUM "Date from
* MGW0_DATE_TO = SY-DATUM "
* MGW0_PLANT = ' ' "Plant
MGW0_UNIT = "Unit of measure
TABLES
MGW0_COMPONENTS = "
EXCEPTIONS
NOT_FOUND = 1
IMPORTING Parameters details for MGW0_PACKAGING_COMPONENTS
MGW0_ARTICLE - Material
Data type: MARA-MATNROptional: No
Call by Reference: No ( called with pass by value option)
MGW0_DATE_FROM - Date from
Data type: STPO-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
MGW0_DATE_TO -
Data type: STPO-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
MGW0_PLANT - Plant
Data type: MARC-WERKSDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
MGW0_UNIT - Unit of measure
Data type: MARA-MEINSOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MGW0_PACKAGING_COMPONENTS
MGW0_COMPONENTS -
Data type: STPOBOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NOT_FOUND - Components not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MGW0_PACKAGING_COMPONENTS 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_not_found | TYPE STRING, " | |||
| lv_mgw0_article | TYPE MARA-MATNR, " | |||
| lt_mgw0_components | TYPE STANDARD TABLE OF STPOB, " | |||
| lv_mgw0_date_from | TYPE STPO-DATUV, " SY-DATUM | |||
| lv_mgw0_date_to | TYPE STPO-DATUV, " SY-DATUM | |||
| lv_mgw0_plant | TYPE MARC-WERKS, " ' ' | |||
| lv_mgw0_unit | TYPE MARA-MEINS. " |
|   CALL FUNCTION 'MGW0_PACKAGING_COMPONENTS' " |
| EXPORTING | ||
| MGW0_ARTICLE | = lv_mgw0_article | |
| MGW0_DATE_FROM | = lv_mgw0_date_from | |
| MGW0_DATE_TO | = lv_mgw0_date_to | |
| MGW0_PLANT | = lv_mgw0_plant | |
| MGW0_UNIT | = lv_mgw0_unit | |
| TABLES | ||
| MGW0_COMPONENTS | = lt_mgw0_components | |
| EXCEPTIONS | ||
| NOT_FOUND = 1 | ||
| . " MGW0_PACKAGING_COMPONENTS | ||
ABAP code using 7.40 inline data declarations to call FM MGW0_PACKAGING_COMPONENTS
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 MATNR FROM MARA INTO @DATA(ld_mgw0_article). | ||||
| "SELECT single DATUV FROM STPO INTO @DATA(ld_mgw0_date_from). | ||||
| DATA(ld_mgw0_date_from) | = SY-DATUM. | |||
| "SELECT single DATUV FROM STPO INTO @DATA(ld_mgw0_date_to). | ||||
| DATA(ld_mgw0_date_to) | = SY-DATUM. | |||
| "SELECT single WERKS FROM MARC INTO @DATA(ld_mgw0_plant). | ||||
| DATA(ld_mgw0_plant) | = ' '. | |||
| "SELECT single MEINS FROM MARA INTO @DATA(ld_mgw0_unit). | ||||
Search for further information about these or an SAP related objects