Skip to Content
0
Former Member
Jan 12, 2006 at 12:00 PM

Screen sequence processing when using modal dialog box

61 Views

I have been struggling with a dialog program which I have written. I have a screen which has 2 radiobuttons and a check box (screen 100). If the checkbox is marked, a modal dialog screen pops up (screen 150). If I complete both input fields on screen 150, I can go through to screen 200, then back out of screen 200 to screen 100, and then I can back out 100 to screen 0.

The problem I have is the validation I have put in screen 150 if one or both input fields have no values or if I want to exit screen 150. If I exit screen 150, in order to get back to screen 100 in the main screen I need to do CALL SCREEN 100 as if I use SET SCREEN 100, 100 then appears in my modal dialog box screen.

If I try to back out of screen 100 to screen 0, the program then brings up screen 150 in the PAI part of the module and then go to screen 0 when I close screen 150 even though I have coded SET SCREEN 0. LEAVE SCREEN. in the user command module of screen 100. Here is my code:

<u><b>screen 100</b></u>

PROCESS BEFORE OUTPUT.
  MODULE status_0100.

*
PROCESS AFTER INPUT.
  MODULE user_command_0100.

<b>

<u>Modules for 100</u></b>

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'ZL_PWB_GR1'.
  SET TITLEBAR  'ZL_PWB_GR1'.

  CLEAR: w_hse_stock, w_new_product, wa_sto, w_reverse, 
         mara-matnr,  mkpf-mblnr.

  PERFORM release_lock.
  REFRESH CONTROL 'TC_GR' FROM SCREEN 0200.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT .

  CASE ok_code.

    WHEN 'ENTER'.
      IF w_reverse = space.
        CALL SCREEN 0200.
      ELSE.
        CALL SCREEN 0150 STARTING AT 30 2
                         ENDING AT   75 5.
      ENDIF.

    WHEN 'BACK' OR 'EXIT' OR 'CANC'.
      w_pai = c_yes.
      SET SCREEN 0.
      LEAVE SCREEN.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

<u><b>screen 150</b></u>

PROCESS BEFORE OUTPUT.
  MODULE status_0150.
*
PROCESS AFTER INPUT.
  MODULE exit_command_0150 AT EXIT-COMMAND.
  FIELD  mara-matnr MODULE check_matnr.
  FIELD  mkpf-mblnr MODULE check_art_doc.

<u><b>Modules for 150</b></u>

  MODULE user_command_0150.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0150  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0150 OUTPUT.
  SET PF-STATUS 'GR_REV'.
  SET TITLEBAR 'GR_REV'.

ENDMODULE.                 " STATUS_0150  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  exit_COMMAND_0150  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exit_command_0150 INPUT.

  IF sy-ucomm = 'EXIT'.
    CALL SCREEN 100.
  ENDIF.

ENDMODULE.                 " exit_COMMAND_0150  INPUT

*&---------------------------------------------------------------------*
*&      Module  check_matnr  INPUT
*&---------------------------------------------------------------------*
*  Check if issues has been filled and if issue is a valid article no.
*----------------------------------------------------------------------*
MODULE check_matnr INPUT.

  DATA: l_matnr TYPE matnr.

  IF mara-matnr IS INITIAL.
    MESSAGE i010(ad) WITH 'Issue no. required'.
    EXIT.
  ELSE.

    SELECT SINGLE matnr FROM mara INTO l_matnr
     WHERE matnr = mara-matnr.

    IF sy-subrc NE 0.
      CLEAR l_matnr.
      MESSAGE i010(ad) WITH 'Issue does not exist'.
    ENDIF.
  ENDIF.


ENDMODULE.                 " check_matnr  INPUT
*&---------------------------------------------------------------------*
*&      Module  check_art_doc  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE check_art_doc INPUT.

  IF mkpf-mblnr IS INITIAL.
    MESSAGE i010(ad) WITH 'Article document no. required'.
    EXIT.
  ELSE.

    PERFORM get_art_doc USING mara-matnr
                              mkpf-mblnr.

    IF sy-subrc NE 0.
      MESSAGE i010(ad) WITH 'No article document exists for this issue'.
    ENDIF.

  ENDIF.

ENDMODULE.                 " check_art_doc  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0150  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0150 INPUT.

  CASE sy-ucomm.

    WHEN 'ENTE'.
      IF mara-matnr NE space AND mkpf-mblnr NE space.
        CALL SCREEN 200.
      ELSE.
*        MESSAGE i010(ad) WITH 'Please fill in both fields'.
        SET SCREEN 150.
      ENDIF.

  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0150  INPUT

Any suggestions or pointers would be greatly appreciated as I am going round in circles.

Thanks

Larissa