Você está na página 1de 32

1.

ABAP Development

2.

ABAP Development and


Programming

How To Do Implicit Enhancement


Skip to end of metadata

Attachments:7

Added by Krishna Chauhan, last edited by Bhumika Mahawar on Feb 23, 2009 (view
change)

show comment

Go to start of metadata
Enhancement options are positions where we can add our code, SAP has provides with these
positions where we can put our code as per the requirement, we can add an implementation
element without modifying the original code of SAP.
Enhancement implantation elements are stored in the package with own transport objects thus
avoiding any conflict in modification in later stages.
Explicit and Implicit Enhancement Options
Implicit Enhancement options are for free, provided by the framework, while the explicit
ones need to be inserted explicitly, as the name indicates.
How To Do Implicit Enhancement
Suppose we want to enhance Fun Mod:
We know Fun Mod 'popup_to_inform' is used to display popup message, I will add one more
Fun Mod 'popup_to_confirm'.
And on selecting cancel the program should exit.

1>In SE37.

2> Screen will look something like this.

3> Select enhance source code .

4> Screen will come white & fonts will come Gray, select show_implicit enhancement
options.

5> Yellow lines will come, place your cursor on yellow strip & create enhancement.

6> Choose declaration type of enhancement.


7> Now place your required code in this section.

8> Here we have placed one popup to confirm

9> Activate the function module & run you will find the implemented enhancements.

Implicit Enhancement Options in ABAP Source Codes


Use
In ABAP programs, implicit enhancement options are predefined at the following
places:

At the end of an include. There are some restrictions, for example, not at the end of a
method include.

At the end of a PUBLIC-, PROTECTED-, PRIVATE-SECTION of a class.

At the end of the implementation part of a class (before the ENDCLASS, which belongs
to CLASS IMPLEMENTATION).

At the end of an interface definition (before the ENDINTERFACE).

At the end of a structure definition (before TYPES END OF, DATA END OF,
CONSTANTS END OF, and STATICS END OF).
At the beginning and at the end of a procedure (FORM, FUNCTION, METHOD). That
is, after commands FORM, FUNCTION, and METHOD, and before statements ENDFORM,
ENDFUNCTION, and ENDMETHOD.
At the end of the CHANGING-, IMPORTING-, EXPORTING-parameter list of a
method. These enhancement options are located in the middle of a statement.

Implicit enhancement options always exist and no enhancement spot is assigned to them.
Activities
The implicit enhancement options can be displayed in the ABAP Editor by
following the path: Edit Enhancement Operations Show Implicit
Enhancement Options, and then enhanced using source code plug-ins.

Demo on Enhancement Framework


By Jagadeshwar Gollapelly, Gems Techno Solutions
Restrict users (sales persons) to view or change Sales order data - Using
Enhancement framework:
Source Code Enhancement is one of the enhancement technologies available under
Enhancement Framework. Implementing this technology is also called as Source Code
Plug-In. Technically the source code plug-in implementations are stored in a separate
include program and not as part of the original source program.
There are two types of Source Code enhancements possible.

Implicit enhancement option

Explicit enhancement option

Example Scenario:
One sales person cant see or change another sales persons sales orders.
In my program, I have used following users.
Sales person1 (user 1): lz8xzf Owner for Sales order no: 174.
Sales person2 (user 2): lzn4rm
Steps to Implement the Implicit enhancement option:
Step1: Go to SE38 and Open include MV45AFZB

Step2: In order to implement any of these Source code enhancements, you need to be in
change Enhancement mode (the spiral icon available in the editor).

Step3: Go to EDIT option in the menu and choose Enhancement Operations -> Show

implicit Enhancement Options

All Implicit Enhancement option will be displayed. All yellow lines indicate Implicit
Enhancement options. In ABAP programs, implicit enhancement options are predefined at
the following places:

Begin/End of an include.

Begin/End of Method/Function Module/Form Routine

End of a structure

End of Private/Protected/Public Section of a local class

Step4: Place the cursor on the yellow line and choose

Enhancement implementation Create.

Step5: Give Implementation name and then create.

Step6: Here Editor will be enabled to write the code. Write your own code save and
activate it.

Step 7: Once the development is completed you can test the scenario.
When Sales person (lzn4rm) tries to Open Sales order no 174, it gives error message
Access Denied.
Note: Sales order 174 is created by another sales person (lz8xzf).

3rd example

SAP Implicit enhancement points - Changing standard SAP code using the ABAP
implicit enhamcement code points

Implicit enhancement points are basically points within ABAP code where an enhancement
point is implied, and in which case can be created. Examples of implicit enhancement points
are at the beginning and end of FORMs, at the end of a program, include or function module
etc. Below is a step by step demonstration of how to create and implicit enhancement point.
Step 1 - Activate the enhancement functionality
Within SE80 open up the program/include you want to enhance and click on the enhancement
button (show below)

Step 2 - Enhancement functionality activated


The SE80 screen will now look something like below!

Step 3 - Show implict enhancement points


