Hello dearest ABAPers all over the world. It's 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?
Steps:
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 right-bottom 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. <name of enhancement implementation> 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 have further questions, please leave a message below. Until next week again.
Enjoy :)