SAP /CBAD/CONTRACT_WRITE_DOCUMENT Function Module for Write Change Documents
/CBAD/CONTRACT_WRITE_DOCUMENT is a standard /cbad/contract 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 Write 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 /cbad/contract write document FM, simply by entering the name /CBAD/CONTRACT_WRITE_DOCUMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: /CBAD/CONTRACT_MOD
Program Name: /CBAD/SAPLCONTRACT_MOD
Main Program: /CBAD/SAPLCONTRACT_MOD
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update: 1

Function /CBAD/CONTRACT_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 '/CBAD/CONTRACT_WRITE_DOCUMENT'"Write Change Documents.
EXPORTING
I_OBJECTID = "Object value
* I_UPD_ICDTXT_VERKBELEG = ' ' "Change type (U, I, E, D)
* I_UPD_CONTRACT_H = ' ' "Change type (U, I, E, D)
* I_UPD_CONTRACT_I = ' ' "changes detected or not on item
* I_UPD_CON_FUND_H = ' ' "Change type (U, I, E, D)
* I_UPD_CON_DBS = ' ' "Change type (U, I, E, D)
IS_CONTRACT_H_NEW = "Contract and Billing: additional header information
IS_CONTRACT_H_OLD = "Contract and Billing: additional header information
I_INDXKEY = "User-defined key in table INDX
* I_CREATE_HISTORY = 'X' "Create entry in table /CBAD/CON_HIST
I_MOD_ID = "Modification ID
I_TCODE = "Transaction in which a change was made
I_MOD_TYPE = "Modification Type
I_MOD_TEXT = "Modification Text
I_UTIME = "Time changed
I_UDATE = "Creation date of the change document
I_USERNAME = "User name of the person responsible in change document
* I_PLANNED_CHANGE_NUMBER = ' ' "Planned change number
* I_OBJECT_CHANGE_INDICATOR = 'U' "Application object change type (U, I, E, D)
* I_PLANNED_OR_REAL_CHANGES = ' ' "Application object change type (U, I, E, D)
* I_NO_CHANGE_POINTERS = ' ' "Application object change type (U, I, E, D)
TABLES
YT_CONTRACT_I = "Contract and Billing: additional item information
XT_CONTRACT_I = "Contract and Billing: additional item information
YT_CON_FUND_H = "Contract and Billing: Fund header information
XT_CON_FUND_H = "Contract and Billing: Fund header information
YT_CON_DBS = "Contract and Billing: DBS
XT_CON_DBS = "Contract and Billing: DBS
IMPORTING Parameters details for /CBAD/CONTRACT_WRITE_DOCUMENT
I_OBJECTID - Object value
Data type: CDHDR-OBJECTIDOptional: No
Call by Reference: No ( called with pass by value option)
I_UPD_ICDTXT_VERKBELEG - Change type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_UPD_CONTRACT_H - Change type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_UPD_CONTRACT_I - changes detected or not on item
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_UPD_CON_FUND_H - Change type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_UPD_CON_DBS - Change type (U, I, E, D)
Data type: CDPOS-CHNGINDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
IS_CONTRACT_H_NEW - Contract and Billing: additional header information
Data type: /CBAD/CONTRACT_HOptional: No
Call by Reference: No ( called with pass by value option)
IS_CONTRACT_H_OLD - Contract and Billing: additional header information
Data type: /CBAD/CONTRACT_HOptional: No
Call by Reference: No ( called with pass by value option)
I_INDXKEY - User-defined key in table INDX
Data type: CHAR32Optional: No
Call by Reference: No ( called with pass by value option)
I_CREATE_HISTORY - Create entry in table /CBAD/CON_HIST
Data type: BOOLEANDefault: 'X'
Optional: No
Call by Reference: No ( called with pass by value option)
I_MOD_ID - Modification ID
Data type: /CBAD/MOD_IDOptional: No
Call by Reference: No ( called with pass by value option)
I_TCODE - Transaction in which a change was made
Data type: CDHDR-TCODEOptional: No
Call by Reference: No ( called with pass by value option)
I_MOD_TYPE - Modification Type
Data type: /CBAD/MOD_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
I_MOD_TEXT - Modification Text
Data type: /CBAD/MOD_TEXTOptional: No
Call by Reference: No ( called with pass by value option)
I_UTIME - Time changed
Data type: CDHDR-UTIMEOptional: No
Call by Reference: No ( called with pass by value option)
I_UDATE - Creation date of the change document
Data type: CDHDR-UDATEOptional: No
Call by Reference: No ( called with pass by value option)
I_USERNAME - User name of the person responsible in change document
Data type: CDHDR-USERNAMEOptional: No
Call by Reference: No ( called with pass by value option)
I_PLANNED_CHANGE_NUMBER - Planned change number
Data type: CDHDR-PLANCHNGNRDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_OBJECT_CHANGE_INDICATOR - Application object change type (U, I, E, D)
Data type: CDHDR-CHANGE_INDDefault: 'U'
Optional: No
Call by Reference: No ( called with pass by value option)
I_PLANNED_OR_REAL_CHANGES - Application object change type (U, I, E, D)
Data type: CDHDR-CHANGE_INDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
I_NO_CHANGE_POINTERS - Application object change type (U, I, E, D)
Data type: CDHDR-CHANGE_INDDefault: SPACE
Optional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for /CBAD/CONTRACT_WRITE_DOCUMENT
YT_CONTRACT_I - Contract and Billing: additional item information
Data type: /CBAD/CONTRACT_I_UTOptional: No
Call by Reference: Yes
XT_CONTRACT_I - Contract and Billing: additional item information
Data type: /CBAD/CONTRACT_I_UTOptional: No
Call by Reference: Yes
YT_CON_FUND_H - Contract and Billing: Fund header information
Data type: /CBAD/CON_FUND_H_UTOptional: No
Call by Reference: Yes
XT_CON_FUND_H - Contract and Billing: Fund header information
Data type: /CBAD/CON_FUND_H_UTOptional: No
Call by Reference: Yes
YT_CON_DBS - Contract and Billing: DBS
Data type: /CBAD/CON_DBS_UTOptional: No
Call by Reference: Yes
XT_CON_DBS - Contract and Billing: DBS
Data type: /CBAD/CON_DBS_UTOptional: No
Call by Reference: Yes
Copy and paste ABAP code example for /CBAD/CONTRACT_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_i_objectid | TYPE CDHDR-OBJECTID, " | |||
| lt_yt_contract_i | TYPE STANDARD TABLE OF /CBAD/CONTRACT_I_UT, " | |||
| lv_i_upd_icdtxt_verkbeleg | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_i_upd_contract_h | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_i_upd_contract_i | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_i_upd_con_fund_h | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_i_upd_con_dbs | TYPE CDPOS-CHNGIND, " SPACE | |||
| lv_is_contract_h_new | TYPE /CBAD/CONTRACT_H, " | |||
| lv_is_contract_h_old | TYPE /CBAD/CONTRACT_H, " | |||
| lv_i_indxkey | TYPE CHAR32, " | |||
| lv_i_create_history | TYPE BOOLEAN, " 'X' | |||
| lv_i_mod_id | TYPE /CBAD/MOD_ID, " | |||
| lv_i_tcode | TYPE CDHDR-TCODE, " | |||
| lt_xt_contract_i | TYPE STANDARD TABLE OF /CBAD/CONTRACT_I_UT, " | |||
| lv_i_mod_type | TYPE /CBAD/MOD_TYPE, " | |||
| lv_i_mod_text | TYPE /CBAD/MOD_TEXT, " | |||
| lv_i_utime | TYPE CDHDR-UTIME, " | |||
| lt_yt_con_fund_h | TYPE STANDARD TABLE OF /CBAD/CON_FUND_H_UT, " | |||
| lv_i_udate | TYPE CDHDR-UDATE, " | |||
| lt_xt_con_fund_h | TYPE STANDARD TABLE OF /CBAD/CON_FUND_H_UT, " | |||
| lv_i_username | TYPE CDHDR-USERNAME, " | |||
| lt_yt_con_dbs | TYPE STANDARD TABLE OF /CBAD/CON_DBS_UT, " | |||
| lt_xt_con_dbs | TYPE STANDARD TABLE OF /CBAD/CON_DBS_UT, " | |||
| lv_i_planned_change_number | TYPE CDHDR-PLANCHNGNR, " SPACE | |||
| lv_i_object_change_indicator | TYPE CDHDR-CHANGE_IND, " 'U' | |||
| lv_i_planned_or_real_changes | TYPE CDHDR-CHANGE_IND, " SPACE | |||
| lv_i_no_change_pointers | TYPE CDHDR-CHANGE_IND. " SPACE |
|   CALL FUNCTION '/CBAD/CONTRACT_WRITE_DOCUMENT' "Write Change Documents |
| EXPORTING | ||
| I_OBJECTID | = lv_i_objectid | |
| I_UPD_ICDTXT_VERKBELEG | = lv_i_upd_icdtxt_verkbeleg | |
| I_UPD_CONTRACT_H | = lv_i_upd_contract_h | |
| I_UPD_CONTRACT_I | = lv_i_upd_contract_i | |
| I_UPD_CON_FUND_H | = lv_i_upd_con_fund_h | |
| I_UPD_CON_DBS | = lv_i_upd_con_dbs | |
| IS_CONTRACT_H_NEW | = lv_is_contract_h_new | |
| IS_CONTRACT_H_OLD | = lv_is_contract_h_old | |
| I_INDXKEY | = lv_i_indxkey | |
| I_CREATE_HISTORY | = lv_i_create_history | |
| I_MOD_ID | = lv_i_mod_id | |
| I_TCODE | = lv_i_tcode | |
| I_MOD_TYPE | = lv_i_mod_type | |
| I_MOD_TEXT | = lv_i_mod_text | |
| I_UTIME | = lv_i_utime | |
| I_UDATE | = lv_i_udate | |
| I_USERNAME | = lv_i_username | |
| I_PLANNED_CHANGE_NUMBER | = lv_i_planned_change_number | |
| I_OBJECT_CHANGE_INDICATOR | = lv_i_object_change_indicator | |
| I_PLANNED_OR_REAL_CHANGES | = lv_i_planned_or_real_changes | |
| I_NO_CHANGE_POINTERS | = lv_i_no_change_pointers | |
| TABLES | ||
| YT_CONTRACT_I | = lt_yt_contract_i | |
| XT_CONTRACT_I | = lt_xt_contract_i | |
| YT_CON_FUND_H | = lt_yt_con_fund_h | |
| XT_CON_FUND_H | = lt_xt_con_fund_h | |
| YT_CON_DBS | = lt_yt_con_dbs | |
| XT_CON_DBS | = lt_xt_con_dbs | |
| . " /CBAD/CONTRACT_WRITE_DOCUMENT | ||
ABAP code using 7.40 inline data declarations to call FM /CBAD/CONTRACT_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 OBJECTID FROM CDHDR INTO @DATA(ld_i_objectid). | ||||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_i_upd_icdtxt_verkbeleg). | ||||
| DATA(ld_i_upd_icdtxt_verkbeleg) | = ' '. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_i_upd_contract_h). | ||||
| DATA(ld_i_upd_contract_h) | = ' '. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_i_upd_contract_i). | ||||
| DATA(ld_i_upd_contract_i) | = ' '. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_i_upd_con_fund_h). | ||||
| DATA(ld_i_upd_con_fund_h) | = ' '. | |||
| "SELECT single CHNGIND FROM CDPOS INTO @DATA(ld_i_upd_con_dbs). | ||||
| DATA(ld_i_upd_con_dbs) | = ' '. | |||
| DATA(ld_i_create_history) | = 'X'. | |||
| "SELECT single TCODE FROM CDHDR INTO @DATA(ld_i_tcode). | ||||
| "SELECT single UTIME FROM CDHDR INTO @DATA(ld_i_utime). | ||||
| "SELECT single UDATE FROM CDHDR INTO @DATA(ld_i_udate). | ||||
| "SELECT single USERNAME FROM CDHDR INTO @DATA(ld_i_username). | ||||
| "SELECT single PLANCHNGNR FROM CDHDR INTO @DATA(ld_i_planned_change_number). | ||||
| DATA(ld_i_planned_change_number) | = ' '. | |||
| "SELECT single CHANGE_IND FROM CDHDR INTO @DATA(ld_i_object_change_indicator). | ||||
| DATA(ld_i_object_change_indicator) | = 'U'. | |||
| "SELECT single CHANGE_IND FROM CDHDR INTO @DATA(ld_i_planned_or_real_changes). | ||||
| DATA(ld_i_planned_or_real_changes) | = ' '. | |||
| "SELECT single CHANGE_IND FROM CDHDR INTO @DATA(ld_i_no_change_pointers). | ||||
| DATA(ld_i_no_change_pointers) | = ' '. | |||
Search for further information about these or an SAP related objects