EXPORT和IMPORT使用示例

 1 report ztestprog.
 2 data:begin of itab1 occurs 0,
 3     ff(10),
 4     end of itab1.
 5 data:itab2 like itab1 occurs 0 with header line.
 6 data:str1 type string,
 7     str2 type string.
 8 data a type c.
 9 data b type c.
10 append '111111111' to itab1.
11 append '222222222' to itab2.
12 
13 str1 = 'ssssssssss'.
14  export itab1 to memory id 'M1'.
15  FREE itab1.
16  import itab1 from memory id 'M1'.
17 
18 export itab1 str1 to memory id  'M2'.
19 IMPORT itab2 str2 from memory id 'M2'.
20 
21 TYPES:
22   BEGIN OF tab_type,
23     para TYPE string,
24     dobj TYPE string,
25   END OF tab_type.
26 
27 DATA:
28  id    TYPE c LENGTH 10 VALUE 'TEXTS',
29   text1 TYPE string VALUE `IKE`,
30   text2 TYPE string VALUE `TINA`,
31   line  TYPE tab_type,
32   itab  TYPE STANDARD TABLE OF tab_type.
33 
34 line-para = 'P1'.
35 line-dobj = 'TEXT1'.
36 APPEND line TO itab.
37 
38 line-para = 'P2'.
39 line-dobj = 'TEXT2'.
40 APPEND line TO itab.
41 
42 EXPORT (itab)    TO MEMORY ID id.
43 IMPORT p1 = text2
44       p2 = text1 FROM MEMORY ID id.
45 write:text2,/,text1.

 

posted @ 2020-11-01 22:16  荒野游侠  阅读(184)  评论(0编辑  收藏  举报