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

former_member204025
Participant
0 Likes
926

Hi all,

I'm working with import and export. I have to export to memory ID one variable and one internal table, i wrote this:

REPORT z_abap_memoria_export.

TYPES: BEGIN OF ty_vuelos.

INCLUDE STRUCTURE ztabla_vuelos.

TYPES: END OF ty_vuelos.

DATA: v_pais(3) TYPE c VALUE 'BR'.

DATA: v_tabla(9) TYPE c VALUE 'ti_vuelos'.

DATA: ti_vuelos TYPE STANDARD TABLE OF ty_vuelos.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE ti_vuelos

FROM ztabla_vuelos.

EXPORT v_pais ti_vuelos TO MEMORY ID 'Z_MEMORIA2'.

IF sy-subrc EQ 0.

WRITE:/10 'Memoria exportada'.

ELSE.

WRITE:/(10) 'Memoria NO exportada'.

ENDIF.

Then, I wanted to IMPORT those valus, but I couldn't. Can someone explain to me what can be wrong here?

REPORT z_abap_memoria_import.

TYPES: BEGIN OF ty_vuelos.

INCLUDE STRUCTURE ztabla_vuelos.

TYPES: END OF ty_vuelos.

DATA: ti_vuelos TYPE STANDARD TABLE OF ty_vuelos.

DATA: st_vuelos TYPE ty_vuelos.

DATA: v_pais(3) TYPE c.

IMPORT v_pais ti_vuelos FROM MEMORY ID 'Z_MEMORIA2'.

IF sy-subrc EQ 0.

WRITE:/ v_pais.

LOOP AT ti_vuelos INTO st_vuelos.

WRITE st_vuelos.

ENDLOOP.

ELSE.

WRITE:/ 'no se pudo'.

ENDIF.

Thanks!

Gaby

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
858

you might not be on the same session..

after this code..

EXPORT v_pais ti_vuelos TO MEMORY ID 'Z_MEMORIA2'.
IF sy-subrc EQ 0.
WRITE:/10 'Memoria exportada'.
ELSE.
WRITE:/(10) 'Memoria NO exportada'.
ENDIF.

call the 2nd report..in the same first report.

SUBMIT z_abap_memoria_import and return.

now if you execute,, u will see result og 2nd report first and then result of 1st report.

7 REPLIES 7
Read only

Former Member
0 Likes
859

you might not be on the same session..

after this code..

EXPORT v_pais ti_vuelos TO MEMORY ID 'Z_MEMORIA2'.
IF sy-subrc EQ 0.
WRITE:/10 'Memoria exportada'.
ELSE.
WRITE:/(10) 'Memoria NO exportada'.
ENDIF.

call the 2nd report..in the same first report.

SUBMIT z_abap_memoria_import and return.

now if you execute,, u will see result og 2nd report first and then result of 1st report.

Read only

0 Likes
858

Hi!

Thanks for your answer.

I'm on the same session, that is why I don't understand what can be happening with my code.

After I wrote your code, It worked. But If I execute the export report, and after that I execute the Import report, it shouldn't work?

Why is not working properly?

Thanks!

Gaby

Read only

0 Likes
858

that's how it works.

you have to submit and catch with export and import.

when you execute report 1 and come out, that memory area is gone.. that is why you dont get that memory back in report2. by same session i mean same execution session.

Press F1 for more help.

Read only

0 Likes
858

Ok!!! Thank you very much for your help!

Gabriela.

Read only

0 Likes
858

Please close the thread by allocating rewards to helpful answer if the problem is resolved else revert back.

Read only

Former Member
0 Likes
858

Hi ,

check with the below logic . necessery it should be with in the same session .

EXPORT messtab FROM messtab TO MEMORY ID para.

IMPORT messtab TO messtab FROM MEMORY ID para.

here messtab will be your internal table .

check it out and let me know if any issues.

Regards,

Kavitha

Read only

0 Likes
858

Hi Kavitha,

I tried as you recommended before, and it worked, I couldn't understand what does 'session' means, but now is ok It worked, now I'm using submit if I'm calling from a different program, on that way works properly.

Thank you!

Gaby