SAP CHANGEDOCUMENT_READ Function Module for Change document: Read and edit change documents
CHANGEDOCUMENT_READ is a standard changedocument read 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: Read and edit 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 changedocument read FM, simply by entering the name CHANGEDOCUMENT_READ into the relevant SAP transaction such as SE37 or SE38.
Function Group: SCD2
Program Name: SAPLSCD2
Main Program: SAPLSCD2
Appliation area: *
Release date: 22-Dec-1994
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CHANGEDOCUMENT_READ 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_READ'"Change document: Read and edit change documents.
EXPORTING
* ARCHIVE_HANDLE = 0 "Handle on Open Archive Files
* LOCAL_TIME = ' ' "local or system time (re: time zone)
* TIME_ZONE = 'UTC' "If LOCAL_TIME = X: Time zone in which change documents were created
* TABLEKEY254 = ' ' "Table Key for CDPOS in Character 254
* KEYGUID = ' ' "UUID in character form
* DATE_UNTIL = '99991231' "Change date up to which you want to search
* TIME_UNTIL = '235959' "Change time up to which you want to search
* KEYGUID_STR = ' ' "UUID in Character Format
* READ_CHANGEDOCU = ' ' "Flag, if != ' ', read from archive for CHANGEDOCU
* CHANGENUMBER = ' ' "Change document number
* DATE_OF_CHANGE = '00000000' "From-change date for search
OBJECTCLASS = "Object class
* OBJECTID = ' ' "Object ID
* TABLEKEY = ' ' "Object class table key
* TABLENAME = ' ' "Object class table name
* TIME_OF_CHANGE = '000000' "From-change time for search
* USERNAME = ' ' "Changed By
IMPORTING
ET_CDRED_STR = "Table Type for Structure CDRED_STR
TABLES
EDITPOS = "Table with edited change document items
EXCEPTIONS
NO_POSITION_FOUND = 1 WRONG_ACCESS_TO_ARCHIVE = 2 TIME_ZONE_CONVERSION_ERROR = 3
IMPORTING Parameters details for CHANGEDOCUMENT_READ
ARCHIVE_HANDLE - Handle on Open Archive Files
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
LOCAL_TIME - local or system time (re: time zone)
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TIME_ZONE - If LOCAL_TIME = X: Time zone in which change documents were created
Data type: TTZZ-TZONEDefault: 'UTC'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLEKEY254 - Table Key for CDPOS in Character 254
Data type: CDPOS_UID-TABKEYDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KEYGUID - UUID in character form
Data type: CDPOS_UID-KEYGUIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATE_UNTIL - Change date up to which you want to search
Data type: CDHDR-UDATEDefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TIME_UNTIL - Change time up to which you want to search
Data type: CDHDR-UTIMEDefault: '235959'
Optional: Yes
Call by Reference: No ( called with pass by value option)
KEYGUID_STR - UUID in Character Format
Data type: CDPOS_STR-KEYGUIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
READ_CHANGEDOCU - Flag, if != SPACE, read from archive for CHANGEDOCU
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
CHANGENUMBER - Change document number
Data type: CDPOS-CHANGENRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATE_OF_CHANGE - From-change date for search
Data type: CDHDR-UDATEDefault: '00000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
OBJECTCLASS - Object class
Data type: CDHDR-OBJECTCLASOptional: No
Call by Reference: No ( called with pass by value option)
OBJECTID - Object ID
Data type: CDHDR-OBJECTIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLEKEY - Object class table key
Data type: CDPOS-TABKEYDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLENAME - Object class table name
Data type: CDPOS-TABNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TIME_OF_CHANGE - From-change time for search
Data type: CDHDR-UTIMEDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
USERNAME - Changed By
Data type: CDHDR-USERNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CHANGEDOCUMENT_READ
ET_CDRED_STR - Table Type for Structure CDRED_STR
Data type: CDRED_STR_TABOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for CHANGEDOCUMENT_READ
EDITPOS - Table with edited change document items
Data type: CDREDOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_POSITION_FOUND - No item found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_ACCESS_TO_ARCHIVE - incorrect access to archive
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TIME_ZONE_CONVERSION_ERROR - Error converting local to system time
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for CHANGEDOCUMENT_READ 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: | ||||
| lt_editpos | TYPE STANDARD TABLE OF CDRED, " | |||
| lv_et_cdred_str | TYPE CDRED_STR_TAB, " | |||
| lv_archive_handle | TYPE SY-TABIX, " 0 | |||
| lv_no_position_found | TYPE SY, " | |||
| lv_local_time | TYPE SY, " SPACE | |||
| lv_time_zone | TYPE TTZZ-TZONE, " 'UTC' | |||
| lv_tablekey254 | TYPE CDPOS_UID-TABKEY, " SPACE | |||
| lv_keyguid | TYPE CDPOS_UID-KEYGUID, " SPACE | |||
| lv_date_until | TYPE CDHDR-UDATE, " '99991231' | |||
| lv_time_until | TYPE CDHDR-UTIME, " '235959' | |||
| lv_keyguid_str | TYPE CDPOS_STR-KEYGUID, " SPACE | |||
| lv_read_changedocu | TYPE C, " SPACE | |||
| lv_changenumber | TYPE CDPOS-CHANGENR, " SPACE | |||
| lv_wrong_access_to_archive | TYPE CDPOS, " | |||
| lv_date_of_change | TYPE CDHDR-UDATE, " '00000000' | |||
| lv_time_zone_conversion_error | TYPE CDHDR, " | |||
| lv_objectclass | TYPE CDHDR-OBJECTCLAS, " | |||
| lv_objectid | TYPE CDHDR-OBJECTID, " SPACE | |||
| lv_tablekey | TYPE CDPOS-TABKEY, " SPACE | |||
| lv_tablename | TYPE CDPOS-TABNAME, " SPACE | |||
| lv_time_of_change | TYPE CDHDR-UTIME, " '000000' | |||
| lv_username | TYPE CDHDR-USERNAME. " SPACE |
|   CALL FUNCTION 'CHANGEDOCUMENT_READ' "Change document: Read and edit change documents |
| EXPORTING | ||
| ARCHIVE_HANDLE | = lv_archive_handle | |
| LOCAL_TIME | = lv_local_time | |
| TIME_ZONE | = lv_time_zone | |
| TABLEKEY254 | = lv_tablekey254 | |
| KEYGUID | = lv_keyguid | |
| DATE_UNTIL | = lv_date_until | |
| TIME_UNTIL | = lv_time_until | |
| KEYGUID_STR | = lv_keyguid_str | |
| READ_CHANGEDOCU | = lv_read_changedocu | |
| CHANGENUMBER | = lv_changenumber | |
| DATE_OF_CHANGE | = lv_date_of_change | |
| OBJECTCLASS | = lv_objectclass | |
| OBJECTID | = lv_objectid | |
| TABLEKEY | = lv_tablekey | |
| TABLENAME | = lv_tablename | |
| TIME_OF_CHANGE | = lv_time_of_change | |
| USERNAME | = lv_username | |
| IMPORTING | ||
| ET_CDRED_STR | = lv_et_cdred_str | |
| TABLES | ||
| EDITPOS | = lt_editpos | |
| EXCEPTIONS | ||
| NO_POSITION_FOUND = 1 | ||
| WRONG_ACCESS_TO_ARCHIVE = 2 | ||
| TIME_ZONE_CONVERSION_ERROR = 3 | ||
| . " CHANGEDOCUMENT_READ | ||
ABAP code using 7.40 inline data declarations to call FM CHANGEDOCUMENT_READ
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 TABIX FROM SY INTO @DATA(ld_archive_handle). | ||||
| DATA(ld_local_time) | = ' '. | |||
| "SELECT single TZONE FROM TTZZ INTO @DATA(ld_time_zone). | ||||
| DATA(ld_time_zone) | = 'UTC'. | |||
| "SELECT single TABKEY FROM CDPOS_UID INTO @DATA(ld_tablekey254). | ||||
| DATA(ld_tablekey254) | = ' '. | |||
| "SELECT single KEYGUID FROM CDPOS_UID INTO @DATA(ld_keyguid). | ||||
| DATA(ld_keyguid) | = ' '. | |||
| "SELECT single UDATE FROM CDHDR INTO @DATA(ld_date_until). | ||||
| DATA(ld_date_until) | = '99991231'. | |||
| "SELECT single UTIME FROM CDHDR INTO @DATA(ld_time_until). | ||||
| DATA(ld_time_until) | = '235959'. | |||
| "SELECT single KEYGUID FROM CDPOS_STR INTO @DATA(ld_keyguid_str). | ||||
| DATA(ld_keyguid_str) | = ' '. | |||
| DATA(ld_read_changedocu) | = ' '. | |||
| "SELECT single CHANGENR FROM CDPOS INTO @DATA(ld_changenumber). | ||||
| DATA(ld_changenumber) | = ' '. | |||
| "SELECT single UDATE FROM CDHDR INTO @DATA(ld_date_of_change). | ||||
| DATA(ld_date_of_change) | = '00000000'. | |||
| "SELECT single OBJECTCLAS FROM CDHDR INTO @DATA(ld_objectclass). | ||||
| "SELECT single OBJECTID FROM CDHDR INTO @DATA(ld_objectid). | ||||
| DATA(ld_objectid) | = ' '. | |||
| "SELECT single TABKEY FROM CDPOS INTO @DATA(ld_tablekey). | ||||
| DATA(ld_tablekey) | = ' '. | |||
| "SELECT single TABNAME FROM CDPOS INTO @DATA(ld_tablename). | ||||
| DATA(ld_tablename) | = ' '. | |||
| "SELECT single UTIME FROM CDHDR INTO @DATA(ld_time_of_change). | ||||
| DATA(ld_time_of_change) | = '000000'. | |||
| "SELECT single USERNAME FROM CDHDR INTO @DATA(ld_username). | ||||
| DATA(ld_username) | = ' '. | |||
Search for further information about these or an SAP related objects