SAP MATERIAL_UPDATE_CD Function Module for Create Change Documents
MATERIAL_UPDATE_CD is a standard material update cd SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create Change Documents 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 material update cd FM, simply by entering the name MATERIAL_UPDATE_CD into the relevant SAP transaction such as SE37 or SE38.
Function Group: MGMU
Program Name: SAPLMGMU
Main Program: SAPLMGMU
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update: 1

Function MATERIAL_UPDATE_CD 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 'MATERIAL_UPDATE_CD'"Create Change Documents.
EXPORTING
* USER = SY-UNAME "User
* OLD_MARA = "
* NEW_MARC = "
* OLD_MARC = "
* NEW_MBEW = "
* OLD_MBEW = "
* UPDATE_MKAL = ' ' "
* DATE = SY-DATUM "Date
* TIME = SY-UZEIT "Time
* TRANSACTION = SY-TCODE "Transaction
MATERIAL = "
* CHANGE_NUMBER = ' ' "Change Number
* BASE_UOM = ' ' "Base Unit of Measure
* CURRENCY = ' ' "Company Code Currency
* NEW_MARA = "
TABLES
* NEW_MKAL = "
* OLD_MKAL = "
EXCEPTIONS
WRONG_CALL = 1
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLMGMU_001 Enhancements for Material Master Tables
IMPORTING Parameters details for MATERIAL_UPDATE_CD
USER - User
Data type: SY-UNAMEDefault: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)
OLD_MARA -
Data type: MARAOptional: Yes
Call by Reference: No ( called with pass by value option)
NEW_MARC -
Data type: MARCOptional: Yes
Call by Reference: No ( called with pass by value option)
OLD_MARC -
Data type: MARCOptional: Yes
Call by Reference: No ( called with pass by value option)
NEW_MBEW -
Data type: MBEWOptional: Yes
Call by Reference: No ( called with pass by value option)
OLD_MBEW -
Data type: MBEWOptional: Yes
Call by Reference: No ( called with pass by value option)
UPDATE_MKAL -
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATE - Date
Data type: SY-DATUMDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
TIME - Time
Data type: SY-UZEITDefault: SY-UZEIT
Optional: Yes
Call by Reference: No ( called with pass by value option)
TRANSACTION - Transaction
Data type: SY-TCODEDefault: SY-TCODE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MATERIAL -
Data type: MARA-MATNROptional: No
Call by Reference: No ( called with pass by value option)
CHANGE_NUMBER - Change Number
Data type: CDHDR-PLANCHNGNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
BASE_UOM - Base Unit of Measure
Data type: MARA-MEINSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
CURRENCY - Company Code Currency
Data type: T001-WAERSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NEW_MARA -
Data type: MARAOptional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MATERIAL_UPDATE_CD
NEW_MKAL -
Data type: SXDMKALOptional: Yes
Call by Reference: No ( called with pass by value option)
OLD_MKAL -
Data type: SXDMKALOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
WRONG_CALL - Incorrect Call
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MATERIAL_UPDATE_CD 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_user | TYPE SY-UNAME, " SY-UNAME | |||
| lt_new_mkal | TYPE STANDARD TABLE OF SXDMKAL, " | |||
| lv_wrong_call | TYPE SXDMKAL, " | |||
| lv_old_mara | TYPE MARA, " | |||
| lv_new_marc | TYPE MARC, " | |||
| lv_old_marc | TYPE MARC, " | |||
| lv_new_mbew | TYPE MBEW, " | |||
| lv_old_mbew | TYPE MBEW, " | |||
| lv_update_mkal | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_date | TYPE SY-DATUM, " SY-DATUM | |||
| lt_old_mkal | TYPE STANDARD TABLE OF SXDMKAL, " | |||
| lv_time | TYPE SY-UZEIT, " SY-UZEIT | |||
| lv_transaction | TYPE SY-TCODE, " SY-TCODE | |||
| lv_material | TYPE MARA-MATNR, " | |||
| lv_change_number | TYPE CDHDR-PLANCHNGNR, " SPACE | |||
| lv_base_uom | TYPE MARA-MEINS, " SPACE | |||
| lv_currency | TYPE T001-WAERS, " SPACE | |||
| lv_new_mara | TYPE MARA. " |
|   CALL FUNCTION 'MATERIAL_UPDATE_CD' "Create Change Documents |
| EXPORTING | ||
| USER | = lv_user | |
| OLD_MARA | = lv_old_mara | |
| NEW_MARC | = lv_new_marc | |
| OLD_MARC | = lv_old_marc | |
| NEW_MBEW | = lv_new_mbew | |
| OLD_MBEW | = lv_old_mbew | |
| UPDATE_MKAL | = lv_update_mkal | |
| DATE | = lv_date | |
| TIME | = lv_time | |
| TRANSACTION | = lv_transaction | |
| MATERIAL | = lv_material | |
| CHANGE_NUMBER | = lv_change_number | |
| BASE_UOM | = lv_base_uom | |
| CURRENCY | = lv_currency | |
| NEW_MARA | = lv_new_mara | |
| TABLES | ||
| NEW_MKAL | = lt_new_mkal | |
| OLD_MKAL | = lt_old_mkal | |
| EXCEPTIONS | ||
| WRONG_CALL = 1 | ||
| . " MATERIAL_UPDATE_CD | ||
ABAP code using 7.40 inline data declarations to call FM MATERIAL_UPDATE_CD
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 UNAME FROM SY INTO @DATA(ld_user). | ||||
| DATA(ld_user) | = SY-UNAME. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_update_mkal). | ||||
| DATA(ld_update_mkal) | = ' '. | |||
| "SELECT single DATUM FROM SY INTO @DATA(ld_date). | ||||
| DATA(ld_date) | = SY-DATUM. | |||
| "SELECT single UZEIT FROM SY INTO @DATA(ld_time). | ||||
| DATA(ld_time) | = SY-UZEIT. | |||
| "SELECT single TCODE FROM SY INTO @DATA(ld_transaction). | ||||
| DATA(ld_transaction) | = SY-TCODE. | |||
| "SELECT single MATNR FROM MARA INTO @DATA(ld_material). | ||||
| "SELECT single PLANCHNGNR FROM CDHDR INTO @DATA(ld_change_number). | ||||
| DATA(ld_change_number) | = ' '. | |||
| "SELECT single MEINS FROM MARA INTO @DATA(ld_base_uom). | ||||
| DATA(ld_base_uom) | = ' '. | |||
| "SELECT single WAERS FROM T001 INTO @DATA(ld_currency). | ||||
| DATA(ld_currency) | = ' '. | |||
Search for further information about these or an SAP related objects