field exits
TRANSCRIPT
1
SAP-Field Exits
2
Definition – Field Exits
• Field exits are branches from a screen field with a data element reference into a function module. Field exits can be selected globally or selectively.
3
• When to apply a Field Exit.• Create a Field Exit.
Objectives
4
Field Exits
Field Exits
EntryEntry
Function module
Obligatoryfield checks
checks andField formatchecks and
field transportForeign
key checks
System Help
SAP R/3 SAP R/3
Field 1
Field 2
ABAP Dictionary
5
Creating Field Exits
R
Creating Field Exits
Global enhancements 1 1
Create field exit 2 2
Create function module 4 4
Field exit for data element ...? 3 3
Activate function module 6 6
Assign program/screen (for local field exits only)
7 7
Activate field exit 8 8
Edit function module 5 5
System Help
Function Builder Function Builder
FIELD_EXIT_DTEL
Function module
System Help
Function module: Function module: Interface Interface
INPUT
Import parameter
OUTPUT
Export parameter
6
Field Exits are branches from a screen field with data
element reference in a function module.
They are of 2 types – Global Field Exits– Local Field Exits.
Types of Filed Exits
7
• Global Field Exits are not limited to one screen. If you use the data element on multiple screens, you will branch to a function module from all these screens once the exit is activated.
Global Field Exits
8
• Local field exits are valid for one screen only. If you assign the screen of a specific program to the data element, then you will branch to a function module only from this screen after activation.
Local Field Exits
9
• Prefix : FIELD_EXIT_• Name : <Data element name>_• Suffix (optional) : 0 to 9, A to Z
Syntax
10
Data Entry
Check Required Fields
Check Field Format
Your Function Module Fires Here
Foreign Keys
When does it Trigger
11
• We will create a field exit for data element ‘MATNR’.
• We will create a ‘Global Field Exit’. In which we will restrict users from entering a Material No ASD123.
• In the second instance we will create a ‘Local Field Exit’ so that it triggers only when the material no is 300 and check it using examples 1 & 2. And the filed exit should fire only in the second example.
Example
12
Data element Matnr
Program : SAPLMGMM , Screen No. : 0060
Note : You can also use ‘MM02’ or ‘MM03’ transaction.
Example 1
13
Data element Matnr
Program : SAPMM03Z
Screen No. : 0100
Example 2
14
Creating Global Field Exits
• Global Field Exits ….step 1
Run the program using SE38
15
Creating a Global Field Exit… step 2
Give your Data elements which you want to create a Field Exit
16
Creating a Global Field Exit… 3
This will take you to SE37 transaction with a function module name by default
Just say Create
17
Creating a Global Field Exit… 4
Write the code and generate it
And go back
18
Creating a Global Field Exit… 5
Select the Data Element and say Activate
19
Creating a Global Field Exit… 6
It will ask u for a
transport request
Just create it and say continue
20
Creating a Global Field Exit…. 7
You have now created
a
GLOBAL FIELD EXIT
21
Check the Global Field Exit…1
• Run the transactions ‘MM01’, ‘MM02’, ‘MM03’ or ‘MMAM’
It should not allow Material No ASD123 in the screens.
22
Check the Global Field Exit…….2
We will check using transaction ‘MM02’.
i.e example 1.
23
Check the Global Field Exit…….3
Enter Material no ASD123 press enter
you should see an error message here
24
Creating a Local Field Exit
Select the Global Field
Exit you have created and then select
Assign prog / screen
Creating a Local Field Exit…….1
25
Creating a Local Field Exit…….2
YOU GET A POPUP SCREEN
Enter the <Screen name> <screen no> and <fld.exit> that is
from A to Z or 0-9
And say continue
26
Creating a Local Field Exit…….3
It will take you to the se37 screen with default function module name
Just say create
(this will not appear if the function mod already exists)
27
Creating a Local Field Exit…….4
Write the code activate it.
Then go back to field exit screen.You will be asked for
a Transport Request just create the request and say
continue
28
Creating a Local Field Exit…….5
You will see the program name and screen number appearing in the same line as the data element
Just select it and say activate
Your Local Field exit is complete
29
Check the Local Field Exit…….1
We will check using transaction ‘MMAM’.
i.e example 2.
30
Check the Local Field Exit……..2
Enter Material No =300 and material type then press Enter
You should see an error message here
31
Check the Local Field Exit…….3
We will check using transaction ‘MM02’.
i.e example 1.
32
Check the Local Field Exit…….4
Enter Material No 300 and press Enter
If the material is already created it show that material details or a error message other than the error message we have given should be shown here
33
Thank You