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

Function MASTERWARRANTY_WRITE_DOCUMENT 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 'MASTERWARRANTY_WRITE_DOCUMENT'"Change Document.
EXPORTING
N_BGMK = "Master Warranty Header
UTIME = "ABAP System Field: Current Time of Application Server
OBJECTID = "Object value
O_BGMK = "Master Warranty Header
* PLANNED_CHANGE_NUMBER = ' ' "Planned change number
TCODE = "ABAP System Field: Current Transaction Code
UDATE = "ABAP System Field: Current Date of Application Server
* UPD_ICDTXT_WARRANTY = ' ' "Change Type (U, I, E, D)
* UPD_BGMK = ' ' "Change Type (U, I, E, D)
USERNAME = "ABAP System Field: Name of Current User
TABLES
ICDTXT_WARRANTY = "Change documents: Text changes
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_SAPLBG00_001 Customer Enhancement: Warranty Default Values
EXIT_SAPLBG00_002 Customer Enhancement Control for Warranty Check Popup
EXIT_SAPLBG00_003 Customer Enhancement Warranty Check Output Screen 3100/3200
IMPORTING Parameters details for MASTERWARRANTY_WRITE_DOCUMENT
N_BGMK - Master Warranty Header
Data type: BGMKOptional: No
Call by Reference: No ( called with pass by value option)
UTIME - ABAP System Field: Current Time of Application Server
Data type: SY-UZEITOptional: No
Call by Reference: No ( called with pass by value option)
OBJECTID - Object value
Data type: CDHDR-OBJECTIDOptional: No
Call by Reference: No ( called with pass by value option)
O_BGMK - Master Warranty Header
Data type: BGMKOptional: No
Call by Reference: No ( called with pass by value option)
PLANNED_CHANGE_NUMBER - Planned change number
Data type: CDHDR-PLANCHNGNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TCODE - ABAP System Field: Current Transaction Code
Data type: SY-TCODEOptional: No
Call by Reference: No ( called with pass by value option)
UDATE - ABAP System Field: Current Date of Application Server
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
UPD_ICDTXT_WARRANTY - Change Type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
UPD_BGMK - Change Type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USERNAME - ABAP System Field: Name of Current User
Data type: SY-UNAMEOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MASTERWARRANTY_WRITE_DOCUMENT
ICDTXT_WARRANTY - Change documents: Text changes
Data type: CDTXTOptional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MASTERWARRANTY_WRITE_DOCUMENT 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_n_bgmk | TYPE BGMK, " | |||
| lt_icdtxt_warranty | TYPE STANDARD TABLE OF CDTXT, " | |||
| lv_utime | TYPE SY-UZEIT, " | |||
| lv_objectid | TYPE CDHDR-OBJECTID, " | |||
| lv_o_bgmk | TYPE BGMK, " | |||
| lv_planned_change_number | TYPE CDHDR-PLANCHNGNR, " SPACE | |||
| lv_tcode | TYPE SY-TCODE, " | |||
| lv_udate | TYPE SY-DATUM, " | |||
| lv_upd_icdtxt_warranty | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_upd_bgmk | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_username | TYPE SY-UNAME. " |
|   CALL FUNCTION 'MASTERWARRANTY_WRITE_DOCUMENT' "Change Document |
| EXPORTING | ||
| N_BGMK | = lv_n_bgmk | |
| UTIME | = lv_utime | |
| OBJECTID | = lv_objectid | |
| O_BGMK | = lv_o_bgmk | |
| PLANNED_CHANGE_NUMBER | = lv_planned_change_number | |
| TCODE | = lv_tcode | |
| UDATE | = lv_udate | |
| UPD_ICDTXT_WARRANTY | = lv_upd_icdtxt_warranty | |
| UPD_BGMK | = lv_upd_bgmk | |
| USERNAME | = lv_username | |
| TABLES | ||
| ICDTXT_WARRANTY | = lt_icdtxt_warranty | |
| . " MASTERWARRANTY_WRITE_DOCUMENT | ||
ABAP code using 7.40 inline data declarations to call FM MASTERWARRANTY_WRITE_DOCUMENT
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 UZEIT FROM SY INTO @DATA(ld_utime). | ||||
| "SELECT single OBJECTID FROM CDHDR INTO @DATA(ld_objectid). | ||||
| "SELECT single PLANCHNGNR FROM CDHDR INTO @DATA(ld_planned_change_number). | ||||
| DATA(ld_planned_change_number) | = ' '. | |||
| "SELECT single TCODE FROM SY INTO @DATA(ld_tcode). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_udate). | ||||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_upd_icdtxt_warranty). | ||||
| DATA(ld_upd_icdtxt_warranty) | = ' '. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_upd_bgmk). | ||||
| DATA(ld_upd_bgmk) | = ' '. | |||
| "SELECT single UNAME FROM SY INTO @DATA(ld_username). | ||||
Search for further information about these or an SAP related objects