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: 

Executing two reports from a third report

Former Member
0 Kudos

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...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

12 REPLIES 12

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

Use Submit statement with syntax- ... EXPORTING LIST TO MEMORY

then read list from memory

Former Member
0 Kudos

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

Former Member
0 Kudos

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....

kesavadas_thekkillath
Active Contributor
0 Kudos

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.



Former Member
0 Kudos

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..???

0 Kudos

DEAR FRIEND

Just go through the MEMORY ID CONCEPTS..then u will get it...

Former Member
0 Kudos

Hi Abhijeet,

Can u tell me hw to export the o/p from prog1 and import it in prog3 using memory id...

kesavadas_thekkillath
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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'.

rainer_hbenthal
Active Contributor
0 Kudos

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.