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: 

Convert List Table Output to Dynamic internal Table format to write it to application server

0 Kudos

I have a scenario where I have List output obtained using SUBMIT statement and now i need to convert that to an Internal Table.

The catch here is every time i could get different number of fields in the O/P and so i cannot create a fixed structure.So it has to be Dynamic internal table.

I have used the below sequence of FM's after the Submit.

SUBMIT FAGL_ACCOUNT_ITEMS_GL USING SELECTION-SET 'ZTEST_TRY' EXPORTING LIST TO MEMORY AND RETURN.

LIST_FROM_MEMORY

LIST_TO_ASCI

And i get the O/P in the attached format.

Now, my question is

1. Any way to get the fields in a internal table using Submit statement where no format needs to be taken care of.

2.If not, can it be handled after getting the List O/P to convert into dynamic internal table format.

1 REPLY 1

DoanManhQuynh
Active Contributor
0 Kudos

First, I think data displayed in GL items report have FAGLPOSX data type.

Second, GL items report is classic ALV. There is a parameter pa_grid (which is set to no-display) to control data display in classic or grid ALV. i suppose that you didnt set this parameter since you use variant set in submit.

Then you can use bellow code to get ALV data ( I didnt use it to get data from ALV classic yet but you can give it a try):

DATA: ls_data TYPE REF TO data.
FIELD-SYMBOLS:<lt_data> TYPE table.
SUBMIT FAGL_ACCOUNT_ITEMS_GL USING SELECTION-SET 'ZTEST_TRY' AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(IMPORTING r_data = ls_data ).
ASSIGN ls_data->*TO<lt_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE`Unable to retrieve ALV data`TYPE'E'.
ENDTRY.