Goto menu 'edit->Enhamcement Operations->Show Implicit Enhancement Options' to
display implicit enhancement points within the ABAP code

Step 4 - Enhancement points with the code


Once you have done this you will be able to see all the implicit enhancement points available
within you code, these are denoted by the line of quotation marks and the black arrow at the
start. In this example there are enhancement points at the start and end of each form and one
at the very end of the include.

Step 5 - Create an implicit enhamcement point


Inorder to implement an implicit enhancement point simply right click on the required
enhamcement point and select 'Enhancement Implementation->create'.

Step 6 - Enhamcement point type


Next click on the code button to create a code implementation

Step 7 - Name and description


Next give the enhancement point a name and description. Click the green tick

Step 8 - Change request


Assign change to a change request in the usual way

Step 9 - Enhancement point created


The enhamcement point will now have been created in the appropriate place. Denoted by the
ENHANCEMENT...ENDENHANCEMENT tags

Step 10 - Enter code into enhancement


You can now enter your own code into the enhancement point!

Step 11 - Activate the enhancement point


Click the 'Activate Enhancements' button to activate it.

Step 12 - Turn enhancement mode off


Now click the 'Active <-> inactive' button to turn enhancement mode off and return to
standard SE80

4th
How to implement an Implicit Enhancement in SAP objects?

By levi aliangan On 10/12/2013 Leave a Comment

Hello dearest ABAPers all over the world. Its Saturday today and its my rest day. Its me
again sharing to you what I learned over the past few days of work. It was so busy week
doing some developments on reports and enhancements as we are implementing a big project
in Singapore. Well I do believe then that everyone of you have experiences now with these
objects.
Yesterday, I was assigned an object with our Project Manager. When I read the Functional
design, it was an EXIT. Ohhh, it was an enhancement again. Upon checking the detail, I need
to implement this exit USEREXIT_NUMBER_RANGE. Since I am not sure with the
project to implement, I made a google to find out what Include program handles this exit.
Thats the amazing google can do for us If you have questions, asks uncle Google not uncle
Sam. hehehe.
In an instant, I got the result It was MV45AFZZ handles this exit. Normally, an exit is an
Include program called inside a Function Module. But in this case, this exit is a subroutine
inside an Include program.
So my next question now is, how can I modify this object (MV45AFZZ) since this is a SAP
standard object? As you can see on the screenshot below, when clicking the edit button on the
editor, it asks an access key. An access key is generated on the SAP market place.
But how about if you dont have an access in the SAP market place? Then how can you edit
this exit then?

So the most possible solution is Enhancement. It is a method develop by SAP to modify


standard objects. So in this tutorial, I will discuss to you how to implement an
enhancement. By the way, there are two types of enhancements. We have Implicit and
Explicit enhancements. The simple difference I can say between the two are, Implicit
enhancement is an enhancement that you declared (its not SAP who did). In short, this is a
type of enhancement which has a Z* type object. Unlike with Explicit enhancement, it was
SAP who defined this enhancement point. Do you get the difference between the two types of
enhancement? I hope so. If not, just leave a message below and I will answer you the best I
can.
So lets continue with this tutorial now. What I will discuss in details is how to implement an
Implicit Enhancement. So just follow the steps and you will implement this type of
enhancement into your next projects. Alright? So here are now the steps to do.

How to implement an Implicit Enhancement?


1. In your editor, locate the Enhance button just like the one below. Click this button.
Since what I am editing is an include program MV45AFZZ, I opened this in SE38
transaction code. By the way, you can implement any enhancements whether that is a
Function Module, Class, Methods, BADI, BAPI, etc as long as you can see that Enhance
button, implicit enhancement is possible.

2. Once clicked the enhance button, the editor changes something like this one below. The
editor looks grayed and the two buttons above Active<->Inactive and Enhancements appear
in the application toolbar. The first button, Active<->Inactive is used to changed mode from
the normal editor to enhancement editor. Try to click one at a time and you will see the
difference between the two editor mode. The second button, Enhancement is used to activate
any enhancement implementations. You will used this in the later part of this tutorial.

3. The next step is to display those enhancement options. In order to do so, follow this path.
On the menu, click Edit->Enhancement Operations -> Show Implicit Enhancement
Options. This step is important because it shows where you can insert enhancement
implementations. Otherwise, you cannot implement any implicit enhancement if you will not

do this step.

4. As you can see below, two bold arrows were shown at the left side of the editor. This
signifies the start and end points where you can add enhancement points. However, please
note that this step is only showing where an enhancement can be positioned. We can not add
yet our own ABAP codes at this time. If you noticed, the editor is still grayed. We still need to
create an enhancement implementations just like a normal EXIT or BADI. I know you are
now eager to write your ABAP programs. Before you can create an enhancement
implementation, position your cursor at the starting line just like this screenshot below. This
is a MUST to-do since you cannot create a new enhancement implementations if your cursor
is not positioned correctly.

5. To create an enhancement implementation, go to the Menu again and follow this path.Edit
-> Enhancement Operations -> Create.

