User exit real time business example SAP

Userexits in SAP real-time applications, implementing userexit in SAP ABAP

A+ A-

Business Requirement: When ever business user creates a delivery order, the standard SAP application dose not check for storage location (whether it is space or not ), if it is space it should raise a error message.

VL01 is the t-code for creating a deliver order, this uses standard SAP program SAPMV50A, the standard program don`t check for storage location equal to space or not.

As per the requirement we need to find a suitable user exit for this and we need add additional code to check storage location.

Technical information : Storage location field is LGORT and it is available in LIPS table.

To implement the user exit for this we need to follow the below steps.

Step1: Find the user exit.

Step2: Verify the user exit.

Step1: Implement the user exit.

Find the User exit

Go to transaction VL01N, System-Status

Implementing userexit in SAP

A pop up will open ans double click on program name.

Userexit in SAP ABAP

Click on Find icon, select main program, find 'userexit' and press enter.

Finding userexit in SAP

You will find number of performs.

Verify the user exits for suitable exit

Choose some exits based on descriptions .

You'll have to roughly decide which is the correct user exit routine to used. So, For my requirement 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 the user exit FORM USEREXIT_SAVE_DOCUMENT_PREPARE, put break-point inside the form.

Now go to table LIPS, display, get a deliver no and go to VL02N (T-code for changing deliver order), provide delivery order no and enter.

Cahnge any value ex: delivery quantity and save.

userexit in SAP

click on Save (Ctrl S), debugger will this is the suitable exit.

Implement user exit

To implement user exit we need access key from SAP, when we get access key from SAP, write below code inside from.
If lips-lgort  = ' ' . "check if storage location is initial 
Message 'Storage location is mandatory field' TYPE 'E'. "error message
Endif .
Save, Activate and test.

Learner Questions

No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 79 People out of 80 think this lesson helpful

    Lesson Navigation

    ←Previous Chapter
    Next Chapter →