Problem: you need to have a PAI/PBO event after user performs an action on your screen (e.g. clicks a toolbar button).
Solution: to invoke PAI event (and therfore PBO too) you have to emulate a user command in your program.
You can achieve this using below two lines of code.
* invoke PAI/PBO events to refresh the screen status cl_gui_cfw=>set_new_ok_code( new_code = 'DUMMY' ). cl_gui_cfw=>flush( ).
DUMMY is to avoid executing any action assigned for the user command, but if you want you can put there a handled user code and this will invoke a desired action.
CASE sy-ucomm.
WHEN 'DELETE'.
" do some action - possibly delete something
WHEN OTHERS.
" do nothing
ENDCASE.
* invoke PAI/PBO events to refresh the screen status and do nothing
cl_gui_cfw=>set_new_ok_code( new_code = 'DUMMY' ).
cl_gui_cfw=>flush( ).
* invoke PAI/PBO events to refresh the screen status and delete something
cl_gui_cfw=>set_new_ok_code( new_code = 'DELETE' ).
cl_gui_cfw=>flush( ).
Komentowanie jest zakończone.