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

Import table from a program into own report

Former Member
0 Likes
3,220

Hello mates,

i am calling the program 'rs_abap_source_scan' via submit in my own report.

I debugged the program and found an useful table for my issue named 'gt_alv_item'. Now i want to use this table in my own report.

How can i Import the table 'gt_alv_item' into my own report?

Thank you in advance.

Emre

Hello mates,

i am calling the program 'rs_abap_source_scan' via submit in my own report.

I debugged the program and found an useful table for my issue named 'gt_alv_item'. Now i want to use this table in my own report.

How can i Import the table 'gt_alv_item' into my own report?

Thank you in advance.

Emre

13 REPLIES 13
Read only

hubert_heitzer
Contributor
0 Likes
2,988

Hi Emre,

you can try some dirty assignment:

[code]

...

SUBMIT 'RS_ABAP_SOURCE_SCAN' AND RETURN.

FIELD-SYMBOLS <fs> TYPE table.

ASSIGN ('(RS_ABAP_SOURCE_SCAN)GT_ALV_ITEM[]') TO <fs>.

...

[\code]

Regards, Hubert

Read only

0 Likes
2,988

Hi,

thank you for your reply. I did it exactly like you mentioned it and i dont get any error Messages, but it doesn't work. I think it is not possible.. at least in my case.

I'll just copy the program and use it as a function module.

Have a nice day

Emre

Read only

0 Likes
2,988

Hi Emre

Don't copy the program.

Think about it - the called program has ended when your program regains control so where is the table ?

If you are looking for the results use the clause 'EXPORTING LIST TO MEMORY' of the SUBMIT command and then the function modules 'LIST_FROM_MEMORY' and 'LIST_TO_ASCI' to get the details back.

Then parse the table returned in your abap program.

Rich

Read only

0 Likes
2,988

Hubert.....

The called program has ended by the time you regain control.  Where would the internal table be stored ?

Rich

Read only

0 Likes
2,988

maybe its still somewhere in the memory but unfortunallay ABAP RT cannot address it anymore

Read only

0 Likes
2,988

Yes,  until the next malloc() which then eats half of it and invalidates the rest.....

Read only

renal_dmello
Explorer
0 Likes
2,988

Hi,

Try the below

SUBMIT report_name WITH selectoption1 eq variable

     exporting list to memory AND RETURN.


*get list from memory

CALL FUNCTION 'LIST_FROM_MEMORY'

   TABLES

     LISTOBJECT       =  IT_TAB.

* convert into asci format

   CALL FUNCTION 'LIST_TO_ASCI'

        TABLES

             listasci           = text_TAB

             listobject         = it_TAB

        EXCEPTIONS

             empty_list         = 1

             list_index_invalid = 2

             OTHERS             = 3.

loop at text_tab.

*copy the contents of the output here into your variable / internal table.  

endloop.


*then free memory

call function 'LIST_FREE_MEMORY'.

Read only

0 Likes
2,988

Isn't that what I said ???

Read only

Former Member
0 Likes
2,988

Hello,

i wasn't active for a while, sorry for that.

Sounds like a solution, but what type does text_tab and it_tab have? Are they both abaplist?

My program crashes when using text_tab as a abaplist in the asci function. For list_from_memory it's ok.

Regards

Emre

Read only

0 Likes
2,988

ListAsci is a table of char the width of your report

ListObject is your abaplist

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,988

Well gt_alv_item seems related to ALV, no?

So use search tool on cl_salv_bs_runtime_info to retrieve this internal table and prevent display of ALV (or read Gain Programmatic Access to Data of SAPGUI ALV Reports)

Regards,

Raymond

Read only

0 Likes
2,988

Hi Raymond,

And this is available after the scan has returned to the calling program ?

Rich

Read only

0 Likes
2,988

Hi Richard,

Yes, the ALV is not displayed (optional) but exported to memory, and you get it back in the caller. Check sample in Creating my own custom a report from t-code rsusr200 or in Glen's document.

Regards,

Raymond