Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 11212

Re: Dynamic loading of Layout Variant in ALV-Grid Output List?

$
0
0

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.  


Viewing all articles
Browse latest Browse all 11212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>