08-28-2008 11:18 AM
Hi all,
I hv to execute two reports from a third report...say I hv Zrep1, Zrep2 and Zrep3...
From zrep3 I hv to execute the other two reports and I hv to get the output tables from those reports....
For this I hv used Submit zrep1 via selection-screen....here i'm gettin the selection screen of zrep1, if I execute it im gettin the o/p, but I dont want to display the output...I jus want to import the outputs of those two reports into Zrep3 with my selection screen criterion..
Can anyone help me on this...
08-28-2008 11:27 AM
Hi Mamtha,
When you are calling prog1 and prog2 from prog3, what you can do after getting data in internal table in prog1. Just EXPORT this internal table to a memory Id. Then call the prog3 using SUBMIT <progname> AND RETURN and in prog3 just fetch that internal table from same memory id.
Regards
Abhijeet
08-28-2008 11:19 AM
Hi,
We have to use the Import list commands for this
We have option called as EXPORTING LIST TO MEMORY AND RETURN and IMPORTING LIST FROM MEMORY AND RETURN
Also use the FM LIST_TO_MEMORY FM for your requirement
check the sample code -
DATA list_tab TYPE TABLE OF abaplist.
SUBMIT report EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
listobject = list_tab.
ENDIF.
Regards
Lekha
08-28-2008 11:21 AM
try
SUBMIT <report> EXPORTING LIST TO MEMORY AND RETURN - this will export the list output to memory..
then you can use the FMs LIST_FROM_MEMORY and then LIST_TO_ASCI to get the output from the memory.
hope it helps
08-28-2008 11:23 AM
Hi
Use Submit statement with syntax- ... EXPORTING LIST TO MEMORY
then read list from memory
08-28-2008 11:27 AM
Hi Mamtha,
When you are calling prog1 and prog2 from prog3, what you can do after getting data in internal table in prog1. Just EXPORT this internal table to a memory Id. Then call the prog3 using SUBMIT <progname> AND RETURN and in prog3 just fetch that internal table from same memory id.
Regards
Abhijeet
08-28-2008 11:41 AM
Do I need to use submit report in zrep1 , zrep2 & zrep3....???
In zrep1 I hv to export final internal table...
submit <zrep1> exporting list to memory....
And in zrep3 I need to import it....
submit <zrep1> importing list from memory...
Is that correct??? Can u be more clear...
Whr I hv to use those FM's???
thanx....
08-28-2008 12:00 PM
check this
data listobject type table of abaplist.
data g_list_content type solix_tab.
submit zrep1 with p1 = v_vbeln exporting list to memory AND RETURN.
perform get_list.
<---Process the data in g_list_content.
submit zre2 with p1 = v_vbeln exporting list to memory AND RETURN.
perform get_list.
<---Process the data in g_list_content.
form getlist.
* import the list from memory and store it in table listobject
call function 'LIST_FROM_MEMORY'
tables
listobject = listobject
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
* message e105 with 'LIST_FROM_MEMORY'.
endif.
* free memory
call function 'LIST_FREE_MEMORY'
tables
listobject = listobject
exceptions
others = 1.
if sy-subrc <> 0.
* message e105 with 'LIST_FREE_MEMORY'.
endif.
* it's always necessary to compress the table.
* SAPconnect will decompress it
call function 'TABLE_COMPRESS'
tables
in = listobject
out = g_list_content
exceptions
compress_error = 1
others = 2.
if sy-subrc <> 0.
* message e105 with 'TABLE_COMPRESS'.
endif.
endform.
08-28-2008 12:14 PM
I hv one more doubt...If I execute ZREP1 the output shd be exported to ZREP3 and If I execute ZREP2, the o/p shd be sent to ZREP3...hw can I do this..???
08-28-2008 12:19 PM
DEAR FRIEND
Just go through the MEMORY ID CONCEPTS..then u will get it...
08-28-2008 12:20 PM
Hi Abhijeet,
Can u tell me hw to export the o/p from prog1 and import it in prog3 using memory id...
08-28-2008 12:40 PM
Check this...
This code is from which program you want to export to the ABAP memory:
export ist_resb to memory id 'ABC'.
where ist_resb is the internal table name
This code is from which program you want to import from the ABAP memory
import *ist_resb *= ist_resb from memory id 'ABC'.
where ist_resb This internal table is the importing program internal table.
ist_resb This internal table is the exporting program internal table.
But remember in both the program you have defined the same internal table with same structure
08-28-2008 12:53 PM
Hi Keshu,
Thanx for ur replies...I had tried it..but I'm not getting the data in my importing table internal table..see my declaration...
ZREP1
EXPORT t_final TO MEMORY ID 'TST'.
ZREP2
import t_final1 = t_final from memory id 'TST'.
08-28-2008 2:02 PM
Nice idea, but i would extract the logic of zrep1 and zrep2 into function modules and use those.
Using the list outpout is a nightmare cause this is not a stable interface.