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: 

module exit at exit-command

Former Member
0 Kudos

Hi all,

While I am using MODULE EXIT AT EXIT-COMMAND

its not working properly in module pool in PAI for the main screen.

code tht i m using for it is as follows.

DATA : l_ans TYPE c.

CLEAR ok_code.

*ok_code = sy-ucomm.

  • CASE ok_code.

  • WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = 'Would you like to Quit ?'(004)

text_button_1 = 'Yes'(005)

text_button_2 = 'No'(006)

IMPORTING

answer = l_ans

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CHECK l_ans = '1'.

LEAVE PROGRAM.

6 REPLIES 6

Former Member
0 Kudos

Hi,

I guess u r having a button which is used for exit command.

If so then u have the assign a property in the status.

Goto to the status, then double click on your custom button, U will be shown a popup,

then u have to give E in Function type.

then the code will be working fine.

also check the value for l_an in the run time.

after the pop up u can use

set screen 0.

leave screen.

or leave to screen 0.

regards,

Venkatesh

0 Kudos

Thanks A lot Venktesh,

I tried it and is working perfectly.

Former Member
0 Kudos

Hello Amit,

Have you made the appropriate settings at the function keys, against the icons 'EXIT' CANCEL and BACK. The function type needs to be set as 'E' in the GUI status - function keys.

Thanks,

Uma

Former Member
0 Kudos

Hello Amit,

Please check whether you have assigned Exit Command Type to your buttons or not; in order to do that, go to the specific screen->PF-Status->Choose any standard button(you have assigned)->double-click->Set FUNCTIONAL TYPE.

E Exit Command (MODULE xxx AT EXIT-COMMAND)

S System Function

T Call a Transaction

Normal Application Function

P Local GUI Functions

H Internal Use

Moreover, Module set for this exit-command with screen, should be;

In PAI;

MODULE exit_scr100 AT EXIT-COMMAND.

MODULE exit_scr100 INPUT.
  CASE ok_code.
    WHEN 'CANCEL'.
      LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.                                " CASE OK_CODE
ENDMODULE.                             

We use AT EXIT-COMMAND, when we want to cancel out the screen or exit the screen, despite errors. Otherwise, screen would hang-up asking for correcting errors.

Hope it helps you,

Zahack.

Former Member
0 Kudos

Hi all,

Thanks a lot for Your Help,

Its Now Working Fine.

Former Member
0 Kudos

Thanks..