Application Development 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: 

Screen sequence processing when using modal dialog box

Former Member
0 Kudos

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

5 REPLIES 5

former_member181962
Active Contributor
0 Kudos

Hi Larissa,

AFAIK, the statement call screen 0 and set screen 0 mean that the control returns to the screen which calls it.

There is no such screen with number 0.

whenever you call the screen it is like going to the screen which called it.

Regards,

Ravi

Former Member
0 Kudos

Thank you for your reply. I understand that screen 0 is not a screen. I was just using this as an example of what is happening in my code.

Probably a better way of explaining it is, I want a way that if I press the buttons to exit out of screen 100, it terminates the transaction without going back to screen 150.

0 Kudos

HI Larissa,

What you can try is instead of call screen 100 from 150(In certain validation failure case), use set screen 0 and leave screen statements(In screen 150).

Regards,

Ravi

Former Member
0 Kudos

Thanks Ravi.

Tried this but all it does is exit the whole screen process instead of going back to screen 100 to then allow me to use the Back icon to exit the whole process.

Former Member
0 Kudos

Have got around this by removing the references to SET SCREEN 150. This way, I can get around the screen sequencing. It just means that I cannot keep my screen 150 in view if a validation message occurs but for now it will do for what I need.

Thank you for your help anyway.

Larissa