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 from Memory in background.

Former Member
0 Likes
3,931

Hi,

I have a trouble and I dont know very well how to solve it.

I have a Z report running in background, and this report uses a SUBMIT to call another one.

Before the SUBMIT, there is an EXPORT to memory sentence; and the second report read this memory cluster and works with the data; but it doesnt work.

When I execute online, there is no problem, and the 2nd report shows an ALV with data exported in 1st report, but in background, nothing is shown.

Could you give me some help?

A lot of thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,649

Hello Alvaro,

This is simple. There are two types of memories in SAP. ABAP and SAP memory. These memories have some properties. ABAP memory remains active as long as the program is in the same session. When ever there is a new session the old ABAP memory get refreshed, and a new ABAP memory comes into picture.

In your case, before submitting the program to some other program you are exporting the value. Export will transfer the value to the ABAP memory. And after that you are submitting the program so a new session is being created and the ABAP memory is refreshed and so when you import that value you will get nothing.

So in order to solve the matter. Find a data element whose parameter ID you can set or you can create a custom data element witha custom parameter id and use that parameter id. Use the GET / SET parameter id to set or get the values. In that case the value is being stored at the SAP memory instead of ABAP memory.

You can have a look the following site for the custom parameter ID creation:

http://www.saptechnical.com/Tutorials/ABAP/ParameterID/custom.htm

Rewards points if found useful.

Regards.

Abhijit.

3 REPLIES 3
Read only

Former Member
0 Likes
1,649

It is working for me.

Check it once with this sample code.

REPORT  ZTEST_REPORT0.

data a type c.

a = 'X'.
data print_parameters TYPE pri_params.

*print_parameters-PDEST = 'LOCL'.
export a from a to memory id 'a1'.

submit ZTEST_REPORT exporting list to memory and return.

Submit prgram code.

REPORT  ZTEST_REPORT.

data: vbak type vbak.

data: a type c.

import a to a from memory id 'a1'.
if a = 'X'.
vbak-vbeln = 'TEST'.
modify vbak from vbak.
commit work.
endif.
write a.

now i checked the VBAK table, there i can see the entry VBELN = 'TEST'. i executed the program in background.

Read only

Former Member
0 Likes
1,650

Hello Alvaro,

This is simple. There are two types of memories in SAP. ABAP and SAP memory. These memories have some properties. ABAP memory remains active as long as the program is in the same session. When ever there is a new session the old ABAP memory get refreshed, and a new ABAP memory comes into picture.

In your case, before submitting the program to some other program you are exporting the value. Export will transfer the value to the ABAP memory. And after that you are submitting the program so a new session is being created and the ABAP memory is refreshed and so when you import that value you will get nothing.

So in order to solve the matter. Find a data element whose parameter ID you can set or you can create a custom data element witha custom parameter id and use that parameter id. Use the GET / SET parameter id to set or get the values. In that case the value is being stored at the SAP memory instead of ABAP memory.

You can have a look the following site for the custom parameter ID creation:

http://www.saptechnical.com/Tutorials/ABAP/ParameterID/custom.htm

Rewards points if found useful.

Regards.

Abhijit.

Read only

Former Member
0 Likes
1,649

Thanks to both, but finally I've created a little file in unix server to exchange the data; cause I am not able to create a ID memory.