2023 Nov 07 12:44 PM
Hello,
I am writing a report and displaying it with the CL_SALV_Table objects. I have created a custom GUI status with two buttons on it and I need to know how to handle those actions when they are pressed.
Below is my code.
lo_gr_alv->set_screen_status( pfstatus = 'ZCUSTOM'
report = sy-repid
set_functions = lo_gr_alv->c_functions_all
).
data:
l_text type string,
l_icon type string.
lo_gr_functions = lo_gr_alv->get_functions( ).
lo_gr_functions->set_all( abap_true ).
l_text = 'Generate'.
l_icon = icon_complete.
try.
lo_gr_functions->add_function(
name = 'TEST'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
*****
CASE sy-ucomm.
WHEN 'TEST'.
gt_rows = lr_selections->get_selected_rows( ).
LOOP AT gt_rows INTO DATA(gs_rows).
READ TABLE gt_data INTO DATA(gs_index) INDEX gs_rows.
ENDLOOP.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
Can someone please help me out with this?
How to handel the custom buttons
2023 Nov 07 1:21 PM
Can you post the code of your local method to handle events such as if_salv_events_functions~before_salv_function
2023 Nov 07 1:49 PM
Did you search?
Custom Button "set_screen_status" CL_SALV_TABLE site:sap.com
2023 Nov 07 2:47 PM
Yes sandra.rossi i check all these sites too. Did not found how to trigger event for the button.
I was able to add the custom button, but when i click on the button it does not get trigged.
2023 Nov 07 3:40 PM
Try this search to include the events (any user action) of CL_SALV_TABLE (method GET_EVENT):
Custom Button "set_screen_status" "get_event" CL_SALV_TABLE site:sap.com
2023 Nov 21 6:50 AM
you need a local event listener class to handle SALV event, please check demo program SALV_DEMO_TABLE_EVENTS in SE38