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

Passing Variables Between Programs in Background Mode

Former Member
0 Likes
2,147

Hello,

Can you pls. suggest how I can pass a variable from one program to the other while in the background mode.

The Export and Import parameters do not work while in the background.

Thanks.

Amit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,175

Hi Amit,

EXPORT/IMPORT works in Background mode provided the export & import both are done in background.

Refer this program: it has export/import in background

/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

<b>*----


  • Before the export, fill the data fields before CLUSTR

*----


</b>

wa_index-aedat = sy-datum.

wa_index-usera = sy-uname.

EXPORT s_matnr

TO DATABASE indx(st) FROM wa_index ID wa_index_key.

<b>*----


  • Before the import, fill the data fields before CLUSTR.

*----


</b>

wa_index1-aedat = sy-datum.

wa_index1-usera = sy-uname.

*----


  • To Import the selection screen data from Calling Program

*----


IMPORT i_mara

FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.

FREE MEMORY ID wa_index_key1.

Message was edited by:

Prashant Patil

7 REPLIES 7
Read only

Former Member
0 Likes
1,175

try using SET parameter and GET parameter

Read only

Former Member
0 Likes
1,175

in first program use Set PARAMETER ID 'PER' FIELD 'variable'.

and in second

GET PARAMETER ID 'PER' FIELD 'variable'.

Read only

varma_narayana
Active Contributor
0 Likes
1,175

Hi

Create a Background Job with 2 Steps for 2 Report programs.

Now you can use EXPORT and IMPORT to pass the Data between these programs.

In the Calling program..

EXPORT XTAB FROM ITAB1 TO MEMORY ID 'ABC'.

In the Called program

IMPORT XTAB TO ITAB2 FROM MEMORY ID 'ABC'.

Note: SET / GET parameters can pass the Data to Screen fields only....

<b>reward if Helpful.</b>

Read only

0 Likes
1,175

Neither the EXPORT/IMPORT nor the SET/GET parameters work while in the background mode..

While the program is running in the background, i did debugging using SM50 (Process Overview). And thats I find out that the variable is not imported into the called program.

Read only

Former Member
0 Likes
1,176

Hi Amit,

EXPORT/IMPORT works in Background mode provided the export & import both are done in background.

Refer this program: it has export/import in background

/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

<b>*----


  • Before the export, fill the data fields before CLUSTR

*----


</b>

wa_index-aedat = sy-datum.

wa_index-usera = sy-uname.

EXPORT s_matnr

TO DATABASE indx(st) FROM wa_index ID wa_index_key.

<b>*----


  • Before the import, fill the data fields before CLUSTR.

*----


</b>

wa_index1-aedat = sy-datum.

wa_index1-usera = sy-uname.

*----


  • To Import the selection screen data from Calling Program

*----


IMPORT i_mara

FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.

FREE MEMORY ID wa_index_key1.

Message was edited by:

Prashant Patil

Read only

Former Member
0 Likes
1,175

SET /GET parameter IDs or IMPORT/EXPORT will not work in background mode.

better u create a Function group, inside it create Two separate Function modules.

There two FMs can talk to each other ( thru the common top include of the Function group).

U call the FM1 in the first prog -

CALL FUNCTION Z_FM_1 exporting L_value.

and from the seond prog where u need the data call the second FM

CALL FUNCTION Z_FM_1 importing L_value.

this will definitely solve ur problem.

Cheers

SKC.

Read only

Former Member
0 Likes
1,175

Hi Guys,

I found the solution.. We can Export/Import to the Shared Buffer instead of the normal way i.e. memory id.

For those who want a good example... Pls. refer to this thread:

Thankyou all for your replies...

Regards,

Amit