Hi Lukas,
For the trivial SAP standard approach, I guess the enhancement way is the only one...so to dig probably!
What I would do is encapsulate the program RPTARQDBVIEW within a Z one in wich the layout would be just a parameter on the selection screen...No need to copy the program, you just need to copy the existing selection screen (with the new parameter for the alv layout variant), then submit the standard program with your custom parameters and output your ALV as per your requirement.
I would say..Z but clean approach (sometimes you need to live with it )
To get the output of the standard report, you will first need to initialize the ALV runtime buffer with the method:
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
Then submit:
submit rptarqdbview (with list of selection criteria) and return.
Then get your data back from the ALV buffer with:
data lr_data type ref to data. field-symbols <t_data> type any table. cl_salv_bs_runtime_info=>get_data_ref( importing r_data = lr_data ). cl_salv_bs_runtime_info=>clear_all( ). assign lr_data->* to <t_data>.
And finally you can play around with outputting <t_data> with any ALV variant or other settings...
cl_salv_table=>factory( importing r_salv_table = lr_table changing t_table = <t_data> ).
...(set ALV options)
...set layout variant:
data lo_layout type ref to cl_salv_layout. data l_variant type slis_vari. lo_layout = lr_table->get_layout( ). set_initial_layout( l_variant ).
...and display
lr_table->display( ).
Cheers!
Manu.