Introduction
A field exit is an old enhancement technology linked to a screen input field (only dynpro technology is supported) which executes custom ABAP code, that is allowed to:
- change the value of the field
- trigger an error message on that field
A field exit applies to a given data element and a given dynpro or all dynpros, and is active for all clients.
It is called just after the user has pressed a key (see below how it works).
It calls a function module with a special name that needs to be registered via program RSMODPRF (see below how to implement).
Field exit technology is deactivated by default since NetWeaver 6.10 and is obsolete since SAP Basis 4.6a.
More information can be found here:
- FAQs: field exits (restrictions, etc.)
- SAP Library 4.5b - Field Exits for Data Elements
- SAP Library 4.5b - Using Field Exits
How it works
- The field exits cannot be called in releases 6.10 (and after) if the "abap/fieldexit" profile parameter is set to 0
- Here are the moments where the field exits are called:
- The user presses Enter, a function key or click a button
- Conversion of input field from external to internal format
- CALL OF FIELD EXITS on input-capable fields which are NOT part of a step-loop
- Call PAI modules placed before the step-loop
- STEP-LOOP
- CALL OF FIELD EXITS on input-capable fields which are part of the step-loop
- Call PAI modules placed inside the step-loop
- Call PAI modules placed after the step-loop
- Restrictions:
- If the PAI contains a "FIELD <field name> MODULE <module name> ON REQUEST" about an input field which has also a field exit, and only the field exit changes the value, then the module is not called
- If the relationship between the field and the DDIC is deactivated, the field exit is not called
Implementing a field exit
- In releases 6.10 and after, the "abap/fieldexit" profile parameter must be changed from 0 to 1 (transaction RZ10 or RZ11), and the system must be restarted so that to take this change into account
- Cross-client customizing must be allowed in the client where development is done
- First, you must get some information about the field for which you want to execute a field exit
- Display screen where you need to add an exit to a field, press F1 and display technical information, write down data element name + dynpro/program name
- Note: if 2 dynpro numbers are displayed, use the one at the top (for information: this happens when the field belongs to a "subscreen"; the top dynpro number is the subscreen number, while the bottom number is the main screen number, used for batch input)
- Run transaction SE38, execute program RSMODPRF
- Enter the data element of the field to be enhanced. Note: if you just want to display all existing field exits, leave the data element field blank.
- It then displays a screen with function module FIELD_EXIT_<data_element>. Note: you may change the name by adding a 1 character or 1 digit suffix, like this: FIELD_EXIT_<data element>[_<one digit or one letter>]
- Press Create
- You must assign this function module to a function group and to a package of the customer namespace (most common is to have Y or Z as the first character)
- This function module must have "INPUT" importing parameter, and "OUTPUT" changing parameter, both without type
- OUTPUT is received with the same value as INPUT
- You may change the OUTPUT parameter or send an error message which interrupts the dynpro logic
- Go back to RSMODPRF selection screen, let selection screen input fields blank, EXECUTE IT, then your field exit is displayed (and all the others).
- Check box of your field exit, You have the option to assign it to a particular dynpro (combination dynpro/data element). Default screen name is "GLOBAL" (valid for all dynpros).
- Check box of your field exit, and select menu Fieldexit | Activate. Note: You have to enter a workbench transport request (object of type R3TR XDYN)
- It's done. Be careful when you have several application servers.
- After transport of the field exit in a target system, you must call program RSMODFDG in the target system (any client) to activate the field exit
Miscellaneous
- If several fields have the same data element in the same dynpro, the field exit will apply to all of them
- Break-points are ignored in field exits with the classic debugger (but it works with the new debugger)
- If you execute the following ABAP statements during the field exit, the program will dump: CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT, MESSAGE W... and MESSAGE I..., COMMIT WORK, ROLLBACK WORK, COMMUNICATION RECEIVE, STOP, REJECT, EXIT FROM STEP-LOOP.
1 Comment
Former Member
very helpful...