Implicit and Explicit Enhancements
-
Upload
khaleelinnovator -
Category
Documents
-
view
115 -
download
17
Transcript of Implicit and Explicit Enhancements
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Implicit and Explicit Enhancements
There are four technologies available as part of the Enhancement Framework:
• Source Code enhancement
• Function Group enhancement
• Class enhancement
• Kernel-BADI enhancement
This Implicit and Explicit enhancement can be found in ECC6.0 version onwards. This
comes under the Enhancement Framework and can be switched using Switch framework.
A Spiral symbol that can be seen in the editors so that the whole program is switched into
enhancement mode wherein you can define your one enhancement in different ways like:
Source Code Enhancement
Whenever we are incorporating enhancements directly in the source code we go with this
source code plug-ins.
Implicit Enhancement
Explicit Enhancement
Enhancement-Point
Enhancement-Section
Implicit enhancement option
Enhancement options for these implicit enhancements are automatically available at certain pre-defined places given by SAP. Some of the implicit options are:
• At the end of all the programs such as Includes, Reports, Function pool, Module pool, etc. after the last statement.
• At the beginning and end of all FORM subroutines. • At the end of all Function Modules. • At the end of all visibility areas as public, protected and private of local class .
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
To view all the implicit options available in a source code, choose ‘Edit ->
Enhancement Operations -> Show Implicit Enhancement Options’ from the editor.
We don’t need to have an explicitly defined enhancement spot or points in order to
implement these enhancements. Just position your cursor on any of these implicit points
defined after the above procedure done and choose ‘Create Enhancement’ from the
menu to implement it.
Explicit enhancement option
This kind of enhancements as stated before is of two kinds .One that can be provided at a
specific place such as Enhancement Point , and another which can be used to replace a
group of statements called as enhancement Section.
Enhancement Section
When the Enhancement-Section is implemented, only the implementation done gets
executed and the original code doesn’t get executed. This is a new technique, which
didn’t exist previously in any of the old ways of enhancing, to exclude any standard SAP
code from execution. Because of this, there can be only one active implementation of an
Enhancement-Section.
Enhancement Point
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
This can be provided at a specific place and there can be multiple active implementations
of an Enhancement-Point. Also the order of implementation is not determined and cannot
be guaranteed.
Step by Step Implicit Enhancement
First of all going with Implicit enhancement here is an example of it in PZ80 (Section 80
Deduction Data).
To Disable Change Button on Screen 100.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Step 1.
In SE80 (object navigator) open the standard program SAPLEHIN80 in Function Group
EHIN80 in subroutine MODIFY_OKCODE_0100 double click on it.
Step 2. Open the program in Enhancement Mode
In Menu->Program->Enhance or clicking on the Spiral symbol in the application
toolbar above.
Step 3.
Once the program is opened in enhance mode than check for implicit enhancement place
available in the code. (As described before Menu->Edit->Enhancement Operations-
>Show Implicit Enhancement Options.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Step 4.
In the subroutine you will see the enhancement been provided by SAP.
Place the cursor on the line been highlighted and right click, select Enhancement
Implementations-> Create.
Give the enhancement name and short description in the pop-up that will be displayed
after create is selected.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Correspondingly the enhancement gets created.
Step 4.
In the subroutine you will see the enhancement been provided by SAP.
Place the cursor on the line been highlighted and right click, select Enhancement
Implementations-> Create
Give the enhancement name and short description.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Correspondingly the enhancement gets created, now the required code can be written in
the enhancement space provided in between ENHANCEMENT and
ENDENHANCEMENT.
CODE:
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
After placing the code in proper enhancement activate the enhancement.
Execute the Transaction PZ80 again.
A Message gets displayed on the status bar confirming that the change button is disabled.
Sometimes when we show the enhancements as Menu->Edit->Enhancement Operations-
>Show Implicit Enhancement Options a popup is displayed to select the program name
from the drop down list as the same subroutine may be used in other places also to take
care to put it in the proper Program only..
Select it as SAPLEHIN80.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Then u can go on with create, undo, replace and change the code written in the
enhancement space provided.
CODE:
This is how you can do Implicit enhancements in any Program. We generally go with this
if we do not get the option for any explicit enhancements in the source code.
Example For Explicit Enhancement
Start the Object Navigator (SE80)
Now starting first with Creation of a simple enhancement spot .
Semantically related enhancement options are grouped under a ‘Simple Enhancement
Spot’. ‘Composite Enhancement Spot’ contains one or more of Simple and other
Composite Enhancement Spots. On the other hand (implementation side), various related
implementation elements are grouped under a ‘Simple Enhancement Implementation’. A
‘Composite Enhancement Implementation’ can contain one or more of Simple and other
Complex Enhancement Implementations. The important point to note here is these four
entities form the basis of transportable objects in the Enhancement Framework.
Select the package in which you want to create the simple enhancement spot.
In case of explicit enhancement we can add our enhancements at any place as per our
requirement.
Well in our case we start with a Z program and do enhancement in it.
Before starting explicit enhancement we have to create a Enhancement Spot.
Enhancement Spot.
This has to be done under a package. So starting with creation of a package. Go to se80.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Create a package.
Enter the Following entries.
Right click on the Package and create an Enhancement->Enhancement Spot.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
The screen comes as this.
The hierarchy is as below after expanding.
Now implement the enhancement.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Note that all this is getting created in the package itself.
Activate the whole application with package.
Now go to se38 and there in a ‘z’ program you can include your enhancement spot
created .This is a procedure wherein it becomes clear that how if one is creating a custom
program and wants that it would provide some enhancements wherein he can do the
enhancements .It is done as this.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Now keep the cursor on the editor and then select the create option as below.
A screen comes as this.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Here the options are here as you can create for data declarations as there is a data
declaration and in between if you want to provide an option to create some more
declarations for customers.
You need to put the cursor there in between the declarations done and then create the
enhancement as declaration or else the code is checked by default.
Now in the Program you can see the created spot for enhancement point.
Now right clicking on it…You can create the implementation for it as this but for this we
have to go to the Enhancement mode as here below.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Now create the implementation as below by right clicking.
This is how it comes.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Now in between this Enhancement and endenhancement you can put your code below
where the blue star is shown.
Activate only the enhancement as here. We don’t need to activate the whole Program.
This is how we can create and we can go through the creation of Enhancement spot. This
was a Custom one.
Now going for the standard one we have to go through the same procedure we did in
SE38.This will make the Explicit enhancement more clear.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
EXPLICIT ENHANCEMENT IN VA01 TRANSACTION
Here is the Small sample scenario in which we will be defaulting the Sold-to-party value
in the VA01 transaction.
For this now first of all we need to find out the relevant explicit enhancement where we
can put the code.
So we first of all debug the transaction VA01 transaction and then at that time u will find
many explicit exits present.
Now this is the VA01 transaction.
From the System->status find the Program name where it is.
SAPMV45A
Now, click on the sales above in debugging mode we find in this module where there is a
form as below.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Inside the form below,
This is the enhancement section above in the given main program and the form name.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Now,
Going to Se80 and in the Program find include and the form where this enhancement
was there.
After tracing the place where the Section is there as we stated in the definition before that
section is used to replace the existing code of sap with the customer type.
So, we go as right clicking on the enhancement and checking the create option it gives
you the option to create your own enhancement for that section and the SAP code will be
present in the ENHANEMENT and ENDENHANCEMENT .You can change or edit the
code or keep your own code in that .
A pop-up comes were you can create the implementation.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
After this it will be available in the table as before from there you can select and the
screen gives you the place to write your code.
So as we have selected ZTEST123 we proceed as above here is the below screen for it.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Above as it is seen is a explicit enhancement and inside that the name of the section is
VBAK-ORGDATEN_PRUEFEN_10.
There may be many other enhancements present. Implement your own enhancement here
or if u want u can change a present enhancement.
The enhancement implemented here is our ZTEST123 and in the just we are giving a
default value for Sold-to-Party as ‘1’.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
Activate the Enhancement only as below….
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad
And now run the transaction VA01 transaction.
This is how the Explicit enhancements are done. The simplest way to trace out that the
particular enhancement is getting triggered or not at the place u want ,You put a break-
point in that Enhancement and Endenhancement and check the debugging starts at that
place or not.
Similarly we can proceed with the Enhancement-point but that is a place were you create
a particular code no replacement of SAP code is there.
Best-practice for the order in which the enhancement options should be considered and
used is:
• Use a BADI; if there is no BADI to suite your need then,
• Try to solve it using Explicit Source code, Function and Class enhancements; and,
• Implicit Source code enhancement should be the last option to choose
Of course, if none of the above could solve your adaptation needs and if your need
demands it, modification should be the last option to be tried.
Varma Pericherla, ERPandERP Pvt. Ltd. Hyderabad