You are on page 1of 69

SAP

ENHANCEMENTS

-Bhavannarayana .S
1
Enhancements
1. User Exits
2. Customer Exits
2.1 Menu
2.2 Screen
2.3Field
3. Badi(Business Add Ins)
3.1Classical
3.2 kernel
4. Implicit / Explicit Enhancement
5. BTE(Business Transaction Events)

2
User Exits
• User Exits are called as modifications not enhancements as we are
modifying the standard programs.
• We need access key to change the standard programs using user exits.
As soon as we click on change button of standard programs it will
ask for access key.
• In User Exits, We will write the code inside of Form-End forms.
• The data is available globally as it is a global program.

Note: Ex, we have standard programs/includes like MV45AFZZ


( V1, Sales order)
MV50AFZ1 ( V2, Delivery)
RV60AFZZ ( V3, Billing )

3
User Exits Continued…

We will be required access key as above. Once we get access key from SAP
Market Place, SAP will not support us further on this Object.

4
Customer Exits
• These are enhancements where we don’t require access key

• We have to create project in CMOD to implement customer exits.


Relationship between exist and Project is On-to-One. I.e we can
create only one project to an Exit.

• We will write the code in Function modules

• We will see an example for customer exits in below slide.

5
Customer Exits Continued..
• My requirement is to validate a customer at time of Save with Country
Filter. The below is the one of process to find out the suitable Exit for this
requirement.
• First we need to find the package of the Tcode XD01(Cust. Creation).
• Go to the program for XD01->GOTO->Attributes. Here package is “VS”.
We have a TCode to find out the exit: SMOD, click on F4

6
Customer Exits Continued..
• We have only one exit SAPMF02D.
• Once We get the exit, we have to implement it in CMOD
by creating a Project.

7
Customer Exits Continued..
Click on Enhancement assignments and give your Exit name there.

Click on Components. Click on function exit


“EXIT_SAPMF02D_001”, You will find a custom include in it. Write
the code inside of it.
8
Customer Exits Continued..
“I_KNA1” is the parameter of
the FM.

Once we are done with code, Activate the project as below.

9
Customer Exits Continued..

Go to XD01 and create a


customer with country ‘IN’.

10
Customer Exits Continued..

We can see a popup Note@ 1. We can get exits


with our code. using in another way using
SE84 as below.

11
Menu Exit
Menu exit is nothing but adding an item in the menu bar. We will see
an example below.
I would like to add an item in the menu of SE38.

12
Menu Exit Continued…

Click on GUI Status.

13
Menu Exit Continued…

If we have “+CUS” in any one of the menu bar items, only then we can
create menu exit.
Now get the package and then proper exit to implement the Menu exit.

14
Menu Exit Continued…

Now go to SMOD and find the exit name.

15
Menu Exit Continued…
Now we get 2 exits, among them
We will set and create the project
with the proper one.

16
Menu Exit Continued…
Create project in CMOD Go to Components and Assign the exit as follows
.

17
Menu Exit Continued…
As we have both menu and function exits here to implement, first
implement menu exit SAPLWBABAP later function exit
EXIT_SAPLWBABAP_010

Double click on menu exit


and follow as below.
Click on COPY as below.

18
Menu Exit Continued…

Now implement function exit and write the below


code.

19
Menu Exit Continued…
Now go back and activate the
project.

20
Menu Exit Continued…
Now We can see the implemented Menu exit in SE38

Click on “Call SE11”

21
Implicit Enhancements
Rather than getting the access key to modify the standard programs, SAP has
provided an option to write the code at the beginning of the form or at the ending
of the form. i.e. Implicit enhancement.
If we are ok to write the code at the above mentioned places we can go and write
the code without access key as mentioned below.

Click on Spiral Icon ->EDIT-


>Enhancement options->Show Implicit
Enh. Options

22
Implicit Enhancements Contd…

Then we get ‘’’’’’’’’ lines at beginning of the form, ending of the form as
mentioned.
Right Click on it and follow as below.

23
Implicit Enhancements Contd…

24
Implicit Enhancements Contd…

Click on “Code”

25
Implicit Enhancements Contd…

Click on “Create” symbol to create our implicit Enh.


26
Implicit Enhancements Contd…

Click on ‘OK’.
27
Implicit Enhancements Contd…

Select out Enhancement and ‘OK’.

28
Implicit Enhancements Contd…
Now we can write our logic in our enhancement where the entire
MV45AFZZ program Is input disable.

Note@ We will work on implicit only when we are ok to write the code at
earlier mentioned places else we have to go for Access key to modify the
code.
29
Field Exit
Field exit is nothing but to change the field label of a standard data element.
We will see one example as below.

Note@ SAP has provided a provision to


use the existing fields for the custom
requirements rather than creating new
fields.
Here we have some fields which are
available and we are going to use them.
So based on our requirement we will
change the field label of the Screen field.

30
Field Exit Continued…

The data element for


Attribute fields in
XD01/2/3 are.

So now we will change the data element KATR1.


31
Field Exit Continued…

To do Field exit, we use Tcode CMOD and follow the below path.

32
Field Exit Continued…

Now I have changed the label as “Field Exit”. The same will be reflected
now in XD01/2/3 Screen.

33
Field Exit Continued…

