SAP ABAP : Using the field exit
August 4, 2007
If you are already in the transaction that need to be enhanced and already determined which fields that need to be enhanced (retrieved the value, validate the value, or export the value after validation or calculation to the system), check the “Data Element” (by click F1 for the ‘Help’ and then F9 for the technical info) of the field, including the “Program Name” and the “Screen Number” (On the top of the sub screen of Technical Information ‘Screen Data’).
1. Go to the transaction “CMOD” à ‘Go to’ à ‘Text Enhancement’ à ‘Field Exits’
2. If the field exits not yet assigned with the respected “Data Element”, Create the field exits , go to the ‘Field Exit’ à ‘Create’ .
3. The pop up window will generated, and required ‘ Data Element’ then click ‘Continue’.
4. The system will automatically goes to the transaction SE37 (Function Builder) in the default Field_Exit_.
5. Before creating the Field_Exit Function, we must create the Function Group first by go to ‘Go to’ à ‘Function Groups’ à ‘Create Group’ à fill in the ‘Function Groups’ name that we want to create and the short text as well. After creating the function groups we can continue the process to create the Field_Exit function. And also we define the Development class when we save it. P.s. Once we created the ‘Function groups’, the SAP will automatically generate the specific Function-Pool for the specified function groups.
6. Field_Exit_, then click ‘Create’ à assign the ‘Function Groups’ à and also the ‘Application’ . Check also the tabs for ‘Import’ , ‘Export’ , ‘Changing’ , ‘Tables’ , ‘Exceptions’ and ‘Source Code’. Got to the ‘Source Code’ for coding purposes.
Example: (For data element BISMT)
FUNCTION FIELD_EXIT_BISMT.
*”———————————————————————-
*”*”Local interface:
*” IMPORTING
*” REFERENCE(INPUT)
*” EXPORTING
*” REFERENCE(OUTPUT)
*”———————————————————————-
ENDFUNCTION.
p.s. Compared to the User Exit, the Importing and Exporting Value declared as Input and Output.
7. If we want to assign the global data (this global data can be used by all the Field_Exit Function assigned to the same ‘Function Groups’ ). This will do by go to ‘Go to’ à ‘Global Data’. Because of having the specific Function-Pool, the global data declared here, will not mesh up with the other functions assign to different Function-Groups.
8. After coding, activate the function. And back again to the transaction CMOD.
9. The Field Exit will be assigned but still in ‘Inactive’ status and ‘Global’ program
10. To make it useful for the specified transaction (program name and the screen number of the destination field), we have to assign the function by giving the ‘Check’ , and click ‘Assign prog./.screen’ , assign the ‘Program Name’ and the ‘Screen number’ and press ‘ENTER’. Then activate.
11. If we want to assign the field exit function into more than one different program name and the screen number, choose the field exits by giving the ‘Check’ to the left box , and click ‘Assign prog./.screen’ à click ‘Insert Line / F5’ à and assign the field ‘Fld. Exit’ , ‘Program Name’ and the ‘Screen Number’ . The field ‘Fld. Exit’, will be filled by the number and we must create another name of the Field_Exit Function with the default Field_Exit__, example: Field_Exit_BISMT_0, Field_Exit_BISMT_1, and so on in transaction SE37 (Function Builder).
12. If we want to edit the existing Field_Exit Function, choose the desired function and click ‘Edit FM / F7’. Don’t forget to activate after did the change the program in the function.
12. After this we can test it whether the requirement is already fulfilled or not.
Entry Filed under: TECHNICAL. Tags: ABAP, Field Exit, sap, SAP ABAP.
Trackback this post | Subscribe to the comments via RSS Feed