SAP CHANGEDOCUMENT_DELETE Function Module for Delete change documents (client-independent, generic)









CHANGEDOCUMENT_DELETE is a standard changedocument delete SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Delete change documents (client-independent, generic) 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 changedocument delete FM, simply by entering the name CHANGEDOCUMENT_DELETE into the relevant SAP transaction such as SE37 or SE38.

Function Group: SCD4
Program Name: SAPLSCD4
Main Program: SAPLSCD4
Appliation area: *
Release date: 19-Dec-1994
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CHANGEDOCUMENT_DELETE 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 'CHANGEDOCUMENT_DELETE'"Delete change documents (client-independent, generic)
EXPORTING
* CLIENT = SY-MANDT "Client in which deletion is to take place
* COMMIT_COUNTER = '20' "COMMIT event counter
OBJECTCLASS = "Object class
* OBJECTID = ' ' "Object ID
* UP_TO_DATE = SY-DATUM "Date by which the change documents are to be deleted
* WITH_COMMIT = ' ' "Flag whether there should be a COMMIT WORK in the FM
* DISABLE_AUTHORITY_CHECK = ' ' "Obsolete: Authorization check can be deactivated
* CHANGENR = ' ' "Change Number of Document

IMPORTING
NUMBER_OF_DELETED_HEADERS = "Number of deleted change document headers
NUMBER_OF_DELETED_POSITIONS = "Number of deleted change document items
NUMBER_OF_DELETED_UIDS = "Number of deleted change document item_GUIDs
NUMBER_OF_DELETED_STRINGS = "Number of Deleted Change Document Item STRINGs

EXCEPTIONS
NO_AUTHORITY = 1 NO_CHANGES_FOUND = 2
.



IMPORTING Parameters details for CHANGEDOCUMENT_DELETE

CLIENT - Client in which deletion is to take place

Data type: CDHDR-MANDANT
Default: SY-MANDT
Optional: Yes
Call by Reference: No ( called with pass by value option)

COMMIT_COUNTER - COMMIT event counter

Data type:
Default: '20'
Optional: Yes
Call by Reference: No ( called with pass by value option)

OBJECTCLASS - Object class

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

OBJECTID - Object ID

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

UP_TO_DATE - Date by which the change documents are to be deleted

Data type: CDHDR-UDATE
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

WITH_COMMIT - Flag whether there should be a COMMIT WORK in the FM

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

DISABLE_AUTHORITY_CHECK - Obsolete: Authorization check can be deactivated

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

CHANGENR - Change Number of Document

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

EXPORTING Parameters details for CHANGEDOCUMENT_DELETE

NUMBER_OF_DELETED_HEADERS - Number of deleted change document headers

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

NUMBER_OF_DELETED_POSITIONS - Number of deleted change document items

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

NUMBER_OF_DELETED_UIDS - Number of deleted change document item_GUIDs

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

NUMBER_OF_DELETED_STRINGS - Number of Deleted Change Document Item STRINGs

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

EXCEPTIONS details

NO_AUTHORITY - No authorization to delete change documents

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

NO_CHANGES_FOUND - No change documents found

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

Copy and paste ABAP code example for CHANGEDOCUMENT_DELETE 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_client  TYPE CDHDR-MANDANT, "   SY-MANDT
lv_no_authority  TYPE CDHDR, "   
lv_number_of_deleted_headers  TYPE SY-DBCNT, "   
lv_commit_counter  TYPE SY, "   '20'
lv_no_changes_found  TYPE SY, "   
lv_number_of_deleted_positions  TYPE SY-DBCNT, "   
lv_objectclass  TYPE CDHDR-OBJECTCLAS, "   
lv_number_of_deleted_uids  TYPE SY-DBCNT, "   
lv_objectid  TYPE CDHDR-OBJECTID, "   SPACE
lv_number_of_deleted_strings  TYPE SY-DBCNT, "   
lv_up_to_date  TYPE CDHDR-UDATE, "   SY-DATUM
lv_with_commit  TYPE CDHDR, "   SPACE
lv_disable_authority_check  TYPE CDHDR, "   SPACE
lv_changenr  TYPE CDHDR-CHANGENR. "   SPACE

  CALL FUNCTION 'CHANGEDOCUMENT_DELETE'  "Delete change documents (client-independent, generic)
    EXPORTING
         CLIENT = lv_client
         COMMIT_COUNTER = lv_commit_counter
         OBJECTCLASS = lv_objectclass
         OBJECTID = lv_objectid
         UP_TO_DATE = lv_up_to_date
         WITH_COMMIT = lv_with_commit
         DISABLE_AUTHORITY_CHECK = lv_disable_authority_check
         CHANGENR = lv_changenr
    IMPORTING
         NUMBER_OF_DELETED_HEADERS = lv_number_of_deleted_headers
         NUMBER_OF_DELETED_POSITIONS = lv_number_of_deleted_positions
         NUMBER_OF_DELETED_UIDS = lv_number_of_deleted_uids
         NUMBER_OF_DELETED_STRINGS = lv_number_of_deleted_strings
    EXCEPTIONS
        NO_AUTHORITY = 1
        NO_CHANGES_FOUND = 2
. " CHANGEDOCUMENT_DELETE




ABAP code using 7.40 inline data declarations to call FM CHANGEDOCUMENT_DELETE

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 MANDANT FROM CDHDR INTO @DATA(ld_client).
DATA(ld_client) = SY-MANDT.
 
 
"SELECT single DBCNT FROM SY INTO @DATA(ld_number_of_deleted_headers).
 
DATA(ld_commit_counter) = '20'.
 
 
"SELECT single DBCNT FROM SY INTO @DATA(ld_number_of_deleted_positions).
 
"SELECT single OBJECTCLAS FROM CDHDR INTO @DATA(ld_objectclass).
 
"SELECT single DBCNT FROM SY INTO @DATA(ld_number_of_deleted_uids).
 
"SELECT single OBJECTID FROM CDHDR INTO @DATA(ld_objectid).
DATA(ld_objectid) = ' '.
 
"SELECT single DBCNT FROM SY INTO @DATA(ld_number_of_deleted_strings).
 
"SELECT single UDATE FROM CDHDR INTO @DATA(ld_up_to_date).
DATA(ld_up_to_date) = SY-DATUM.
 
DATA(ld_with_commit) = ' '.
 
DATA(ld_disable_authority_check) = ' '.
 
"SELECT single CHANGENR FROM CDHDR INTO @DATA(ld_changenr).
DATA(ld_changenr) = ' '.
 


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!