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

Reg: Export/import

Former Member
0 Likes
1,398

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
Read only

Former Member
0 Likes
1,363

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
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,363

search in SCN

Read only

Former Member
0 Likes
1,363

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

Read only

Former Member
0 Likes
1,364

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

Read only

0 Likes
1,363

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

Read only

0 Likes
1,363

Hi,

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

Regards

Sajid

Read only

0 Likes
1,363

HI sjid,

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

Read only

0 Likes
1,363

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.

Read only

0 Likes
1,363

Thanks to every one...

Read only

0 Likes
1,363

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.

Read only

0 Likes
1,363

What abapers.

NO message