I am creating a SALV grid in a simplistic manner avoiding screens and containers:
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = itab ).
CATCH cx_salv_msg INTO exc.
ENDTRY.
...
lo_alv->set_screen_status( pfstatus = 'SALV_STATUS'
report = sy-repid
set_functions = lo_alv->c_functions_all ).
...
lo_alv->display( ).
I want to show the standard MESSAGE
only once upon grid display, making it showed in the bottom status bar.
I tried PAGE events, but they are not fired on start, only after pressing standard toolbar button
SET HANDLER cl_event_handler=>on_top_of_page FOR lo_events.
SET HANDLER cl_event_handler=>on_end_of_page FOR lo_events.
I also tried putting MESSAGE
after the display( )
method, but this way it is showed after I exit the grid with back button, and this is not what I want, I want it showed exactly under the grid at the moment of first load.
Is there an event that is triggered on grid initialization or after rendering/loading data?
If not, is there any workaround to make this work ?
Put the message before calling lo_alv->display( )
. This complete program seems to behave the way you want. The status message "Hello World" appears below the ALV grid with the data:
REPORT Z_TEST_SALV_MESSAGE.
SELECT * FROM sflight INTO TABLE @DATA(gt_sflight).
cl_salv_table=>factory(
IMPORTING
r_salv_table = DATA(lo_alv)
CHANGING
t_table = gt_sflight ).
MESSAGE 'Hello World' TYPE 'S'.
lo_alv->display( ).