2009 Jul 07 11:27 AM
Hi all,
I have one requirement like. I want save the data into SAP memory and need to retrieve from the other program.
Can any one give me an example program. How to export and import.
2009 Jul 07 12:01 PM
Hi,
From your first report Program,you have to export the internal table to sap memory using EXPORT Statement.
DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
DO 5 TIMES.
ITAB-BOOKID = 100 + SY-INDEX.
APPEND ITAB.
ENDDO.
EXPORT ITAB TO MEMORY ID 'table'.
In your another report Program, You have to import that internal table using IMPORT statement.
DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.
Hope it helps
Regards
Mansi
2009 Jul 07 11:33 AM
2009 Jul 07 11:47 AM
Hi,
You can use Import/Export statements if the data is required within programs in the same internal sessions or use Set parameter ID/Get parameter ID if external sessions are used.
EXPORT <fieldname> to memory id <memoryid> to set the value
and to resued the saved value use IMPORT <fieldname> from <memoryid>
Similarly use SET PARAMETER ID <id> field <fieldname>
and GET PARAMETER ID <id> field <fieldname> to retrieve the saved value.
Regards,
Sachin
2009 Jul 07 12:01 PM
Hi,
From your first report Program,you have to export the internal table to sap memory using EXPORT Statement.
DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
DO 5 TIMES.
ITAB-BOOKID = 100 + SY-INDEX.
APPEND ITAB.
ENDDO.
EXPORT ITAB TO MEMORY ID 'table'.
In your another report Program, You have to import that internal table using IMPORT statement.
DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.
Hope it helps
Regards
Mansi
2009 Jul 07 12:08 PM
Hi mansi,
I did the code like this:
program: 1
data : v_pgmname type sy-repid.
v_pgmname = 'Z_CRM_PROCESS'.
EXPORT v_pgmname FROM v_pgmname TO MEMORY ID 'ZZWS_PGM'.
write: v_pgmname.
program: 2
DATA : v_pgmname TYPE sy-repid.
IMPORT v_pgmname TO v_pgmname FROM MEMORY ID 'ZZWS_PGM'.
write: v_pgmname.
but here in the 1st program the data is not stored in the sap memory. i dont know why it is not working...please correct me if i did any mistake..
2009 Jul 07 12:19 PM
Hi,
I think ur pgm2 is in another session, try using set and get parameter id.
Regards
Sajid
2009 Jul 07 12:23 PM
HI sjid,
please send the exapmle code. so that it will help full to me...
2009 Jul 07 12:27 PM
Hi,
Try this
data : v_pgmname type sy-repid.
v_pgmname = 'Z_CRM_PROCESS'.
set parameter id 'ZZWS_PGM' field v_pgmname
write: v_pgmname.
program: 2
DATA : v_pgmname TYPE sy-repid.
get parameter id 'ZZWS_PGM' field v_pgmname
write: v_pgmname.
2009 Jul 07 12:38 PM
2009 Jul 07 2:21 PM
HI all,
again small problem, Actually in my requirement i need to use the field as a sting. but it is not accepting here. can any one ive me any suggestion..
DATA: VAR TYPE string VALUE '234'.
SET PARAMETER ID 'RID' FIELD VAR.
IF SY-SUBRC EQ 0.
WRITE: VAR.
ENDIF.
2009 Jul 07 2:56 PM