REPORT z_barry_export_import .
DATA: BEGIN OF itab1 OCCURS 0 ,
ff(10) ,
END OF itab1.
DATA: itab2 LIKE itab1 OCCURS 0 WITH HEADER LINE .
DATA: str1 TYPE string ,
str2 TYPE string .
ff(10) ,
END OF itab1.
DATA: itab2 LIKE itab1 OCCURS 0 WITH HEADER LINE .
DATA: str1 TYPE string ,
str2 TYPE string .
APPEND '111111111' TO itab1.
APPEND '222222222' TO itab1.
str1 = 'sssssssssss'.
APPEND '222222222' TO itab1.
str1 = 'sssssssssss'.
***如果是同名的对象,可以这么写:
EXPORT itab1 TO MEMORY ID 'M1'.
FREE itab1.
IMPORT itab1 FROM MEMORY ID 'M1'.
EXPORT itab1 TO MEMORY ID 'M1'.
FREE itab1.
IMPORT itab1 FROM MEMORY ID 'M1'.
LOOP AT itab1.
WRITE / itab1-ff.
ENDLOOP.
WRITE / itab1-ff.
ENDLOOP.
***如果不是同名的对象,需要加上一个对象名
EXPORT a = itab1 b = str1 TO MEMORY ID 'M2'.
IMPORT a = itab2 b = str2 FROM MEMORY ID 'M2'.
EXPORT a = itab1 b = str1 TO MEMORY ID 'M2'.
IMPORT a = itab2 b = str2 FROM MEMORY ID 'M2'.
LOOP AT itab2.
WRITE / itab2-ff.
ENDLOOP.
WRITE / itab2-ff.
ENDLOOP.
WRITE / str2.