以下程序是比较两张字段完全一直内表的数据变化,还没有测试不一致内表的变化是否支持,不过估计不能支持
REPORT ZTESTTT.
TYPES: BEGIN OF TYP_ITAB,
NUM1 TYPE I,
NUM2 TYPE I,
END OF TYP_ITAB.
DATA ITAB1 TYPE STANDARD TABLE OF TYP_ITAB."旧表
DATA TYP_ITAB1 TYPE TYP_ITAB.
DATA ITAB2 TYPE STANDARD TABLE OF TYP_ITAB."新表
DATA TYP_ITAB2 TYPE TYP_ITAB.
DATA ITABD TYPE STANDARD TABLE OF TYP_ITAB."被删除数据
DATA ITABA TYPE STANDARD TABLE OF TYP_ITAB."增加数据
DATA ITABM TYPE STANDARD TABLE OF TYP_ITAB."变更数据
DATA ZFLAG TYPE FLAG."未变化标记
TYP_ITAB1-NUM1 = 1.
TYP_ITAB1-NUM2 = 2.
APPEND TYP_ITAB1 TO ITAB1.
CLEAR TYP_ITAB1.
TYP_ITAB2-NUM1 = 1.
TYP_ITAB2-NUM2 = 2.
APPEND TYP_ITAB2 TO ITAB2.
CLEAR TYP_ITAB2.
TYP_ITAB2-NUM1 = 3.
TYP_ITAB2-NUM2 = 4.
APPEND TYP_ITAB2 TO ITAB2.
CLEAR TYP_ITAB2.
CALL FUNCTION 'CTVB_COMPARE_TABLES'
EXPORTING
TABLE_OLD = ITAB1
TABLE_NEW = ITAB2
KEY_LENGTH = '3'"这个值始终没明白是干什么的,看程序里面是用来字段名移位计数的
* IF_SORTED =
IMPORTING
TABLE_DEL = ITABD
TABLE_ADD = ITABA
TABLE_MOD = ITABM
NO_CHANGES = ZFLAG.
WRITE :'test' ,zflag.
参考这里,有更多资料
阅读(924) | 评论(0) | 转发(0) |