Wednesday, May 25, 2016

User Exit - Implicit Enhancement


User exit is a classic concept. User exit is a blank code block in the form of subroutine which lies in a standard program (perform-endform). Now to write our own piece of code we shall need access key for the standard program. Modifying standard program will not be a good idea because SAP will not provide any support if any bugs are found.

From ECC 6 onwards SAP has implemented enhancement point, the implicit enhancement. By using implicit enhancement we can write our own code into a coding block. We can write our own code into a standard program or any function module or any include program also. The code block will be under a subroutine (perform – endform). Now our piece of code will be under Enhancement – Endenhancement block which is under that perform.

The enhancement must be created under a package & transport request. Any local object will not be accepted here because SAP system wants to take the versions of this enhancement.

With implicit enhancement we can create our custom code into a function module, include or standard program where the ENHANCE (coin) button exits. Now in the following example we have discussed a step by step approach to make an implicit enhancement. Here we have taken a standard include program of order. We have a format of standard include programs.
a.       MV45* - it relates with Order
b.      MV50* - it relates with Delivery
c.       RV60* - it relates with Billing

1.    Go to VA01 (Create Sales Order) transaction. Go to system > status.

2.    Double click on the program SAPMV45A and go to include program MV45AFZZ. 

3.    We have a subroutine USEREXIT_SAVE_DOCUMENT_PREPARE. When we prepare a sales document and then press SAVE button, this subroutine comes into the picture (get help by searching or functional consultant). Click on the Enhancement (coin) button with keeping the cursor on the subroutine. 

4.    After clicking there we see the spot sign comes to every line.

5.    Now keep the cursor inside the subroutine and go to Edit > Enhancement Operation > Show implicit enhancement options.

6.    Now we see that a sign (””””””) comes into every subroutines’ starting and ending line. It means we are now ready to write code inside there.

7.    After that put the cursor on that sign and right click > Enhancement Implementation > Create.

8.    Now choose Enhancement mode -> CODE because we just want to code (we are not going to declare any data or structure here).

9.    Click on the create button. 


10.    Give the name Enhancement Implementation (ZENHT in this case) and short text also. 


11.    Keep it inside a package and transport request. 



12.    Now we see at the last position we have our own enhancement which has been implemented. 


13.    Now we can write our piece of code inside Enhancement – Endenhancement. Here 315 is the implemented enhancement number and ZENHT is our given name.

14.    Now we have written our custom code. If there is no material declared then an information message will be displayed. After that save > check > and activate by clicking on Enhancement button. Pretty Printer will not work here.

15.    Now go to VA01 again and try to create a sales order without entering any material. Whenever we click on SAVE button, an information message will be displayed as follows.

5 comments:

Iffy said...

Nice tutorial. Does this enhancement gets triggered when we open VA01 pls?

Iffy said...

Nice tutorial. Does this enhancement gets triggered when we open VA01 pls?

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Sourav Rai said...

i have a question , if this include or module goes under up-gradation, will this condition work fine, or it will fail , i am fresher so i dont have very much clarity so kindly enlighten me

Unknown said...

I want to trigger a mail along with the generated cust. number when i save customer data in xd01. Is there any enhancement option for xd01

Thanks in advance.