Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
GeorgeShlyakhov
Participant
Hello, colleagues!

It may be useful in everyday programming to use quick and simple solutions.

So, I wrote a function module 'Z_VERY_SIMPLE_ALV' which allows you to display an ALV grid in a pop-up window at railway speed.

Here you can see the FM:
FUNCTION z_very_simple_alv.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_START_COLUMN) TYPE I DEFAULT 25
*" REFERENCE(I_START_LINE) TYPE I DEFAULT 6
*" REFERENCE(I_END_COLUMN) TYPE I DEFAULT 100
*" REFERENCE(I_END_LINE) TYPE I DEFAULT 10
*" REFERENCE(I_TITLE) TYPE STRING DEFAULT 'ALV'
*" REFERENCE(I_POPUP) TYPE FLAG DEFAULT ' '
*" TABLES
*" IT_ALV TYPE STANDARD TABLE
*"----------------------------------------------------------------------

DATA go_alv TYPE REF TO cl_salv_table.

TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = it_alv[] ).

CATCH cx_salv_msg.
ENDTRY.

DATA: lr_functions TYPE REF TO cl_salv_functions_list.

lr_functions = go_alv->get_functions( ).
lr_functions->set_all( 'X' ).

IF go_alv IS BOUND.
IF i_popup = 'X'.
go_alv->set_screen_popup(
start_column = i_start_column
end_column = i_end_column
start_line = i_start_line
end_line = i_end_line ).
ENDIF.

go_alv->display( ).

ENDIF.

ENDFUNCTION.

You can use it like this:
REPORT z_very_simple_alv.

DATA gt_tab TYPE STANDARD TABLE OF sflights.

SELECT * FROM sflights INTO TABLE gt_tab.

CALL FUNCTION 'Z_VERY_SIMPLE_ALV'
TABLES
it_alv = gt_tab.

As a result, you will see the ALV in a full screen window:



The ALV grid displays in a full screen window by default, but if you set optional I_POPUP importing parameter as 'X' then the ALV will be displayed in a pop-up window:
REPORT z_very_simple_alv_popup.

DATA gt_tab TYPE STANDARD TABLE OF sflights.

SELECT *
FROM sflights
INTO TABLE gt_tab.

CALL FUNCTION 'Z_VERY_SIMPLE_ALV'
EXPORTING
i_popup = 'X'
TABLES
it_alv = gt_tab.

The ALV grid in a pop-up window:



Best regards,
Georgiy Shlyahov
24 Comments