2007 Mar 02 1:43 AM
hi guys,
How to pass internal tables from one program to another in below situations.
Prog ZMainXXX
..............
<b>Loop at itab.
................
Create bdc_fields.
Call transaction ZXXX using BDCTAB.
...............
ENDLOOP.</b>
ZXXX is transaction created from std program
SAPLYXXX which has many includes and function modules.
<b>Prog SAPLYXXX
.............
Submit Report RSLXXXX.
End program</b>
Inside RSLXXXX Report program.
I have Internal table LISTTAB used. I want to pass this internal table values appended each time for each Loop at Itab at ZMainXXX Program
How to append Internal table LISTTAB values for each loop of IITAB at ZMAINXXX.
suggestion please.
Thanks
Ambichan.
hi guys,
How to pass internal tables from one program to another in below situations.
Prog ZMainXXX
..............
<b>Loop at itab.
................
Create bdc_fields.
Call transaction ZXXX using BDCTAB.
...............
ENDLOOP.</b>
ZXXX is transaction created from std program
SAPLYXXX which has many includes and function modules.
<b>Prog SAPLYXXX
.............
Submit Report RSLXXXX.
End program</b>
Inside RSLXXXX Report program.
I have Internal table LISTTAB used. I want to pass this internal table values appended each time for each Loop at Itab at ZMainXXX Program
How to append Internal table LISTTAB values for each loop of IITAB at ZMAINXXX.
suggestion please.
Thanks
Ambichan.
2007 Mar 02 1:49 AM
you can use the EXPORT / IMPORT statements to pass the internal table from one prog to another.
export LISTTAB to memory id 'LSTB'.
in ur prog ZMainXXX
use the import statement
import LISTTAB from memory id 'LSTB'.
and then here in loop u can append all the records of LISTTAB to ITAB.
Regards
Gopi
2007 Mar 02 2:47 AM
hi gopi
Thanks for your reply.
You mean to say i need to declare LISTTAB inside ZMAINXXX program also.
Thanks
Ambichan
2007 Mar 02 3:38 AM
Prince,
If your program name starts with "RS" means it is standard program.
my question is how can you change your program without key?If you have already
DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
---In prog....RSLXXXX
DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
---In prog....ZMainXXX
use EXPORT ITAB TO MEMORY ID 'table'. -In Prog RSLXXXX program.
IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.--In prog ZMainXXX
**************************
Take this example for your reference.
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.
The first part of this program is the same as the example in the section Saving Data Objects in Memory. In the example, the programs SAPMZTS1 and SAPMZTS2 are called using SUBMIT. You can create and maintain the programs called using the SUBMIT statement by double-clicking their names in the statement. For further information about the SUBMIT statement, refer to Calling Executable Programs (Reports)
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.
Pls. mark if useful
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |