SAP LGNUM_INITIAL Function Module for NOTRANSL: Wenn Lagernr ungefüllt ist, darf MLGN oder MLGT nicht verändert
LGNUM_INITIAL is a standard lgnum initial 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: Wenn Lagernr ungefüllt ist, darf MLGN oder MLGT nicht verändert 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 lgnum initial FM, simply by entering the name LGNUM_INITIAL into the relevant SAP transaction such as SE37 or SE38.
Function Group: MG80
Program Name: SAPLMG80
Main Program: SAPLMG80
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function LGNUM_INITIAL 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 'LGNUM_INITIAL'"NOTRANSL: Wenn Lagernr ungefüllt ist, darf MLGN oder MLGT nicht verändert.
EXPORTING
LGNUM = "Warehouse Number / Warehouse Complex
* P_KZ_NO_WARN = ' ' "For message type conversion
OMLGN = "Material Data for Each Warehouse Number
OMLGT = "Material Data for Each Storage Type
CHANGING
WMLGN = "Material Data for Each Warehouse Number
WMLGT = "Material Data for Each Storage Type
EXCEPTIONS
LGNUM_INITIAL = 1
IMPORTING Parameters details for LGNUM_INITIAL
LGNUM - Warehouse Number / Warehouse Complex
Data type: RMMG1-LGNUMOptional: No
Call by Reference: No ( called with pass by value option)
P_KZ_NO_WARN - For message type conversion
Data type: RMMG08_012-MSGTYPDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
OMLGN - Material Data for Each Warehouse Number
Data type: MLGNOptional: No
Call by Reference: No ( called with pass by value option)
OMLGT - Material Data for Each Storage Type
Data type: MLGTOptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for LGNUM_INITIAL
WMLGN - Material Data for Each Warehouse Number
Data type: MLGNOptional: No
Call by Reference: No ( called with pass by value option)
WMLGT - Material Data for Each Storage Type
Data type: MLGTOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
LGNUM_INITIAL -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for LGNUM_INITIAL 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_lgnum | TYPE RMMG1-LGNUM, " | |||
| lv_wmlgn | TYPE MLGN, " | |||
| lv_lgnum_initial | TYPE MLGN, " | |||
| lv_wmlgt | TYPE MLGT, " | |||
| lv_p_kz_no_warn | TYPE RMMG08_012-MSGTYP, " SPACE | |||
| lv_omlgn | TYPE MLGN, " | |||
| lv_omlgt | TYPE MLGT. " |
|   CALL FUNCTION 'LGNUM_INITIAL' "NOTRANSL: Wenn Lagernr ungefüllt ist, darf MLGN oder MLGT nicht verändert |
| EXPORTING | ||
| LGNUM | = lv_lgnum | |
| P_KZ_NO_WARN | = lv_p_kz_no_warn | |
| OMLGN | = lv_omlgn | |
| OMLGT | = lv_omlgt | |
| CHANGING | ||
| WMLGN | = lv_wmlgn | |
| WMLGT | = lv_wmlgt | |
| EXCEPTIONS | ||
| LGNUM_INITIAL = 1 | ||
| . " LGNUM_INITIAL | ||
ABAP code using 7.40 inline data declarations to call FM LGNUM_INITIAL
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 LGNUM FROM RMMG1 INTO @DATA(ld_lgnum). | ||||
| "SELECT single MSGTYP FROM RMMG08_012 INTO @DATA(ld_p_kz_no_warn). | ||||
| DATA(ld_p_kz_no_warn) | = ' '. | |||
Search for further information about these or an SAP related objects