You are on page 1of 33

SAP-Field Exits

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.

Objectives
When to apply a Field Exit. Create a Field Exit.

Field Exits

Field Exits
SAP R/3
System Help

ABAP Dictionary
Field 1 Field 2

Function module

Entry

Entry

Obligatory field checks

Field format checks and checks and field transport

Foreign key checks

Creating Field Exits

Creating Field Exits


Function Builder
System Help

1 2 3 4 5 6 7

Global enhancements

Function module

FIELD_EXIT_DTEL

Create field exit

Field exit for data element ...?

Create function module

Edit function module


Function module: Interface
System Help

Activate function module

Assign program/screen (for local field exits only)

Import parameter

INPUT
Export parameter
R

Activate field exit

OUTPUT

Types of Filed Exits


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.

Global Field Exits


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.

Local Field Exits


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.

Syntax
Prefix : FIELD_EXIT_ Name : <Data element name>_ Suffix (optional) : 0 to 9, A to Z

When does it Trigger

Data Entry Check Required Fields Check Field Format Your Function Module Fires Here Foreign Keys

10

Example
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.

11

Example 1
Data element Matnr

Program : SAPLMGMM , Screen No. : 0060 Note : You can also use MM02 or MM03 transaction.
12

Example 2

Data element Matnr

Program : SAPMM03Z Screen No. : 0100


13

Creating Global Field Exits


Global Field Exits .step 1
Run the program using SE38

14

Creating a Global Field Exit step 2

Give your Data elements which you want to create a Field Exit

15

Creating a Global Field Exit 3


This will take you to SE37 transaction with a function module name by default Just say Create

16

Creating a Global Field Exit 4


Write the code and generate it And go back

17

Creating a Global Field Exit 5

Select the Data Element and say Activate

18

Creating a Global Field Exit 6

It will ask u for a transport request Just create it and say continue

19

Creating a Global Field Exit. 7

You have now created a GLOBAL FIELD EXIT

20

Check the Global Field Exit1


Run the transactions MM01, MM02, MM03 or MMAM It should not allow Material No ASD123 in the screens.

21

Check the Global Field Exit.2

We will check using transaction MM02. i.e example 1.

22

Check the Global Field Exit.3

Enter Material no ASD123 press enter

you should see an error message here

23

Creating a Local Field Exit


Creating a Local Field Exit.1
Select the Global Field Exit you have created and then select Assign prog / screen

24

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

25

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)

26

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

27

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
28

Check the Local Field Exit.1

We will check using transaction MMAM. i.e example 2.

29

Check the Local Field Exit..2

Enter Material No =300 and material type then press Enter

You should see an error message here

30

Check the Local Field Exit.3

We will check using transaction MM02. i.e example 1.

31

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
32

Thank You

33

You might also like