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: 

help pls

Former Member
0 Kudos

1. what is the use of AT EXIT command in module pool.....

2. what will happen when we select FCT type as E for a function code

4 REPLIES 4

Former Member
0 Kudos

at exit used for .

back ,cancel, exit.

pf status u set properties exit coommand.

Calling Modules Unconditionally

In the PAI event, the PAI modules are called in the sequence in which they occur in the screen flow logic, after the automatic field checks. This means that the input on the screen must satisfy the automatic checks before the first module can be called. In particular, all required fields must be filled, and any checks against value lists or check tables defined for the field in the ABAP Dictionary must be successful.

In some cases, the user may have to enter a considerable amount of data merely in order to be able to leave the screen. To prevent this, special function codes can be combined with a special module call. The corresponding module is called independently of the user inputs.

Type E Function Codes

The function codes for screens and the GUI status can be given type E. For this purpose, set the Function type attribute in the Screen Painter to E for the screen elements of the screen concerned.. For GUI status functions, choose Goto ® Object Lists ® Function list in the Menu Painter, select the required function codes, and enter E for the FunctionType.

If the user chooses a screen element or a user interface element with a function code of type E, the system bypasses the automatic field checks and calls a special module in the screen flow logic. If the special module call does not exist, the system resumes normal PAI processing, that is, the automatic field checks take place after all.

As a rule, type E functions should allow the user to leave the screen. Consequently, the function codes for (F3), ), (Shift+F3), and (F12) in the toolbar for the GUI status usually have type E.

Calling a Module for Type E Function Codes

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

Unconditional module call

PROGRAM demo_dynpro_at_exit_command.

DATA: ok_code TYPE sy-ucomm,

save_ok LIKE ok_code,

input1(20) TYPE c, input2(20) TYPE c.

CALL SCREEN 100.

MODULE init_screen_0100 OUTPUT.

SET PF-STATUS 'STATUS_100'.

ENDMODULE.

MODULE cancel INPUT.

MESSAGE i888(sabapdocu) WITH text-001 ok_code input1 input2.

IF ok_code = 'CANCEL'.

CLEAR ok_code.

LEAVE PROGRAM.

ENDIF.

ENDMODULE.

MODULE back INPUT.

MESSAGE i888(sabapdocu) WITH text-002 ok_code input1 input2.

IF ok_code = 'BACK' OR ok_code = 'EXIT'.

CLEAR: ok_code, input1, input2.

LEAVE TO SCREEN 100.

ENDIF.

ENDMODULE.

MODULE execute1 INPUT.

MESSAGE i888(sabapdocu) WITH text-003 ok_code input1 input2.

save_ok = ok_code.

CLEAR ok_code.

ENDMODULE.

MODULE execute2 INPUT.

MESSAGE i888(sabapdocu) WITH text-004 ok_code input1 input2.

IF save_ok = 'EXECUTE'.

MESSAGE s888(sabapdocu) WITH text-005.

ENDIF.

ENDMODULE.

The next screen (statically defined) for screen 100 is 100. It has the following layout:

The screen fields input1 to input2 are assigned to the input fields. The input fields are marked in their attributes as required fields. The function codes of the pushbuttons are EXECUTE and CANCEL. CANCEL has function type E.

In the GUI status STATUS_100, the back (F3) and cancel (F12) icons are activated with the function codes BACK and CANCEL respectively. Both have function type E. Function key F8 is still assigned to the EXECUTE function code. EXECUTE does not have function type E.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE init_screen_0100.

PROCESS AFTER INPUT.

MODULE execute1.

MODULE cancel AT EXIT-COMMAND.

MODULE back AT EXIT-COMMAND.

MODULE execute2.

The program uses information and status messages to show which modules are called following user interaction and which data is transported.

· 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 program is exited at this point.

· 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. Two module calls with AT EXIT-COMMAND do not make any sense in the screen flow logic. In the above example, the function code BACK should also be processed in the cancel module. Then the position of the module statement with AT EXIT-COMMAND is irrelevant.

Message was edited by:

Karthikeyan Pandurangan

Former Member
0 Kudos

Naresh,

Use F1 help button on Module Keyword

Regards,

Satish

mahaboob_pathan
Contributor
0 Kudos

Hi,

When you create functions, you define a function code and a name. When a user chooses a function, the system stores the function code in the SY-UCOMM field. The code tells the system which function a user chose.

You can also assign a type to your functions. Function types can, for example, tell the system when or how to carry out a function. The system uses the following function types:

Type

Meaning

Normal function code processing (for example, in a PAI module).

E

Triggers an "at exit-command" module in the Process After Input (PAI) processing block (MODULE <xxx> AT EXIT-COMMAND). When the user selects an E type function, the system enters the "at exit-command" module before carrying out any input checks.

T

Calls another transaction. Activating a T type function has the same effect as the LEAVE TO TRANSACTION statement. The user cannot return to the original transaction.

S

Triggers system functions used internally in SAP standard applications. You should not use type 'S' when creating your own functions.

P

Triggers a function defined locally at the GUI. This function is not passed back to the ABAP program (no SY-UCOMM or OK_CODE). Instead, it is processed at the presentation server. This type of function can only currently be used for tabstrip controls (Screen Painter).

Assigning Function Types

To assign function types:

Double-click a function in the GUI status.

The Function Attributes dialog box appears, which displays an overview of all of the function attributes.

Choose a function type in the Function type field.

Choose ENTER to continue.

Former Member
0 Kudos

hi,

Think one case...

U want to make some fields mandatory (means input required).

When u make some fields like this ( Input Required ), and if u want to go out of this screen without giving input in that,Back,up,cancel will not work. It will give error like <b>plase make entry in all require field</b>.

To come from this u need to give FCT type as E to any button of toolbar.

Suppose u give cancel button's FCT type as E.

and make one module in PAI.

MODULE exit_0100 AT EXIT-COMMAND.

<b>MODULE exit_0100 INPUT.</b>

LEAVE PROGRAM.

<b>ENDMODULE. " exit_0100 INPUT</b>

by this u can com out of screen by pressing cancel even if u dont give input to input required field

reward if useful....