SALV Table – Display table data in a popup window

This is an easy way to fetch data and show it in a table popup using the class cl_salv_table. Enjoy.


DATA: lr_alv TYPE REF TO cl_salv_table.
DATA: lr_functions TYPE REF TO cl_salv_functions_list.
DATA: lt_t100a TYPE STANDARD TABLE OF t100a.

* fetch data
clear lt_t100a.
SELECT * FROM t100a INTO TABLE lt_t100a uP TO 20 ROWS.


cl_salv_table=>factory(
IMPORTING
r_salv_table = lr_alv
CHANGING
t_table = lt_t100a ).

*set funtion toolbar
lr_functions = lr_alv->get_functions( ).
lr_functions->set_default( 'X' ).

* Set pop-up-dimensions
lr_alv->set_screen_popup(
start_column = 75
end_column = 150
start_line = 2
end_line = 9 ).


*Calling the display-method
lr_alv->display( ).

Enjoy the snippet.