6. On this pop up screen, it will first asks you the type of enhancement between declaration
and code. Choose code in here as we will write ABAP codes. Honestly, I am not sure yet the
difference between the two. But once I got a chance and time again, I will discover what this
two is all about and add in this blog. But if you know now what makes them differ, please
leave a message below for everyone else. I will be grateful to you.

7. On this next pop up screen, you are required to select the enhancement implementation.
Since this is a new implementation, we will create our own. Click the button at the rightbottom of the window. Its like a white folder paper.

8. This is the window where you will define the name of your enhancement
implementation. Remember, it must begin with a Z* or Y* as this is a customized (Implicit)
enhancement implementation. Also, give a short description for it. It must be descriptive. For
the third parameter (composite enhancement implementation), just leave it blank. Then click

the OK button after you are done.

9. Since we are creating a new implicit enhancement implementation, it will ask you to
save in a transport no. Just select your package and add this into your transport no if you want
to move it to another system. But if you are just making a test, then saving as local object
would suffice.

10. After adding it into your transport, select from the list of implementation the one you
created. Just like in my case, I highlighted it then click the Ok buttom below. Congratulations
as you are almost done implementing an Implicit enhancement.

11. Finally and there you are, you can now add ABAP codes into our exit,
USEREXIT_NUMBER_RANGE. As you can noticed, the grayed area while ago turns now
into white which means we can write now our own ABAP Codes. Sorry but I did not write
anything yet here since we will have a different logic to implement. You can also see the
keywords ENHANCEMENT No. and END ENHANCEMENT. Inside this keyword, you can

write your own ABAP logic.

12. And lastly, dont forget to click this button on the application toolbar. This is the activate
button for the enhancement. Remember that any objects that is not activated will not take
effect. Once done, you will see your object being activated. So if you want to go back to the
normal editor, click the button,Active<->Inactive button.

13. As a sidenote, If you want to go back again to your enhancement implementations, let say
after one month there was a bug within your code, just do the same process. But rather
clicking the create button, this time, click the change button to modify the existing implicit
enhancement. Just follow this path to change:
Edit -> Enhancement Operations -> Change.

Congratulations. You can now implement an Implicit Enhancement into your projects. If you
find this article is helpful and useful, please consider to share it to your friends. Remember,

SHARING is CARING. If you have further questions, please leave a message below. Until
next week again. Enjoy

5th

Implicit Enhancement in SAP ABAP ( New Enhancement Framework ) with Tutorial


Sep 9th, in Articles, Enhancement & User Exit, SAP ABAP, by Raj

This Article contains the Tutorial for creating an Implicit Enhancement.

Author : Raj
Author's Website | Articles from Raj

Raj (Raju Borda) is an Application Developer focusing on Custom Development particularly in the areas of ABAP ,WD4A , JAVA , APO , Enterprise services , Mobile
applications and PI Developer/consultant . He is also certified in ABAP , PI and insurance
domain. Facebook
Introduction: Implicit enhancement is an enhancement option which is provided in new
enhancement framework .
Requirement is to remove Reconstruct tab from WPDTC Transaction.:

There is something called transaction variant and screen variant .to solve this problem .But it
has its own disadvantages like You cant submit that Report using SUBMIT statement as it
will not consider the changes done on screen using the variant.
Step 1:
Go to system status of transaction WPDTC and check the program name it is
PDTC_REPORT.
Here you can see many Explicit enhancement (Source code plug-ins options).

To hide a screen element code can be done in AT SELECTION-SCREEN OUTPUT event.


There is a form named pdtc_screen_output.

Step 2:

To see the Explicit enhancement option click on the spiral symbol on the top.
As we dont have any explicit enhancement options the only possibility left is implicit
enhancement.
To see the implicit Enhancement Go to menu path:
EDIT->Enhancement operations->Show implicit Enhancement Points.
As you know implicit enhancement options are provided at beginning and end of every
method, function module and in subroutine.

Select the Enhancement mode as CODE.

The next pop up will show u the available Enhancement done in this Report, You can merge
your enhancement in one of the available Enhancement or you can create your own. To create
a new one click on the create icon.
Step 3:
Provide the Enhancement Implementation name and short text to it.
(Note: No need for composite enhancement implementation).
Click on the continue. It will again take you to the Select Enhancement popup. Select your
created enhancement and continue.

Step 4:
Now you can see some space in standard code to put your own code.

As per the requirement we need to de-activate the last tab.


Go to layout of the screen 1000, and find the name of the third tab. To make your work easy
the third tab name is : TABSTR_4.
Here is the simple code which can loop at the screen and deactivate the third tab.
loop at screen.
if screen-name = TABSTR_4.
screen-active = 0.
MODIFY SCREEN.
endif.
ENDLOOP.
Put the above code inside the Enhancement and activate it.

Step 5:
Go to Transaction WPDTC and check that the third tab is invisible or not. ( if not dont look
puzzled just check whether you have followed the steps properly or not ).

Você também pode gostar