SAP Function Modules

CHANGEDOCUMENT_READ_RANGES SAP Function module







CHANGEDOCUMENT_READ_RANGES is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CHANGEDOCUMENT_READ_RANGES into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SCD2
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM CHANGEDOCUMENT_READ_RANGES - CHANGEDOCUMENT READ RANGES





CALL FUNCTION 'CHANGEDOCUMENT_READ_RANGES' "
  EXPORTING
*   archive_handle = 0          " sy-tabix      Handle on Open Archive Files
*   changenumber_tab =          " cdchangenr_range_tab  Change document number
*   date_of_change = '00000000'  " cdhdr-udate  From-change date for search
    objectclass_tab =           " cdobjectcl_range_tab  Object Class
*   objectid_tab =              " cdobjectv_range_tab  Object ID
*   tablekey_tab =              " cdtabkey_range_tab  Object class table key
*   tablename_tab =             " cdtabname_range_tab  Object class table name
*   time_of_change = '000000'   " cdhdr-utime   From-change time for search
*   username_tab =              " cdusername_range_tab  Changed By
*   local_time = SPACE          "               local or system time (re: time zone)
*   time_zone = 'UTC'           " ttzz-tzone
*   tablekey254_tab =           " cdtabkeylo_range_tab  Table Key for CDPOS in Character 254
*   keyguid_tab =               " cdsysuuid_range_tab  UUID in Character Format
*   date_until = '99991231'     " cdhdr-udate   Change date up to which you want to search
*   time_until = '235959'       " cdhdr-utime   Change time up to which you want to search
*   keyguid_str_tab =           " cdsysuuid_range_tab
  IMPORTING
    et_cdred_str =              " cdred_str_tab
  TABLES
    editpos =                   " cdred         Table with edited change document items
  EXCEPTIONS
    NO_POSITION_FOUND = 1       "               No item found
    WRONG_ACCESS_TO_ARCHIVE = 2  "              incorrect access to archive
    TIME_ZONE_CONVERSION_ERROR = 3  "           Error converting local to system time
    .  "  CHANGEDOCUMENT_READ_RANGES

ABAP code example for Function Module CHANGEDOCUMENT_READ_RANGES





The ABAP code below is a full code listing to execute function module CHANGEDOCUMENT_READ_RANGES including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_et_cdred_str  TYPE CDRED_STR_TAB ,
it_editpos  TYPE STANDARD TABLE OF CDRED,"TABLES PARAM
wa_editpos  LIKE LINE OF it_editpos .

DATA(ld_archive_handle) = '123 '.
DATA(ld_changenumber_tab) = '123 '.

SELECT single UDATE
FROM CDHDR
INTO @DATA(ld_date_of_change).

DATA(ld_objectclass_tab) = '123 '.
DATA(ld_objectid_tab) = '123 '.
DATA(ld_tablekey_tab) = '123 '.
DATA(ld_tablename_tab) = '123 '.

SELECT single UTIME
FROM CDHDR
INTO @DATA(ld_time_of_change).

DATA(ld_username_tab) = '123 '.
DATA(ld_local_time) = 'some text here'.

SELECT single TZONE
FROM TTZZ
INTO @DATA(ld_time_zone).

DATA(ld_tablekey254_tab) = '123 '.
DATA(ld_keyguid_tab) = '123 '.

SELECT single UDATE
FROM CDHDR
INTO @DATA(ld_date_until).


SELECT single UTIME
FROM CDHDR
INTO @DATA(ld_time_until).

DATA(ld_keyguid_str_tab) = '123 '.

"populate fields of struture and append to itab
append wa_editpos to it_editpos. . CALL FUNCTION 'CHANGEDOCUMENT_READ_RANGES' EXPORTING * archive_handle = ld_archive_handle * changenumber_tab = ld_changenumber_tab * date_of_change = ld_date_of_change objectclass_tab = ld_objectclass_tab * objectid_tab = ld_objectid_tab * tablekey_tab = ld_tablekey_tab * tablename_tab = ld_tablename_tab * time_of_change = ld_time_of_change * username_tab = ld_username_tab * local_time = ld_local_time * time_zone = ld_time_zone * tablekey254_tab = ld_tablekey254_tab * keyguid_tab = ld_keyguid_tab * date_until = ld_date_until * time_until = ld_time_until * keyguid_str_tab = ld_keyguid_str_tab IMPORTING et_cdred_str = ld_et_cdred_str TABLES editpos = it_editpos EXCEPTIONS NO_POSITION_FOUND = 1 WRONG_ACCESS_TO_ARCHIVE = 2 TIME_ZONE_CONVERSION_ERROR = 3 . " CHANGEDOCUMENT_READ_RANGES
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_et_cdred_str  TYPE CDRED_STR_TAB ,
ld_archive_handle  TYPE SY-TABIX ,
it_editpos  TYPE STANDARD TABLE OF CDRED ,
wa_editpos  LIKE LINE OF it_editpos,
ld_changenumber_tab  TYPE CDCHANGENR_RANGE_TAB ,
ld_date_of_change  TYPE CDHDR-UDATE ,
ld_objectclass_tab  TYPE CDOBJECTCL_RANGE_TAB ,
ld_objectid_tab  TYPE CDOBJECTV_RANGE_TAB ,
ld_tablekey_tab  TYPE CDTABKEY_RANGE_TAB ,
ld_tablename_tab  TYPE CDTABNAME_RANGE_TAB ,
ld_time_of_change  TYPE CDHDR-UTIME ,
ld_username_tab  TYPE CDUSERNAME_RANGE_TAB ,
ld_local_time  TYPE STRING ,
ld_time_zone  TYPE TTZZ-TZONE ,
ld_tablekey254_tab  TYPE CDTABKEYLO_RANGE_TAB ,
ld_keyguid_tab  TYPE CDSYSUUID_RANGE_TAB ,
ld_date_until  TYPE CDHDR-UDATE ,
ld_time_until  TYPE CDHDR-UTIME ,
ld_keyguid_str_tab  TYPE CDSYSUUID_RANGE_TAB .

ld_archive_handle = '123 '.

"populate fields of struture and append to itab
append wa_editpos to it_editpos.
ld_changenumber_tab = '123 '.

SELECT single UDATE
FROM CDHDR
INTO ld_date_of_change.

ld_objectclass_tab = '123 '.
ld_objectid_tab = '123 '.
ld_tablekey_tab = '123 '.
ld_tablename_tab = '123 '.

SELECT single UTIME
FROM CDHDR
INTO ld_time_of_change.

ld_username_tab = '123 '.
ld_local_time = 'some text here'.

SELECT single TZONE
FROM TTZZ
INTO ld_time_zone.

ld_tablekey254_tab = '123 '.
ld_keyguid_tab = '123 '.

SELECT single UDATE
FROM CDHDR
INTO ld_date_until.


SELECT single UTIME
FROM CDHDR
INTO ld_time_until.

ld_keyguid_str_tab = '123 '.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CHANGEDOCUMENT_READ_RANGES or its description.