Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

EXPORT/IMPORT TO MEMORY

Former Member
0 Likes
884

Hi Friends,

See the blow code:

REPORT ZEXPORT .

tables: kna1.

data: begin of itab occurs 0.

include structure kna1.

data: end of itab.

select * from kna1 into table itab.

if not itab is initial.

EXPORT itab to MEMORY ID 'mid'.

IF SY-SUBRC = 0.

WRITE:/ 'EXPORTED'.

ENDIF.

endif.

REPORT ZIMPORT .

data: begin of Jtab occurs 0.

include structure kna1.

data: end of Jtab.

IMPORT itab to jtab from MEMORY ID 'mid'.

loop at jtab.

write:/ jtab.

endloop.

in the first report, exported not printing the control is going back from export.

in the second report it is not printing jtab valyes.it is giving sy-subrc = 4 after import statement.

Can any body tell me what may be the problem?

Thanks in Advance.

7 REPLIES 7
Read only

suresh_datti
Active Contributor
0 Likes
794

PL try as follows..


REPORT ZEXPORT .
tables: kna1.
data: begin of itab occurs 0.
include structure kna1.
data: end of itab.

select * from kna1 into table itab.
if not itab[] is initial.
EXPORT itab[] to MEMORY ID 'mid'.
IF SY-SUBRC = 0.
WRITE:/ 'EXPORTED'.
ENDIF.
endif.


REPORT ZIMPORT .
data: begin of itab occurs 0.
include structure kna1.
data: end of itab.

IMPORT itab[] from MEMORY ID 'mid'.
loop at itab.
write:/ itab.
endloop.

Regards,

Suresh Datti

Read only

Former Member
0 Likes
794

TRy Capital letters for mid

REPORT ZEXPORT .

tables: kna1.

data: begin of itab occurs 0.

include structure kna1.

data: end of itab.

select * from kna1 into table itab.

if not itab is initial.

EXPORT itab to MEMORY ID 'MID'.

IF SY-SUBRC = 0.

WRITE:/ 'EXPORTED'.

ENDIF.

endif.

REPORT ZIMPORT .

data: begin of Jtab occurs 0.

include structure kna1.

data: end of Jtab.

IMPORT itab to jtab from MEMORY ID 'MID'.

loop at jtab.

write:/ jtab.

endloop.

Read only

former_member183804
Active Contributor
0 Likes
794

Hallo Jak,

as the report uses 'export to memory' it exports to ABAP Memory, which is the same external mode / call hierarchy. If the first reports submit the 2nd one the sy-SubRc should be 0.

Regards

Klaus

Online Help: ABAP Memory

This sequence is created if you can return from the called program to the calling program at the call of an ABAP-Program with SUBMIT ... AND RETURN or CALL TRANSACTION. For this purpose, the data of the internal session of the caller remains on a stack. The programs of a call sequence have collective access to the ABAP Memory. A call sequence can be left completely using the statement LEAVE TO TRANSACTION.

Read only

Former Member
0 Likes
794

Hi jak,

1. I tried it at my end.

Now it works fantastic.

2. Make this small corrections.

3. specify itab as itab[]

REPORT ZEXPORT .

tables: kna1.

data: begin of itab occurs 0.

include structure kna1.

data: end of itab.

select * from kna1 into table itab.

if not <b>itab[]</b> is initial.

EXPORT itab to MEMORY ID 'mid'.

IF SY-SUBRC = 0.

WRITE:/ 'EXPORTED'.

ENDIF.

endif.

submit zimport and return.

regards,

amit m.

Read only

0 Likes
794

Hi All,

Thank you very much..I have given the points.

Regards

Read only

Former Member
0 Likes
794

Hi Jak,

try to Change 'mid' to 'MID' .

Regards

vijay

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
794

Jak, make sure that the names of the tables are exactly the same in both programs.



REPORT ZEXPORT .
tables: kna1.
data: begin of itab occurs 0.
include structure kna1.
data: end of itab.

select * from kna1 into table itab.
if not itab is initial.

<b>EXPORT itab = itab to MEMORY ID 'mid'.</b>
IF SY-SUBRC = 0.
WRITE:/ 'EXPORTED'.
ENDIF.
endif.


REPORT ZIMPORT .
<b>data: begin of itab occurs 0.
include structure kna1.
data: end of itab.</b>

<b>IMPORT itab = itab from MEMORY ID 'mid'.</b>
loop at jtab.
write:/ jtab.
endloop.


Regards,

Rich Heilman