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: 

how to capture data at exit command in module pool

Former Member
0 Kudos

hello all,

i have a scenario,on screen i enter some data and i press the cancel button a popup should be displayed saying do you want to cancel.if i press on yes then leave to screen 0.but if i press no then the previous data entered should be displayed on the same screen.

can some body help me on this.

Thanks,

Mayank.....

10 REPLIES 10

Former Member
0 Kudos

Hi,

just use a modul at PAI

MODULE EXIT_100 AT EXIT-COMMAND

Regards

ricky

Former Member
0 Kudos

Hi,

Create a button with type 'E' and

call a POP UP FM 'POPUP_TO_CONFIRM' and write the code to return to the place where you want to.

All the you need to write at at exit command.

The code is like this:

REPORT ztest_at_exit.

DATA:

var1(10),

var2(10),

var3(10).

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'ZTEST_AT_EXIT'.

SET TITLEBAR 'ZTEST_AT_EXIT'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

DATA:

w_ucomm LIKE sy-ucomm.

w_ucomm = sy-ucomm.

CASE w_ucomm.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'CANCEL'.

LEAVE TO SCREEN 0.

WHEN 'ADD'.

var3 = var1 + var2.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module EXIT_100 INPUT

&----


  • text

----


MODULE exit_100 INPUT.

DATA:

answer.

w_ucomm = sy-ucomm.

CASE w_ucomm.

WHEN 'EXIT2'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = 'Do you want to save this ?'

IMPORTING

answer = answer.

  • exception

  • 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.

IF NOT answer EQ '1'.

LEAVE TO SCREEN 0.

ENDIF.

ENDIF.

ENDCASE.

ENDMODULE. " EXIT_100 INPUT

Regards,

Rama Chary.P.

Former Member
0 Kudos

Hi,

In PAI define a module like

module exit at exit-command.

and use Function Module

POPUP_TO_CONFIRM

Regards,

Sathish Reddy.

Former Member
0 Kudos

whenever you hit a button with exit command a PAI module which has addition AT EXIT-COMMAND

will be executed.

in here u can give a pop-up using a function module

if user does not want to exit then just let the flow of program continue it will go to other PAI modules where u can capture data.


PROCESS BEFORE OUTPUT.
 MODULE STATUS_9000.

PROCESS AFTER INPUT.
 module check at EXIT-COMMAND. " give POPup
 MODULE USER_COMMAND_9000. " capture data

Former Member
0 Kudos

Create a cancel button with type 'E'

write code in PAI

MODULE EXIT AT EXIT-COMMAND.

under this module.

module exit.

if sy-ucomm = 'CANCEL'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = c_txt05

text_question = c_txt06

text_button_1 = 'Yes'

text_button_2 = 'No'

default_button = '1'

display_cancel_button = ' '

IMPORTING

answer = l_answer

EXCEPTIONS

OTHERS = 0.

IF l_answer = '1'.

do this.

else

do this.

endif.

ENDIF.

endmodule.

call a POP UP FM and write the code to return to the place where you want to.

Former Member
0 Kudos

Hi Sharma,

Try to use SAP memory.

First get the value to SAP memory using GET parameter.

CASE SY-UCOMM.

WHEN 'CANC'. --> Okcode for Cancel Button

Call the pop-up.

If you press 'YES' (in pop-up)

LEAVE TO SCREEN 0.

Else.

Set the value to the screen field from SAP memory.

endif.

Regards,

V Kumar

Edited by: V Kumar on Sep 2, 2008 8:29 AM

Former Member
0 Kudos

the data i am enetering in the screen is not in database its runtime data available in structure of my screen

when i call at exit command at cancel button,structure is refreshed automatically and the screen becomes blank. can u guys give some idea why this is happening.

0 Kudos

r u referencing to table control

by "structure

 
when i call at exit command at cancel button,"structure
 is refreshed automatically and the screen becomes blank. can u guys give some idea why this is happening. 

if yes then make sure that u pass the data in table control to your internal table.

0 Kudos

hello.

Did you write the code for modifying table control...then it works.

Regards,

Sathish reddy.

Former Member
0 Kudos

Hi,

In your screen painter... goto attributes of the screen and check the checkbox for hold data in attributes tab..

regards

padma