1、针对自建表的各个字段对应的数据元素添加更改文档 2、然后进入SCDO事务代码创建自定义表更改对象 3、生成文档信息之后
4、增强预留出口写入更改自建表逻辑 &--------------------------------------------------------------------- *& 包含 ZXMG0U02 &--------------------------------------------------------------------- TABLES:ZMMMARA.
DATA: LI_ZMMMARA TYPE STANDARD TABLE OF ZMMMARA, LI_YZZZ TYPE STANDARD TABLE OF YZMMMARA, LI_XZZZ TYPE STANDARD TABLE OF YZMMMARA, LS_ZMMMARA TYPE ZMMMARA, LS_XZZZ_ZMMMARA TYPE YZMMMARA, LS_YZZZ_ZMMMARA TYPE YZMMMARA. DATA BEGIN OF ICDTXT_ZMMMARA OCCURS 1. INCLUDE STRUCTURE CDTXT. DATA:END OF ICDTXT_ZMMMARA. DATA: OBJECTID LIKE CDHDR-OBJECTID. REFRESH:LI_ZMMMARA. CLEAR:LS_ZMMMARA. IF SY-UCOMM EQ ‘BU’ OR SY-UCOMM EQ ‘YES’. IMPORT ZMMMARA FROM MEMORY ID ‘ZMMMARA’. IF SY-SUBRC <> 0. RETURN. ENDIF.
-
旧值 SELECT SINGLE * INTO LS_ZMMMARA FROM ZMMMARA WHERE MATNR = CMARA-MATNR. IF SY-SUBRC = 0. MOVE-CORRESPONDING LS_ZMMMARA TO LS_YZZZ_ZMMMARA. LS_YZZZ_ZMMMARA-KZ = ‘U’. APPEND LS_YZZZ_ZMMMARA TO LI_YZZZ. ENDIF. -
新值 IMPORT ZMMMARA FROM MEMORY ID ‘ZMMMARA’. ZMMMARA-MATNR = CMARA-MATNR. MOVE-CORRESPONDING ZMMMARA TO LS_XZZZ_ZMMMARA. LS_XZZZ_ZMMMARA-KZ = ‘U’. APPEND LS_XZZZ_ZMMMARA TO LI_XZZZ. -
插入数据 MODIFY ZMMMARA FROM ZMMMARA. -
用表KEY键组成ObjectID OBJECTID = CMARA-MATNR. CALL FUNCTION ‘ZMMMARA_WRITE_DOCUMENT’ EXPORTING OBJECTID = OBJECTID TCODE = SY-TCODE UTIME = SY-UZEIT UDATE = SY-DATUM USERNAME = SY-UNAME -
PLANNED_CHANGE_NUMBER = ' '
-
OBJECT_CHANGE_INDICATOR = 'U'
-
PLANNED_OR_REAL_CHANGES = ' '
-
NO_CHANGE_POINTERS = ' '
-
UPD_ICDTXT_ZMMMARA = ' '
UPD_ZMMMARA = 'U'
TABLES ICDTXT_ZMMMARA = ICDTXT_ZMMMARA XZMMMARA = LI_XZZZ "新值 YZMMMARA = LI_YZZZ. "旧值 COMMIT WORK.
ENDIF.
|