Ex On UserExit

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

Example on USER-EXITS

SAP User Exits Routine


User exits are routine which SAP allows you to add in additional customized programs
process without affecting the standard SAP programs.
SAP user exit are usually declare as a form routine :form userexit_xxxxx
........................
endform

Business Requirement: In VL01 - Create Delivery Order, standard program


SAPMV50A, the standard program did not check for storage location equal to space
when the user click the save button.
Now as per my requirement.I have to check weather storage location is equal to
space.If it is space then I should raise an error message.

Technical requirements:
So, Storage location field is LGORT and it is available in the table LIPS.
The table name and field names will be given by Functional consultants.
So, these are the steps which I implemented for this Business Requirement.

Steps:

Goto transaction VL01 to pick a Sales Order for delivery


In the initial screen, click System -> Status ->

Double click on Program (Screen)

In the dialog program SAPMV50A, click on Find Icon


Type userexit in the Find field, then click the In Main program radio button and
hit Enter

Now, Double clik on the program

A number of userexit routine will be displayed.

You'll have to roughly decide which is the correct userexit routine to used.
So, For my requirent I used the below user exit.

USEREXIT_SAVE_DOCUMENT_PREPARE : Use this user exit to make certain changes or


checks immediately before saving a document. It is the last possibility for changing or
checking a document before posting.
So,Double click on theuser exit FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

Now Put a break-point and test weather it is correct Exit or not.


Now,

Goto VL02
Give any delivery no : 0080003370
Press enter
Change any value and click on save.

Here Iam changing Delivery Quantity .Just remove 2085 and again enter 2086 only.
Click on save now.
Now our break-point shouldl be triggered.
If it is triggered means then the exit is correct. It is triggered as below .

Now stop the debugging and write the code as below.


To write the below we need an access key. We got the access key in our company and
Below is the code.
If lips-lgort = .
Message Please Enter storage Location type E .
Endif .
Save->Activate->test it.

You might also like