For this example I am using data element 'EBELN' from table EKKO.
Update: please note
that in SAP release 6.10 and later you need to set the profile parameter "abap/fieldexit" to 1 (via tcode RZ10 or RZ11).
System must then be restarted for any change to this parameter to take effect.
Step 1:
Execute program 'RSMODPRF', entering the data element of the field
Step 2:
Create function module when prompted, and add your 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. If you get the
message 'System is not configured for field exits' then you need to set the system profile parameter "abap/fieldexit" to 1
and restart your SAP system.
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.