‎2006 Aug 08 12:59 PM
Hi all,
Actually wht is the main purpose of at exit command which is declared in pai.
‎2006 Aug 08 1:07 PM
For Example, U have only one screen and keep some mandatory fields in that screen. And if u try to press back it will show u a message 'Please enter the mandatory fields'. But if u attach that Back with EXit command and the below code it will go out that screen.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
&----
*& Module exit INPUT
&----
Exit Command
----
MODULE exit INPUT.
IF sy-ucomm EQ 'BACK' OR sy-ucomm EQ 'CANCEL' OR sy-ucomm EQ 'EXIT'.
LEAVE TO SCREEN 0.
ENDIF.
ENDMODULE. " exit INPUT
Regards,
Prakash.
‎2006 Aug 08 1:03 PM
HI,
This module work with the function keys whose function type is set to 'E'. This will be called in any situation like if some error on the screen and an error message is displayed then no other module will be called when you press enter but this will be called instead of error message showing.
The main purpose is that when some error occurs and user wants to exit from the screen then he can do it.
This is mostly used in 'BACK', 'EXIT', 'CANCEL' function keys these keys have function type 'E'.
mostly LEAVE TO SCREEN 0. code is written in this module.
Regards,
HRA
Message was edited by: HRA
‎2006 Aug 08 1:04 PM
check this , ( from SAP Library)
Calling a PAI Module for Type E Functions
When the user chooses a function with type E, the screen flow logic jumps directly to the following statement:
MODULE <mod> AT EXIT-COMMAND.
Regardless of where it occurs in the screen flow logic, this statement is executed immediately, and before the automatic checks for the field contents on the screen. Before the module <mod> is executed, the contents of the OK-CODE field are transported to the ABAP field with the same name. However, no other screen fields are transported to the program at this stage. If you have more than one MODULE statement with the AT EXIT-COMMAND addition, only the first is executed. If there are no MODULE statements with the AT EXIT-COMMAND statement, normal PAI processing resumes.
If the user chooses a function whose function code does not have type E, the MODULE <mod> AT EXIT-COMMAND statement is not executed.
PAI Modules for Type E Functions
The MODULE ... AT EXIT-COMMAND statement is normally used to leave the current screen without the automatic input checks taking place. You should therefore program it to contain an appropriate variant of the LEAVE statement, to leave the current screen, the call chain, or the entire program, as appropriate. If the module does not leave the screen, normal PAI processing resumes after it has finished, that is, the automatic field checks take place, and the normal PAI modules are called, with data being transported from the screen back to the program according to the sequence defined in the FIELDS statements.
If the user chooses Execute without filling out the obligatory fields, the automatic field check displays an error message.
If the user fills out the obligatory fields and then chooses Execute, all of the screen fields are transported to the program, and the modules EXECUTE1 and EXECUTE2 are called.
If the user chooses Cancel, the OK_CODE field is transported and the CANCEL module is called, regardless of whether the user filled out the obligatory fields. The CANCEL module terminates the program.
If the user chooses Back, the OK_CODE field is transported and the CANCEL module is called, regardless of whether the user filled out the obligatory fields. However, the program does not terminate, since the function code is BACK. Instead, the automatic field checks are performed. If the obligatory fields are filled, the modules EXECUTE1 and EXECUTE2 are called.
The BACK module is never called, since only the first module with the AT EXIT-COMMAND addition is ever called. In the above example, the function code BACK should be processed in the CANCEL module. Then, since there is only one module statement with the AT EXIT-COMMAND addition, the position of the statement is irrelevant.
Message was edited by: Srikanth Kidambi
‎2006 Aug 08 1:07 PM
For Example, U have only one screen and keep some mandatory fields in that screen. And if u try to press back it will show u a message 'Please enter the mandatory fields'. But if u attach that Back with EXit command and the below code it will go out that screen.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
&----
*& Module exit INPUT
&----
Exit Command
----
MODULE exit INPUT.
IF sy-ucomm EQ 'BACK' OR sy-ucomm EQ 'CANCEL' OR sy-ucomm EQ 'EXIT'.
LEAVE TO SCREEN 0.
ENDIF.
ENDMODULE. " exit INPUT
Regards,
Prakash.
‎2006 Aug 08 1:19 PM
Hi,
even if you have Mandatory or Obligatory input fields , it will make you come out of it.
Check this Demo program
demo_dynpro_at_exit_command
Regards
vijay
‎2006 Aug 08 1:23 PM
chk this help
... AT EXIT-COMMAND
Effect
The module is only processed if the user enters a command beginning with "/E" in the command field, or chooses a function type E (assigned in the function list in the Menu Painter).
This addition is also valid for standalone MODULE statements without field assignment.
AT EXIT-COMMAND is only allowed in the PROCESS AFTER INPUT event. A module with this addition is processed before the automatic input checks and before all other PAI modules.
<b>Calling a PAI Module for Type E Functions</b>
When the user chooses a function with type E, the screen flow logic jumps directly to the following statement:
MODULE <mod> AT EXIT-COMMAND.
Regardless of where it occurs in the screen flow logic, this statement is executed immediately, and before the automatic checks for the field contents on the screen. Before the module <mod> is executed, the contents of the OK-CODE field are transported to the ABAP field with the same name. However, no other screen fields are transported to the program at this stage. If you have more than one MODULE statement with the AT EXIT-COMMAND addition, only the first is executed. If there are no MODULE statements with the AT EXIT-COMMAND statement, normal PAI processing resumes.
If the user chooses a function whose function code does not have type E, the MODULE <mod> AT EXIT-COMMAND statement is not executed.
<b>PAI Modules for Type E Functions</b>
The MODULE ... AT EXIT-COMMAND statement is normally used to leave the current screen without the automatic input checks taking place. You should therefore program it to contain an appropriate variant of the LEAVE statement, to leave the current screen, the call chain, or the entire program, as appropriate. If the module does not leave the screen, normal PAI processing resumes after it has finished, that is, the automatic field checks take place, and the normal PAI modules are called, with data being transported from the screen back to the program according to the sequence defined in the FIELDS statements.
Message was edited by: Chandrasekhar Jagarlamudi
‎2006 Aug 08 3:08 PM
Hi
When the user chooses a function with type E, the screen flow logic jumps directly to the following statement:
MODULE mod AT EXIT-COMMAND.
Regardless of where it occurs in the screen flow logic, this statement is executed immediately,
and before the automatic checks for the field contents on the screen.
Before the module mod is executed, only the contents of the OK code field are transported
to the ABAP field with the same name. However, no other screen fields are transported.
If you have more than one MODULE statement with the AT EXIT-COMMANDaddition,
only the first is executed.
If there are no MODULE statements with the AT EXIT-COMMAND statement,
normal PAI processing resumes.
If the user chooses a function whose function code does not have type E,
the MODULE <mod> AT EXIT-COMMAND statement is not executed.
Modules for Type E Function Codes
The MODULE... AT EXIT-COMMANDstatement is normally used to leave the current screen without
the automatic input checks taking place. You should therefore program it to contain an
appropriate variant of the LEAVE statement, to leave the current screen, the call chain,
or the entire program, as appropriate. If the module does not leave the screen, normal PAI
processing resumes after it has finished that is, the automatic field checks take place,
and the normal PAI modules are called, with data being transported from the screen back to
the program according to the sequence defined in the FIELDS statements.
Reward points if helpful.
Regards,
Swathi.
‎2006 Aug 08 3:15 PM
Hi,
When the user chooses a function with type E, the screen flow logic jumps directly to the following statement:
MODULE <mod> AT EXIT-COMMAND.
Regardless of where it occurs in the screen flow logic, this statement is executed immediately, and before the automatic checks for the field contents on the screen. Before the module <mod> is executed, the contents of the OK-CODE field are transported to the ABAP field with the same name. However, no other screen fields are transported to the program at this stage. If you have more than one MODULE statement with the AT EXIT-COMMAND addition, only the first is executed. If there are no MODULE statements with the AT EXIT-COMMAND statement, normal PAI processing resumes.
If the user chooses a function whose function code does not have type E, the MODULE <mod> AT EXIT-COMMAND statement is not executed.
Also chk this link:
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa9535c111d1829f0000e829fbfe/content.htm
regards,
keerthi.