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: 

Field Exit

Former Member
0 Kudos
751

How to do Field Exit?

Explain in detail with example?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
492

Hi,

http://www.erpgenie.com/abap/fieldexits.htm

http://www.sap-basis-abap.com/sapab014.htm

V4.6c onwards no longer supports field exits!!! In any case here's how to activate them:

Activation of the field exits and assignment of the dynpros is carried out using program RSMODPRF. For this purpose, the program must be started without parameters (input fields remain blank). If required, new field exits can be created using program RSMODPRF (see below for documentation).

Field Exits for Data Elements

Description

Maintenance transaction for creating and activating field exits

As part of the extension concept, SAP allows you to install a field exit for each screen field. Similar to the conversion exit, the system branches at the field exit at DCI (DATA COMMUNICATIONS INPUT) to a function module, if the field is an input field and a function code was triggered. The function module must adhere to the following naming convention:

Prefix: FIELD_EXIT_

Infix: <Data element name>

Suffix: _0 to _9 (optional), _A to _Z

The interface is automatically generated during the creation of the function module, and has 2 parameters:

Import parameter: INPUT

Export parameter: OUTPUT

After a function code has been triggered the contents of the field are made available to the FB via the "INPUT" import parameter. You can edit this and, when changed, make it available to the ABAP/4 processor in "OUTPUT". The input field contents are usually passed on: you can simply write OUTPUT = INPUT.

If, e.g., you have activated the field exit for the data element 'PROGRAM', then the fields of all the screens, which refer to the data element 'PROGRAM', branch to the function module FIELD_EXIT_PROGRAM. This includes the field 'Program' of the initial screen SAPMS38M0100 in transaction SE38, for example.

If you do not want the function module to be accessed from all screens, assign particular screens to the data element PROGRAM. By allocating an exit number, it is also possible to branch to other function modules with the corresponding suffix _0 ... _Z.

Example: You have assigned screen SAPMS38M0100 and exit number 5 to data element 'PROGRAM'. The corresponding field on SAPMS38M0100 branches to FIELD_EXIT_PROGRAMM_5.

As soon as you activate an exit, the corresponding screens are invalidated.

Note: Field exits are only taken into account during screen generation if the parameter abap/fieldexit = 'YES' is set in the system profile.

Requirement

Set the profile parameter abap/fieldexit = 'YES' before system start.

Limitations

The following ABAP statements are not allowed in the function modules of field exits:

BREAK-POINT,

CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT,

COMMIT WORK, ROLLBACK WORK,

COMMUNICATION RECEIVE,

EXIT FROM STEP-LOOP,

MESSAGE I, MESSAGE W.

Note:

Field exits cannot be edited with the debugger.

You should not use any external Performs in field exits. The ABAP processor shares the table work areas of externally called programs with those of the first caller. This could lead to errors at field exits that can hardly be analyzed, as field exits are sometimes slipped into the flow of the program at unforeseen events.

Questions and answers on field exits

1. A field exit was created with the CMOD and activated, but it does not get executed when the screen is called.

Since the field exit is not executed until DCI, some action must occur in the screen (e.g. press Return, saving....).

Set the abap/fieldexit profile parameter to YES and start the system again.

After the FIELD_EXIT... function module has been activated and the field exit has been activated, the transaction in whose screen the field exit is to be executed must be terminated. The screen is not generated until it is called.

Do not work on different application servers, otherwise there may be a delay before the field exit becomes active.

The profile parameter must be set either on all application servers or on none.

