2023 Apr 27 12:44 PM
Currently my code is this. Is it possible that instead of naming all the fields to concatenate into l_lines2, can I just use X_FINAL2 instead? The reason is these structure is being used in an alv grid and sometimes the user changes the sequence according to their wants. Like the peinh is sometimes at the bottom, sometimes middle.
I want the excel file to be dynamic as the alv grid dislay layout.
My code is like this:
FORM final_data
t_final-peinh = peinh
t_final-meins = meins
t_final-labnr = labnr
LOOP AT t_final INTO x_final.
ENDLOOP.
CONCATENATE
x_final2-peinh
x_final2-meins
x_final2-labnr
x_final2-bukrs
x_final2-raube
x_final2-tempb
x_final2-menge2
x_final2-slfdt
x_final2-ihrez
INTO l_lines2 SEPARATED BY lc_tab.
CONCATENATE x_attachment-line l_lines2
INTO x_attachment-line SEPARATED BY lc_tab.
APPEND x_attachment TO t_attachment
2023 Apr 27 12:58 PM
2023 Apr 27 1:19 PM
Read the currently displayed field catalog, sort displayed field names by column, and dynamically assign the components in a loop.
• Method such as get_frontend_fieldcatalog of cl_gui_alv_grid or get_columns of cl_salv_table
• Statement ASSIGN COMPONENT comp OF STRUCTURE struc