I want to use an ALV grid with a selection screen but without adding additional dynpros and PAI PBO Modules, like shown in this Example.
Everything works fine, but I can't go back from ALV to selection screen since the report gets terminated.
For my understanding,
I need to adapt this part of code.
If I don't call the function RS_SET_SELSCREEN_STATUS
,
I can go back to selection screen, but the F8
button is showing during the ALV Screen.
* Drucktastenleiste: Button "Ausführen (F8)" entfernen
DATA: it_exclude_btn TYPE STANDARD TABLE OF rsexfcode WITH DEFAULT KEY.
it_exclude_btn = VALUE #( ( fcode = 'ONLI' ) ).
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = '%_00' " akt. Standard-PF-Status des Dypro 2000
TABLES
p_exclude = it_exclude_btn.
* leere SAP-Toolbar ausblenden
cl_abap_list_layout=>suppress_toolbar( ).
* Focus auf ALV setzen
cl_gui_alv_grid=>set_focus( control = o_alv ).
* Flag für Screen-Status auf ALV-Anzeige setzen
gv_screen_status = 'IN_ALV'.
ENDIF.
Please help me to make the Back Button work in ALV view.
EDIT: You can test the behaviour using the code below:
PARAMETERS dummy1.
SELECTION-SCREEN BEGIN OF SCREEN 2000.
PARAMETERS dummy2.
SELECTION-SCREEN END OF SCREEN 2000.
AT SELECTION-SCREEN OUTPUT.
IF sy-dynnr = '2000'.
DATA it_exclude_btn TYPE STANDARD TABLE OF rsexfcode WITH DEFAULT KEY.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = '%_00' " wrong one: back will leave program
TABLES
p_exclude = it_exclude_btn.
ENDIF.
START-OF-SELECTION.
CALL SELECTION-SCREEN 2000.
ASSERT 1 = 1. " Debug helper to set a break-point / never reached
To achieve the desired behavior, add the AT ... ON EXIT-COMMAND
event.
You can insert the following code almost anywhere, for example place it before AT SELECTION-SCREEN OUTPUT.
:
...
AT SELECTION-SCREEN ON EXIT-COMMAND.
CASE sy-dynnr.
WHEN '1000'.
LEAVE PROGRAM.
WHEN '2000'.
LEAVE TO SCREEN 0.
ENDCASE.
...