‎2009 Oct 04 11:46 PM
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
‎2009 Oct 05 12:05 AM
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.
‎2009 Oct 05 12:05 AM
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.
‎2009 Oct 05 12:30 AM
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
‎2009 Oct 05 12:39 AM
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.
‎2009 Oct 05 12:43 AM
‎2009 Oct 05 2:57 AM
Please close the thread by allocating rewards to helpful answer if the problem is resolved else revert back.
‎2009 Oct 05 8:24 AM
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
‎2009 Oct 05 1:17 PM
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