07-18-2018 4:12 PM
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.
07-19-2018 1:34 AM
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.