Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Return To Selection Screen From ALV Grid

Former Member
0 Likes
2,252

I have a standard selection screen (1000) that supplies parameters to an ALV Grid. If the user presses BACK from the Grid, I want to go to the selection screen. If the user presses BACK from the selection screen, I want to exit the program. However, going BACK from the selection-screen just calls the grid again. Can someone tell me what my error is?

Thanks.

<b>MODULE pai INPUT.
  save_ok_code = ok_code.
  CLEAR ok_code.
  CALL METHOD cl_gui_cfw=>dispatch.

  CASE save_ok_code.
    WHEN 'BACK'.
      CASE sy-dynnr.
        WHEN '1000'.
          PERFORM exit_program.
        WHEN OTHERS.
          CALL SELECTION-SCREEN 1000.
      ENDCASE.
    WHEN 'EXIT' OR
         'CANCEL'.
      PERFORM exit_program.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.
</b>

1 ACCEPTED SOLUTION
Read only

manuel_bassani
Contributor
0 Likes
731

Hi Jerry,

how do you call the ALV grid screen ?

I usually do something like



...
select-options
parameters
....

start-of-selection.

call screen '0100'.  " <-- This is the screen of ALV Grid

in screen 0100 logic


PROCESS BEFORE OUTPUT.
  MODULE INIT_ALV.
PROCESS AFTER INPUT.
  MODULE USER_COMMAND.

MODULE USER_COMMAND INPUT.

  CASE ok_code.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      leave to screen '0000'.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.

Regards, Manuel

3 REPLIES 3
Read only

manuel_bassani
Contributor
0 Likes
732

Hi Jerry,

how do you call the ALV grid screen ?

I usually do something like



...
select-options
parameters
....

start-of-selection.

call screen '0100'.  " <-- This is the screen of ALV Grid

in screen 0100 logic


PROCESS BEFORE OUTPUT.
  MODULE INIT_ALV.
PROCESS AFTER INPUT.
  MODULE USER_COMMAND.

MODULE USER_COMMAND INPUT.

  CASE ok_code.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      leave to screen '0000'.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.

Regards, Manuel

Read only

Former Member
0 Likes
731

Hi Jerry

You don't need to check the dynpro because the BACK is automaically manage by system for selection-screen, so you need to manage the BACK for the grid.

I believe the flow of your report should be:

START-OF-SELECTION.

  • Here you call the dynpro for the grid

CALL SCREEN 100.

So in PAI

MODULE pai INPUT.

save_ok_code = ok_code.

CLEAR ok_code.

CALL METHOD cl_gui_cfw=>dispatch.

CASE save_ok_code.

WHEN 'BACK' OR 'EXIT' OR 'CANCELL'.

LEAVE TO SCREEN 0.

WHEN OTHERS.

ENDCASE.

ENDMODULE.

The statament LEAVE TO SCREEN 0 back to the point where the CALL SCREEN is done, so the system'll automatically go to the selection-screen.

Max

Read only

Former Member
0 Likes
731

Hi jerry

CALL SCREEN 100.

MODULE pai INPUT.

save_ok_code = ok_code.

CLEAR ok_code.

CALL METHOD cl_gui_cfw=>dispatch.

CASE save_ok_code.

WHEN 'BACK'.

CASE sy-dynnr.

WHEN '1000'.

PERFORM exit_program.

<b> WHEN '0100'.

LEAVE TO SCREEN 1000.</b> ENDCASE.

WHEN 'EXIT' OR

'CANCEL'.

PERFORM exit_program.

WHEN OTHERS.

ENDCASE.

ENDMODULE.

regards

kishore

Message was edited by: Harikishore Sreenivasulu