Author: Sujit K.Pal
Submitted: 3 Nov,2008
Related Links: See Below
To pass data from one program to another program we can use ABAP Memory or SAP memory. When we are using ABAP memory we can go for EXPORT <Field> TO MEMORY ID <ID>option in Called program and IMPORT <Field> FROM MEMORY ID <ID>in calling program to share the data.
When we are using SAP memory we can go for SET PARAMETER ID <ID> FIELD <FIELD> in called Program and GET PARAMETER ID <ID> FIELD <Field>.
Again when we are calling SAP standard program and want to use the data responsible for output of the standard program then we neither can nor use SET PARAMETER ID or EXPORT TO MEMORY ID if there is no proper enhancement or exit is available. And we have to do changes in the SAP standard program if the suitable Exit or Enhancement spot is available.
In this case rather going for changes SAP standard program we can use List object of the standard program.
For that we have to SUBMIT the standard program and export list to memory and return to the calling program.
So Calling program can access the list object for its use.
Below is the code snippet of the called program. This program display flight details for carrier id range.
This screen shot is the output of the called program.
Note : This output is the flight details (Table SFLIGHT) of the carrier code AA.
Now we can use this list object of called program in our calling program and do further process like population of the data based on the submit programs data.
Analysis of process
In the above program we are submitting the Y_TEST_REPORT with Carrier Id and Exporting the list of the flight details into memory. Through Function module LIST_FROM_MEMORY list is being stored into list object internal table. By Function module LIST_TO_ASCII list object is converted to ASCII file. Now here carrier Id and flight date is populated into internal table by Reading the ASCII table by index. Using this internal table we are getting booking details from table SBOOK and displayed in ALV list.
Note: Output of booking details (Table SBOOK) using list object of Program YH_TEST_REPORT2
When we are populating the data from ASCII file to final internal table if there is any date field, currency field or quantity field then extra manipulation should be done for type compatibility and convertibility. Here I have hard coded the index when reading the ASCII internal table but index is dependent on the list object internal table whether table header is there or not. So for that we have to first check the contents of the AASCII internal table and set the index accordingly.