Unable to close modal dialog

user393964 picture user393964 · Sep 4, 2011 · Viewed 9.8k times · Source

I'm trying to call a screen as a popup. The screen type is set to Modal dialog box and I'm able to call the screen, but unable to close it. Nothing happens when I click on the little cross. The next screen is set to 0.

The screen I'm calling as a popup, doesn't contain any buttons, not any hard coded ones anyway. Any ideas what I'm doing wrong?

I'd also like the screen it returns to, to be refreshed (so it loads the PBO again). How do I do that?

Here is the code:

MODULE werkende_knoppen_subscreen INPUT.
  CASE ok_code.
    WHEN 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.

Answer

René picture René · Sep 5, 2011

You should be checking for the 'EXIT' (or, in your case for the custom close button, 'X') user command in the PAI part of your popup. For example:

MODULE user_command_0010 INPUT.
  ok = sy-ucomm.
  CLEAR sy-ucomm.
  CASE ok.
    WHEN 'EXIT' OR 'X'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.