Application Development and Automation 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: 
Read only

module pool

Former Member
0 Likes
943

Hi all,

Actually wht is the main purpose of at exit command which is declared in pai.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
885

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.

7 REPLIES 7
Read only

dani_mn
Active Contributor
0 Likes
885

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

Read only

Former Member
0 Likes
885

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

Read only

Former Member
0 Likes
886

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.

Read only

Former Member
0 Likes
885

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

Read only

Former Member
0 Likes
885

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

Read only

Former Member
0 Likes
885

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.

Read only

Former Member
0 Likes
885

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.