SAP歷史更改記錄函數

SAP中很多地方對資料的操作都會有保存更改歷史記錄,可能過以下兩個函數取得更改歷史記錄:


取得記錄表頭函數
call function 'CHANGEDOCUMENT_READ_HEADERS'
exporting
* ARCHIVE_HANDLE = 0
* DATE_OF_CHANGE = '00000000'
objectclass =
* OBJECTID = ' '
* TIME_OF_CHANGE = '000000'
* USERNAME = SY-UNAME
* LOCAL_TIME = ' '
* DATE_UNTIL = '99991231'
* TIME_UNTIL = '235959'
* NOPLUS_ASWILDCARD_INOBJID = ' '
tables
i_cdhdr =
* EXCEPTIONS
* NO_POSITION_FOUND = 1
* WRONG_ACCESS_TO_ARCHIVE = 2
* TIME_ZONE_CONVERSION_ERROR = 3
* OTHERS = 4
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

其中objectclass是指定要查看什麽資料的歷史記錄,如查看BOM的更改記錄, objectclas = 'STUE'

取得更改記錄明細函數
call function 'CHANGEDOCUMENT_READ_POSITIONS'
exporting
* ARCHIVE_HANDLE = 0
changenumber =
* TABLEKEY = ' '
* TABLENAME = ' '
* TABLEKEY254 = ' '
* KEYGUID = ' '
* KEYGUID_STR = ' '
* IMPORTING
* HEADER =
* ET_CDRED_STR =
* TABLES
* EDITPOS =
* EDITPOS_WITH_HEADER =
* EXCEPTIONS
* NO_POSITION_FOUND = 1
* WRONG_ACCESS_TO_ARCHIVE = 2
* OTHERS = 3
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

其中changenumber可從頭文件中反回的數據表中取得


你可能感兴趣的:(SAP歷史更改記錄函數)