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

call another program and hold data in called program.

Former Member
0 Likes
2,070

Hi,

I have a program ztest1 from which i want to call ztest2 .

In ztest2 there is a Internal table defined It_out whoes data i want to use in ztest1 without actually using ztables.

Pls note my aim is to get the data from program ztest2 to program ztest1.

i tried submit, it works fine , but i am not able to get the data in called program i.e. ztest1.

can anyone pls help...

Regards.

Harish Kurup.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,894

hi jayant,

can u explain it further.i am using ;

submit test2 and return. " (test2 has internal table it_out whoes data i want in program test1).

do i need any addition in submit statement? and help me with further code.

19 REPLIES 19
Read only

former_member404244
Active Contributor
0 Likes
1,894

Hi,

use SUBMIT .. AND RETURN statement..

Regards,

Nagaraj

Read only

0 Likes
1,894

Hi,

SUBMIT prog|(field) (AND RETURN)(options).

If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program.

Edited by: Neenu Jose on Nov 28, 2008 10:40 AM

Read only

0 Likes
1,894

hi Neenu ,

where is the data stored in memory and how can i access it in called program after SUBMIT statement.

regards,

Harish Kurup.

Read only

Former Member
0 Likes
1,894

Hello,

You can use Memory-ID for the same.

Pass the internal table to Memory Id using: EXPORT <ITAB> from MEMORY-ID 'MY MEMORY'.

Take the data from the memory in another program using: IMPORT <itab> to MEMORY-ID 'MY MEMORY'.

You will be able to access the programs data if both the program runs in the same session. Memory ID uses the ABAP memory space to hold data and Garbage collector deletes the data after the session is over as it does not finds any pointer pointing to that memry address.

Hope it helps.

Thanks,

Jayant

Read only

Former Member
0 Likes
1,894

hI

use SET GET parameters to get the data of one program to another program

take the help of KEY word docu there is an example

Use INDX table

regards

Ramchander Rao.K

Read only

Former Member
0 Likes
1,895

hi jayant,

can u explain it further.i am using ;

submit test2 and return. " (test2 has internal table it_out whoes data i want in program test1).

do i need any addition in submit statement? and help me with further code.

Read only

0 Likes
1,894

Hi,

Press F1 help on submit button to see it....U can get how the data is passed between the programs.

Regards,

Nagaraj

Read only

0 Likes
1,894

Hello Harish,

I have asked you to use the Memory ID concept. It works good. Please try and let me know in case of any issue.

Thanks,

Jayant

Read only

0 Likes
1,894

Hi Jayant,

calling program ......ztest1. ........here i use import.

called program.......ztest2. "(It_out) ......here i use export..

can u help with precise code for the same with definitions for the variables used..

Read only

0 Likes
1,894

Hello,

Below statement will put the value in SAP Memory.

EXPORT <your internal table/work area> TO MEMORY ID 'TEST_MEMORY'.

Below statement will get the value stored in internal table.

IMPORT <your internal table/work area> FROM MEMORY ID 'TEST_MEMORY'.

This is all from the syntax side. You can give any name to your memory id.

Thanks,

Jayant

Read only

0 Likes
1,894

Hi,

u made it very clear.

How shall define "MEMORY ID".

Read only

0 Likes
1,894

i defined as follows,

memory_id type c.

export it_out from MEMORY_ID 'MEMORY'.

but it says

"Statement concluding with "...'MEMORY'" ended unexpectedly. "

Read only

0 Likes
1,894

>

> Hi,

> u made it very clear.

> How shall define "MEMORY ID".

Check Rich's post in the thread below, you have to make minor modifications to meet your requirement

use IMPORT statement after SUBMIT...AND RETURN statement in the calling program and EXPORT...in

the called program. You can use your own name for the memory ID.

Read only

0 Likes
1,894

Hello,

You do not need to define the Memory-id, it will be created at the run time i.e. space will be allocated to you as you encounter the statement export and this space will be deleted or marked for deletion as soon as the session in which your program is running in completed. Garbage collector for SAP will clear the SAP memory that you have utilized. Also, do not fear that you will be using enough memory of SAP which would be causing some problem in Production because there would also be other processes running because this will not take much of you SAP memory and will not effect the system much.

Thanks,

Jayant

Read only

0 Likes
1,894

Hello Harish,

Use below statement.

EXPORT <your internal table/work area> TO MEMORY ID 'TEST_MEMORY'.

Thanks,

Jayant

Read only

0 Likes
1,894

Thx Jayant,,,

Thx again.

It help me solve the problem..

Thx again..

Read only

0 Likes
1,894

Gr8. Have a nice time.

Cheers,

Jayant

Read only

Former Member
0 Likes
1,894

use memory concept emport and import and surely it will work .............

see documention for export and import in abap help and write the code

Read only

Former Member
0 Likes
1,894

suppose in ztest2 u have it_out internal table ..

u export in ztest2

write export it_out to memory id 'AA'.

then in ztest1 you import the same internal table as

import i_out from memory id 'AA'.

and now the data of it_out table will be available in the program ztest2