If the field exit is to be active in certain screens only, then you should check whether you have selected the correct program and the correct screen number (Careful with SUBSCREENS Do not rely on the F1 information for the field!

2. How does setting abap/fieldexit affect the performance?

If a screen is generated and the profile parameter is set, then the system checks in 2 tables (TDDIR, TDDIRS) to see whether a field exit has to be generated for the field. In practice the screen load after a Put is not generated until the screen is called. The user will not experience a noticeable delay, since screen generation is extremely fast.

3. Can the contents of other screen fields be read in a field exit?

In principle all fields can be copied to global variables in the TOP or the function group. However, since the order in which the field exits are called is not guaranteed, this possibility should not be used.

4. How does the field exit work in step-loop fields?

After data input to DCI the field exit will be called as many times as fields are visible on the step-loop. The SY-STEPL system variable is incremented each time. If a new value is assigned to be field, then it will be visible in the module between LOOP. ENDLOOP. This module will also be called as many times as there are visible step-loop lines.

5. Can field exits be debugged?

No. Field exits have to be tested in isolation in the development environment. To analyze problems that occur only in the screen environment, the relevant variables can be written to the file system using TRANSFER... and can be analyzed there.

6. What should one do if the field contents are not getting transported to ABAP/4?

Check whether you have assigned a value to the OUTPUT field.

7. When does the field exit get called in the case that there is a conversion exit attached to the data element?

The field exit will be called after the conversion exit. This means that the INPUT field contains the data in the same form as that in which the ABAP/4 program also gets them

Regards,

Srilatha.

3 REPLIES 3

Former Member
0 Kudos
493

Hi,

http://www.erpgenie.com/abap/fieldexits.htm

http://www.sap-basis-abap.com/sapab014.htm

V4.6c onwards no longer supports field exits!!! In any case here's how to activate them:

Activation of the field exits and assignment of the dynpros is carried out using program RSMODPRF. For this purpose, the program must be started without parameters (input fields remain blank). If required, new field exits can be created using program RSMODPRF (see below for documentation).

Field Exits for Data Elements

Description

Maintenance transaction for creating and activating field exits

As part of the extension concept, SAP allows you to install a field exit for each screen field. Similar to the conversion exit, the system branches at the field exit at DCI (DATA COMMUNICATIONS INPUT) to a function module, if the field is an input field and a function code was triggered. The function module must adhere to the following naming convention:

Prefix: FIELD_EXIT_

Infix: <Data element name>

Suffix: _0 to _9 (optional), _A to _Z

The interface is automatically generated during the creation of the function module, and has 2 parameters:

Import parameter: INPUT

Export parameter: OUTPUT

After a function code has been triggered the contents of the field are made available to the FB via the "INPUT" import parameter. You can edit this and, when changed, make it available to the ABAP/4 processor in "OUTPUT". The input field contents are usually passed on: you can simply write OUTPUT = INPUT.

If, e.g., you have activated the field exit for the data element 'PROGRAM', then the fields of all the screens, which refer to the data element 'PROGRAM', branch to the function module FIELD_EXIT_PROGRAM. This includes the field 'Program' of the initial screen SAPMS38M0100 in transaction SE38, for example.

If you do not want the function module to be accessed from all screens, assign particular screens to the data element PROGRAM. By allocating an exit number, it is also possible to branch to other function modules with the corresponding suffix _0 ... _Z.

Example: You have assigned screen SAPMS38M0100 and exit number 5 to data element 'PROGRAM'. The corresponding field on SAPMS38M0100 branches to FIELD_EXIT_PROGRAMM_5.

As soon as you activate an exit, the corresponding screens are invalidated.

Note: Field exits are only taken into account during screen generation if the parameter abap/fieldexit = 'YES' is set in the system profile.

Requirement

Set the profile parameter abap/fieldexit = 'YES' before system start.

Limitations

The following ABAP statements are not allowed in the function modules of field exits:

BREAK-POINT,

CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT,

COMMIT WORK, ROLLBACK WORK,

COMMUNICATION RECEIVE,

EXIT FROM STEP-LOOP,

MESSAGE I, MESSAGE W.

Note:

Field exits cannot be edited with the debugger.

You should not use any external Performs in field exits. The ABAP processor shares the table work areas of externally called programs with those of the first caller. This could lead to errors at field exits that can hardly be analyzed, as field exits are sometimes slipped into the flow of the program at unforeseen events.

Questions and answers on field exits

1. A field exit was created with the CMOD and activated, but it does not get executed when the screen is called.

Since the field exit is not executed until DCI, some action must occur in the screen (e.g. press Return, saving....).

Set the abap/fieldexit profile parameter to YES and start the system again.

After the FIELD_EXIT... function module has been activated and the field exit has been activated, the transaction in whose screen the field exit is to be executed must be terminated. The screen is not generated until it is called.

Do not work on different application servers, otherwise there may be a delay before the field exit becomes active.

The profile parameter must be set either on all application servers or on none.

If the field exit is to be active in certain screens only, then you should check whether you have selected the correct program and the correct screen number (Careful with SUBSCREENS Do not rely on the F1 information for the field!

2. How does setting abap/fieldexit affect the performance?

If a screen is generated and the profile parameter is set, then the system checks in 2 tables (TDDIR, TDDIRS) to see whether a field exit has to be generated for the field. In practice the screen load after a Put is not generated until the screen is called. The user will not experience a noticeable delay, since screen generation is extremely fast.

3. Can the contents of other screen fields be read in a field exit?

In principle all fields can be copied to global variables in the TOP or the function group. However, since the order in which the field exits are called is not guaranteed, this possibility should not be used.

4. How does the field exit work in step-loop fields?

After data input to DCI the field exit will be called as many times as fields are visible on the step-loop. The SY-STEPL system variable is incremented each time. If a new value is assigned to be field, then it will be visible in the module between LOOP. ENDLOOP. This module will also be called as many times as there are visible step-loop lines.

5. Can field exits be debugged?

No. Field exits have to be tested in isolation in the development environment. To analyze problems that occur only in the screen environment, the relevant variables can be written to the file system using TRANSFER... and can be analyzed there.

6. What should one do if the field contents are not getting transported to ABAP/4?

Check whether you have assigned a value to the OUTPUT field.

7. When does the field exit get called in the case that there is a conversion exit attached to the data element?

The field exit will be called after the conversion exit. This means that the INPUT field contains the data in the same form as that in which the ABAP/4 program also gets them

Regards,

Srilatha.

Former Member
0 Kudos
492

Hi Pon,

For this example I am using dta element 'EBELN' from table EKKO.

Step 1: Execute program ‘RSMODPRF’, entering the data element of the field

Step 2: Create function module when prompted, and add you code to the source section using the parameter 'INPUT’ as the field value you are checking.

Step 3: Save and activate Function and execute transaction ‘CMOD’.

Step 4: Choose option: Goto-> Text Enhancements->Data elements->New DE cust docu.

Step 5: Enter data element

Step 6: Save and activate

Step 7: Execute program ‘RSMODPRF’ again but this time leave data element field blank.

Step 8: Select the checkbox for the data element you have just created and choose option: Field exit->Activate

This will now be active for all instances of this data element, but you can assign specific program and screen

combinations by pressing the ‘Assign prog./screen’ button. You can also change the code you entered in the field

exit function module by pressing the ‘Edit FM’ button.

<b>Maintenance transaction for creating and activating field exits</b>

As part of the extension concept, SAP allows you to install a field exit for each screen field. Similar to the conversion exit, the system branches at the field exit at DCI (DATA COMMUNICATIONS INPUT) to a function module, if the field is an input field and a function code was triggered. The function module must adhere to the following naming convention:

Prefix: FIELD_EXIT_

Infix: <Data element name>

Suffix: _0 to _9 (optional), _A to _Z

The interface is automatically generated during the creation of the function module, and has 2 parameters:

Import parameter: INPUT

Export parameter: OUTPUT

After a function code has been triggered the contents of the field are made available to the FB via the "INPUT" import parameter. You can edit this and, when changed, make it available to the ABAP/4 processor in "OUTPUT". The input field contents are usually passed on: you can simply write OUTPUT = INPUT.

Reward pts if found usefull

Regards

Sathish

Former Member
0 Kudos
492

Go that main program of the VA01 and do the Global search for FIELD_EXIT, then you come to know the field exits

-


Field exits are for data elements.

We can do validations on filed data elements.

Pl.indicate on which field in VA01 transaction , you want to do validations.

There are two types of field exits 1. Global 2. Local

Pl.refer following links for further info.

sap.niraj.tripod.com/id21.html

www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

-


Goto CMOD transaction.In that enter prfb in the command field directly.you will get the list of field exist available and you find out the status and for which screen and tcode it is implemented.

Reward points if it is helpful.

Regards,

Abhay.......