方法一:通过abap内存
程序一:
REPORT zajax_test_new3.
*定义变量*
DATA aa TYPE c.
DATA bb TYPE c.
DATA wa TYPE mkpf.
DATA itab LIKE TABLE OF wa.
*变量赋值*
aa = '1'.
bb = '2'.
wa-mblnr = '1000000001'.
wa-mjahr = 2007.
wa-bldat = '20070615'.
APPEND wa TO itab.
wa-mblnr = '1000000002'.
wa-mjahr = 2007.
wa-bldat = '20070616'.
APPEND wa TO itab.
*写入内存数据簇*
EXPORT aa TO MEMORY ID 'Y1'.
EXPORT bb TO MEMORY ID 'Yqq'.
EXPORT itab TO MEMORY ID 'ITA'.
*调用Report的Tcode.
CALL TRANSACTION 'ZAJAX_TEST_NEW4'.
程序二:
REPORT zajax_test_new4.
.
*定义变量*
DATA aa TYPE c.
DATA bb TYPE c.
DATA wa TYPE mkpf.
DATA itab LIKE TABLE OF wa.
*读取内存数据簇*
IMPORT aa FROM MEMORY ID 'Y1'.
FREE MEMORY ID 'Y1'.
IMPORT bb FROM MEMORY ID 'Yqq'.
FREE MEMORY ID 'Y2'.
IMPORT itab FROM MEMORY ID 'ITA'.
FREE MEMORY ID 'ITA'.
*输出测试数据*
WRITE aa.
WRITE ' and '.
WRITE bb.
LOOP AT itab INTO wa.
WRITE: / wa-mblnr,wa-mjahr,wa-bldat.
CLEAR wa.
ENDLOOP.
注意点:
1) 程序一和程序二中要传递的值,要用相同的变量命名,否则读取不到值;
2) ID后的名字是随意的,只要保持双方同名就可以了。