Application Development 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: 

Reg: Export/import

former_member623843
Participant
0 Kudos
147

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
112

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

10 REPLIES 10

kesavadas_thekkillath
Active Contributor
0 Kudos
112

search in SCN

Former Member
0 Kudos
112

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

Former Member
0 Kudos
113

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

0 Kudos
112

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..

0 Kudos
112

Hi,

I think ur pgm2 is in another session, try using set and get parameter id.

Regards

Sajid

0 Kudos
112

HI sjid,

please send the exapmle code. so that it will help full to me...

0 Kudos
112

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.

0 Kudos
112

Thanks to every one...

0 Kudos
112

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.

0 Kudos
112

What abapers.

NO message