一、比较两个内表记录的差异,可以使用FM:CTVB_COMPARE_TABLES来比较两个内表间的差异,有那些纪录是新增的,那些是修改过的和那些是被删除的。
sql
CALL FUNCTION 'CTVB_COMPARE_TABLES'
EXPORTING
table_old = old_tab[]
table_new = new_tab[]
key_length = 22
IMPORTING
table_del = del_tab[]
table_add = add_tab[]
table_mod = mod_tab[].
PS:在传入和传出内表参数时,如果只写内表名,而不加'[]',会产生runtime error
二、取元素域值
sql
PERFORM FRM_GET_DOMVALUE_TEXT USING 'ZMMD_ZFLZQ' <GFS_DATA>-ZFLZQ CHANGING <GFS_DATA>-ZZQTEXT .
IF <GFS_DATA>-ZXYLX IS NOT INITIAL .
PERFORM FRM_GET_DOMVALUE_TEXT USING 'ZMMD_ZXYLX' <GFS_DATA>-ZXYLX CHANGING <GFS_DATA>-ZLXTEXT .
ENDIF.
*&---------------------------------------------------------------------*
*& Form FRM_GET_DOMVALUE_TEXT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM FRM_GET_DOMVALUE_TEXT USING P_DOMNAME
P_VALUE
CHANGING P_DOM_TEXT .
DATA: LV_DOMNAME TYPE DD07L-DOMNAME,
LV_VALUE TYPE DD07L-DOMVALUE_L.
DATA: LS_DD07V TYPE DD07V,
LV_RC LIKE SY-SUBRC.
LV_DOMNAME = P_DOMNAME.
LV_VALUE = P_VALUE.
CALL FUNCTION 'DD_DOMVALUE_TEXT_GET'
EXPORTING
DOMNAME = LV_DOMNAME
VALUE = LV_VALUE
* LANGU = ' '
* BYPASS_BUFFER = ' '
IMPORTING
DD07V_WA = LS_DD07V
RC = LV_RC.
IF LV_RC = 0 .
P_DOM_TEXT = LS_DD07V-DDTEXT .
ENDIF.
ENDFORM.