方案一:se38:RCS00100,F8执行(DATUM表示开始日期,tabname:BOM的Header,填写STKO;如落实到item级别,填写STPO)。然后再执行即可看到00104708该用户所做得创建,修改,删除bom得所有记录(哈哈很简单把,我也觉得很简单,而且结果确实看到了,我所做得关于bom得每一笔数据,测试成功!)
方案二:se11/se12:CDHDR【CDHDR是记录Header层面的Change,CDPOS记录item级别的Change】(实用程序-表内容-显示)
第一步:SE12,Table=CDHDR,Table Contents。字段选择如下填写:
Change doc. object=STUE(排他性的)
Date:起止日期,自己确定,日期段落越大,运行时间越长
Transaction:CS02(除了CS02变更BOM之外,我想不出还有什么删除BOM的方法)
Appl.obj.change:U(只能是U,但我本人也很迷惑为什么删除了的BOM不能是D)执行。系统将显示有关的记录,记录下有关的Object value的号码。
第二步:SE12,Table=CDPOS,Table Contents。字段选择如下填写:
Change doc. object=STUE(排他性的)
Object Value:从第一步获得
Table name:STPO(排他性的)
Change ID:D,U反映的是item值的新旧对比记录
代码语言:javascript复制concatenate sy-mandt 'M' itab_bom-stlnr into objectid.
clear itab_cdhdr.
refresh itab_cdhdr.
clear change_data.
refresh change_data.
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
DATE_OF_CHANGE = '00000000'
OBJECTCLASS = 'STUE'
OBJECTID = objectid
TIME_OF_CHANGE = '000000'
USERNAME = ''
TABLES
I_CDHDR = ICDHDR
EXCEPTIONS
NO_POSITION_FOUND = 1
OTHERS = 2.
if icdhdr[] is not initial.
loop at icdhdr where udate >= s_erdat-low.
itab_cdhdr-objectclas = icdhdr-objectclas.
itab_cdhdr-objectid = icdhdr-objectid.
itab_cdhdr-changenr = icdhdr-changenr.
itab_cdhdr-udate = icdhdr-udate.
append itab_cdhdr.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
CHANGENUMBER = ICDHDR-CHANGENR
* TABLEKEY = TABKEY
TABLENAME = 'STPO'
IMPORTING
HEADER = CDHDR
TABLES
EDITPOS = ICDSHW
EXCEPTIONS
NO_POSITION_FOUND = 1
OTHERS = 2.
*
* select objectclas objectid changenr tabname tabkey fname chngind
* value_new value_old from cdpos into table change_data
* where objectclas = 'STUE' and objectid = bom_temp-objectid
* and tabkey = bom_temp-tabkey and tabname = 'STPO' and
* ( fname = 'IDNRK' or fname = 'MENGE' or fname = 'KEY' ).
if icdshw[] is not initial.
loop at icdshw.
MOVE itab_cdhdr-objectclas TO change_data-objectclas.
MOVE itab_cdhdr-objectid TO change_data-objectid.
MOVE itab_cdhdr-changenr TO change_data-changenr.
MOVE itab_cdhdr-udate TO change_data-udate.
MOVE ICDSHW-TABNAME TO change_data-tabname.
MOVE ICDSHW-TABKEY TO change_data-tabkey.
MOVE ICDSHW-FNAME TO change_data-fname.
MOVE ICDSHW-F_OLD TO change_data-value_old.
MOVE ICDSHW-F_NEW TO change_data-value_new.
MOVE ICDSHW-CHNGIND TO change_data-chngind.
APPEND change_data.
endloop.
endif.
endloop.
endif.