• 案例说明
    RFC读取表中数据。
  • Import
参数名称
Type spec.
参考打印
FIELDS_NAME1
TYPE
CHAR25
TABLE_NAME1
TYPE
CHAR25
WHERE_NAME1
TYPE
CHAR256
FIELDS_NAME2
TYPE
CHAR25
TABLE_NAME2
TYPE
CHAR25
WHERE_NAME2
TYPE
CHAR256
  • Tables
参数名称
Type spec.
参考打印
ITAB
LIKE
ZTABDATA
  • ZTABDATA
Component
Data Type
长度
小数位
ZDATA
CHAR
50
0
ZTEXT
CHAR
100
0
  • Source Code
FUNCTION Z_RFC_READ_ALL_DATA.
 
DATA: WA_TAB LIKE ZTABDATA.
SELECT (FIELDS_NAME1)
FROM (TABLE_NAME1) INTO WA_TAB-ZDATA
WHERE (WHERE_NAME1).
    APPEND WA_TAB TO ITAB.
    CLEAR WA_TAB.
ENDSELECT.
IF FIELDS_NAME2 <> '' AND TABLE_NAME2 <> ''.
    LOOP AT ITAB INTO WA_TAB.
        SELECT SINGLE (FIELDS_NAME2)
        FROM (TABLE_NAME2) INTO WA_TAB-ZTEXT
        WHERE (WHERE_NAME2).
        MODIFY ITAB FROM WA_TAB TRANSPORTING ZTEXT.
        CLEAR WA_TAB.
    ENDLOOP.
ENDIF.
 
ENDFUNCTION.
05-11 19:45