Based on Client needs, we can change the filed label of the Screen fields.

34
Screen Exit
Screen exit is nothing but adding a field(s) to the standard SAP screen.
Lets try an example for CJ01/2/3.

We find out the exit


CNEX0006 to add fields at
project level.

35
Screen Exit Continued…
Now we will create a project in
CMOD.

Click on “Enhancement assignment”

36
Screen Exit Continued…
As mentioned earlier, we can
assign exit to only one project.
Here this exit is already assigned
in some other proj. See the error
below in the screenshot.
Now we have to open the existing
project and add our enhancement.

Note@ We can see this


information in MODSAP/
MODACT tables where which
exit is assigned to which project.

37
Screen Exit Continued…

First we have to create/append the fields in “CI_PROJ”


38
Screen Exit Continued…
Lets create the sub
screen as below.

We have added these appended fields in the sub screen 0600.

39
Screen Exit Continued…
We have created a sub screen 0600 as below.

Now lets write the code in both the function exits to move the data from
screen field to table and table to screen field.

40
Screen Exit Continued…

Code inside “EXIT_SAPLCJWB_002”

Code inside “EXIT_SAPLCJWB_003”

Finally activate the project and test the scenario.


41
Screen Exit Continued…

Click as below. Then you can see the newly added fields.
42
Screen Exit Continued…

We are done with Screen exit.

43
BADI (Business Addin’s)
• Badi stands for “Business Addin’s”.
• We have an option to create no.of implementations for Badi’s which is
not available in Customer exits.
• Badi is purely on OOP’s concept.
• We will get an interface (Null Methods) when we create an
implementation for a Badi.
• Let us look into an example on Badi.

Note: We can see Badi definition at SE18 and Implement a Badi at SE19.

44
BADI (Business Addin’s) Contd..
Scenario: Popup when saving a material based on UOM.
Finding a Badi: We have a class CL_EXITHANDLER.
In this we have a method GET_INSTANCE, put the break
point at this method and run your tcode(MM01). We will get
many Badi’s. We will choose suitable Badi and implement.

For our requirement we get the


Badi “BADI_MATERIAL_CHECK”
and we can see the type as “Multiple Use”
means we can have multiple
implementations.

45
BADI (Business Addin’s) Contd..

Now lets implement the Badi and write the code in SE19.
46
BADI (Business Addin’s) Contd..
Now click on tab “Interface” and write the code in method “Check_data”

Now we have to activate the implementation. Now test the scenario.

47
BADI (Business Addin’s) Contd..

Our code is triggered.

Note@ We can create many implementations for this Badi. All the active
implementations will get triggered in “Alphabetical Order”. If we want to change
the order of triggering we have another Badi “BADI_SORTER” for that.
48
Kernel BADI

• Kernel Badi’s are nothing but new Badi’s.


• We can create new Badi’s in Enhancement Spot.

49
Kernel BADI Continued…

Create a Badi with name


Save the Spot. “ZKERNAL_BADI”.

50
Kernel BADI Continued…

Click on “Interface” and create it along with Method(s)

51
Kernel BADI Continued…

• We are done with Interface creation and method in it.


• Now we have to implement the kernal badi with our Code in
SE19.

52
Kernel BADI Continued…

Create the Enhancement implementation and continue.

53
Kernel BADI Continued…

Continue.

54
Kernel BADI Continued…

Create Implementing class and implement the method as follows.

55
Kernel BADI Continued…

Code is done. Activate the Enhancement Implementation.


Now lets write the code in a custom program as follows.

56
Kernel BADI Continued…

Execute

Lets create as many methods you want with


parameters and start working on kernal Badi’s

57
Explicit Enhancement.
• We can create Explicit enhancements in Enhancement Spot.
• We have two options in Explicit enhancements
• Enhancement-Point
• Enhancement-Section

• Enhancement-Point: If We write code here our custom code will


be executed along with standard/Existing
code.
• Enhancement-Section: Only custom code will be executed not the
existing/standard code.

58
Explicit Enhancement Continued.

Lets create an example as above.

59
Explicit Enhancement Continued.

Now we are creating Enhancement-Point in Spot “ZBHAVAN_ES”


60
Explicit Enhancement Continued.
Right click on Spot name and do as below.

We can create implicit enhancements as below and write our own logic.
61
Explicit Enhancement Continued.
We can create as many enhancements like this.

The code triggering will depend on SECTION/POINT.

62
BTE- Business Transaction Events

• Business transaction Events are purely designed for FI Enhancements.

• We will see an example on BTE now.

• Scenario: In general, FI documents are parked(FBV1). The same


document shouldn't be posted(FBV0) by another user.

• First we will see how to find the BTE.

63
BTE- Business Transaction Events Contd…
Open T-code “FIBF” and click as below.

Execute on below screen.

64
BTE- Business Transaction Events Contd…

We find the suitable BTE.

Now we have to implement the selected BTE. Select the


BTE and click on “Sample Function Module”
65
BTE- Business Transaction Events Contd…

Copy it to a FM and write the


code as below..

66
BTE- Business Transaction Events Contd…

Now assign the BTE.


T-code: FIBF

Create a product as below.

67
Now follow as below. Open T-code FIBF

Configure the BTE,FM and Product as below.

68
69

You might also like