SAP MODULE_CREATE Function Module for Automatic Creation of Module Header (internal)









MODULE_CREATE is a standard module create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Automatic Creation of Module Header (internal) 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 module create FM, simply by entering the name MODULE_CREATE into the relevant SAP transaction such as SE37 or SE38.

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



Function MODULE_CREATE 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 'MODULE_CREATE'"Automatic Creation of Module Header (internal)
EXPORTING
FUNCTION = "1-Create LP/CPr module, 2-internal stock transport order
* LOCATION = ' ' "Plant number
* MERCHANDISE_GROUP = ' ' "Material group
* DATE_BEGIN = ' ' "Valid from (optional, if blank: SY-DATUM)
* DATE_END = ' ' "Valid to (optional, if blank: 99991231)
* SAVE_DIRECTLY = ' ' "Save without update function

IMPORTING
MODULE = "Module header data (generated)
MODULE_TEXT = "Module text (generated)
WSCOR = "Error information, Ranges IS-R

EXCEPTIONS
MODULE_ALREADY_EXISTS = 1 WRONG_FUNCTION = 2 ARTICLE_NOT_WELL_MAINTAINED = 3
.



IMPORTING Parameters details for MODULE_CREATE

FUNCTION - 1-Create LP/CPr module, 2-internal stock transport order

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

LOCATION - Plant number

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

MERCHANDISE_GROUP - Material group

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

DATE_BEGIN - Valid from (optional, if blank: SY-DATUM)

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

DATE_END - Valid to (optional, if blank: 99991231)

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

SAVE_DIRECTLY - Save without update function

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

EXPORTING Parameters details for MODULE_CREATE

MODULE - Module header data (generated)

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

MODULE_TEXT - Module text (generated)

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

WSCOR - Error information, Ranges IS-R

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

EXCEPTIONS details

MODULE_ALREADY_EXISTS - Module already exists

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

WRONG_FUNCTION - Function not allowed

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

ARTICLE_NOT_WELL_MAINTAINED -

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

Copy and paste ABAP code example for MODULE_CREATE 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_module  TYPE WSOH, "   
lv_function  TYPE WTDY-TYP01, "   
lv_module_already_exists  TYPE WTDY, "   
lv_location  TYPE WRS6-ASORT, "   SPACE
lv_module_text  TYPE WSOT, "   
lv_wrong_function  TYPE WSOT, "   
lv_wscor  TYPE WSCOR, "   
lv_merchandise_group  TYPE MARA-MATKL, "   SPACE
lv_article_not_well_maintained  TYPE MARA, "   
lv_date_begin  TYPE WTDY-DATAB, "   SPACE
lv_date_end  TYPE WTDY-DATBI, "   SPACE
lv_save_directly  TYPE WTDY-TYP01. "   SPACE

  CALL FUNCTION 'MODULE_CREATE'  "Automatic Creation of Module Header (internal)
    EXPORTING
         FUNCTION = lv_function
         LOCATION = lv_location
         MERCHANDISE_GROUP = lv_merchandise_group
         DATE_BEGIN = lv_date_begin
         DATE_END = lv_date_end
         SAVE_DIRECTLY = lv_save_directly
    IMPORTING
         MODULE = lv_module
         MODULE_TEXT = lv_module_text
         WSCOR = lv_wscor
    EXCEPTIONS
        MODULE_ALREADY_EXISTS = 1
        WRONG_FUNCTION = 2
        ARTICLE_NOT_WELL_MAINTAINED = 3
. " MODULE_CREATE




ABAP code using 7.40 inline data declarations to call FM MODULE_CREATE

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 TYP01 FROM WTDY INTO @DATA(ld_function).
 
 
"SELECT single ASORT FROM WRS6 INTO @DATA(ld_location).
DATA(ld_location) = ' '.
 
 
 
 
"SELECT single MATKL FROM MARA INTO @DATA(ld_merchandise_group).
DATA(ld_merchandise_group) = ' '.
 
 
"SELECT single DATAB FROM WTDY INTO @DATA(ld_date_begin).
DATA(ld_date_begin) = ' '.
 
"SELECT single DATBI FROM WTDY INTO @DATA(ld_date_end).
DATA(ld_date_end) = ' '.
 
"SELECT single TYP01 FROM WTDY INTO @DATA(ld_save_directly).
DATA(ld_save_directly) = ' '.
 


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!