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: 

Populate data from one program to another

Karan_Chopra_
Active Participant
0 Kudos

I have some value from one program and have to call one transaction and in that i have an input field which shud be populated from previous value from previous program...How to do it

4 REPLIES 4

Former Member
0 Kudos

Use Export to memory and later Import from Memory

If you want to pass a Table to memory

1. You have to define an internal table ITAB in program AAA.

2. In the program AAA you export your ITAB to the memory.

EXPORT ITAB TO MEMORY ID 'TD' (ID is the name of memory, you don't need to create it ).

3. In program BBB you have to declare The same table (same table's name and same fields).

4. In BBB you can import ITAB :

IMPORT ITAB FROM MEMORY ID 'TD'

5. Now you can export it to AAA after modifications.

EXPORT ITAB TO MEMORY ID 'TD'

6. In AAA :

IMPORT ITAB FROM MEMORY ID 'TD'

This solution is independant to SUBMIT.

If you just want to pass a Variable

Take a look at this code from SAP Help.

code

PROGRAM SAPMZTS1.

DATA TEXT1(10) VALUE 'Exporting'.

DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

DO 5 TIMES.

ITAB-BOOKID = 100 + SY-INDEX.

APPEND ITAB.

ENDDO.

EXPORT TEXT1

TEXT2 FROM 'Literal'

TO MEMORY ID 'text'.

EXPORT ITAB

TO MEMORY ID 'table'.

SUBMIT SAPMZTS2 AND RETURN.

SUBMIT SAPMZTS3.

Example for SAPMZTS2:

PROGRAM SAPMZTS2.

DATA: TEXT1(10),

TEXT3 LIKE TEXT1 VALUE 'Initial'.

IMPORT TEXT3 FROM MEMORY ID 'text'.

WRITE: / SY-SUBRC, TEXT3.

IMPORT TEXT2 TO TEXT1 FROM MEMORY ID 'text'.

WRITE: / SY-SUBRC, TEXT1.

Example for SAPMZTS3:

PROGRAM SAPMZTS3.

DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.

LOOP AT JTAB.

WRITE / JTAB-BOOKID.

ENDLOOP.

[/code]

Hope this helps

Vinodh Balakrishnan

0 Kudos

Hi,

You can also make use of submit statement.

Put submit and press f1. Check for its variation where it returns values to you.

eg: submit xyz returning a1 b1.

Hope it helps.

Regards,

Siddhesh S.Tawate

Former Member
0 Kudos

hI,

For PARAMETER :

data : gt_rsparams type table of rsparams with header line.

move: 'FIELD1' to gt_rsparams-selname,

'F' to gt_rsparams-kind, " PARAMETER

FIELD to gt_rsparams-low.

append gt_rsparams.

FOR SELECT-OPTIONS :

move: 'S_FIELD2' to gt_rsparams-selname,

'S' to gt_rsparams-kind. " SELECT-OPTION

if not s_FIELD2[] is initial.

loop at s_FIELD2.

if not s_FIELD2-high is initial.

move: 'I' to gt_rsparams-sign,

'BT' to gt_rsparams-option,

s_FIELD2-low to gt_rsparams-low,

s_FIELD2-high to gt_rsparams-high.

append gt_rsparams.

else.

move: 'I' to gt_rsparams-sign,

'EQ' to gt_rsparams-option,

s_FIELD2-low to gt_rsparams-low.

append gt_rsparams.

endif.

endloop.

endif.

submit PROGRAM_NAME2 with selection-table gt_rsparams.

rEGARDS,

moHAN.

Former Member
0 Kudos

Hi,

Please refer to the link below :

http://www.sapdev.co.uk/reporting/rep_submit.htm

Thanks,

Sriram Ponna.