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: 

function of back,cancel,exit

Former Member
0 Kudos

Hi Guru,

i am working with module pool programming.

i have two screens like 100 and 200.screen 200 is model dialog box with one field(purchase order) is mandatory and two push buttons(enter,cancel).when i press cancel button it raises error message(fill in all required entry fields). how to over come this . pls suggest me.

regards,

6 REPLIES 6

Former Member
0 Kudos

Hi

U have 2 write the code for all buttons.

Ex:

when 'exit'

leave program.

when 'back'

leave to screen0.

WHEN 'CANCEL'.

LEAVE TO SCREEN 0.

In layout what name u r giving u have mention that name in ur program.

regards:

Prabu

0 Kudos

hi thanks,

that code i have written at PAI event with back,cancel,exit.

now my problem is when i am press cancel button it raises error message while i am switching from 200 screen to 100 screen.

regards,

Former Member
0 Kudos

make a module in pai like

module exit at exit-command

in that u copy ur code like

case ok_code.

when exit.

leave program.

enscase.

it works try this.

hope it help you

thanks

vikalp

Former Member
0 Kudos

Hi ashok,

TABLES:
  mara.
DATA:
  BEGIN OF fs_mara,
   matnr TYPE mara-matnr,
   ersda TYPE mara-ersda,
   ernam TYPE mara-ernam,
   mtart TYPE mara-mtart,
   matkl TYPE mara-matkl,
   END OF fs_mara.
DATA:
  ok_code TYPE sy-ucomm,               " Ok_code
  save_ok TYPE sy-ucomm.               " save_ok


START-OF-SELECTION.
  CALL SCREEN 100.
*----------------------------------------------------------------------*
*  MODULE STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
*  Dialog Module PBO
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
  CASE sy-ucomm.
    WHEN 'DISPLAY'.
      LOOP AT SCREEN.
        screen-input  = '0'.
        MODIFY SCREEN.
      ENDLOOP.
  ENDCASE.
ENDMODULE.                             " Status_0100 OUTPUT


*----------------------------------------------------------------------*
*  MODULE status_0100 INPUT
*----------------------------------------------------------------------*
* Dialog Modules PAI
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'DISPLAY'.
      PERFORM display_data.
    WHEN 'CLEAR'.
      CLEAR mara.
    WHEN 'BACK'.
      LEAVE PROGRAM.
    WHEN 'CANCEL'.
      LEAVE PROGRAM.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.                             " CASE sy-ucomm
ENDMODULE.                             " user_command_0100 INPUT
*&---------------------------------------------------------------------*
*&      Form  display_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_data .
  SELECT SINGLE matnr
               ersda
               ernam
               mtart
               matkl
        FROM mara
        INTO fs_mara
        WHERE matnr EQ  mara-matnr.
  mara-matnr = fs_mara-matnr.
  mara-ersda = fs_mara-ersda.
  mara-ernam = fs_mara-ernam.
  mara-mtart = fs_mara-mtart.
  mara-matkl = fs_mara-matkl.
ENDFORM.                    " display_data

Regards,

Sravanthi

Former Member
0 Kudos

hi,

make use of

module at exit command.

Inside that .

case sy-ucomm.

when 'EXIT'.

leave screen.

endcase.

Note : make the exit/cancel button funtion type to 'E'.

only then it works.

'E' -> exit command.

In field attributes u can find it, or in se41 while creating pf-status u can create it.

Rgds.,

subash

Former Member
0 Kudos

Hi Reddy

Your problem is that you have a screen with required fields, when you press cancel it give an error message saying that you have to fill the required fields first, and you want leave the screen without entring data in required field....

I faced the same problem and it resolved as mentioned by the gentlement as following:

Functional type of the function Code "Cancel" should be with type 'E', Exit Command.

PROCESS AFTER INPUT.

MODULE EXIT_COMMAND_0000 AT EXIT-COMMAND.

&----


*& Module EXIT_COMMAND_0000 INPUT

&----


  • text

----


MODULE EXIT_COMMAND_0740 INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'BACK' OR 'CANC'.

CLEAR OK_CODE.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

CLEAR OK_CODE.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " EXIT_COMMAND_0000 INPUT