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.
Find the User exitGo to transaction VL01N, System-Status
A pop up will open ans double click on program name.
Click on Find icon, select main program, find 'userexit' and press enter.
You will find number of performs.
Verify the user exits for suitable exitChoose 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.
click on Save (Ctrl S), debugger will open..now this is the suitable exit.
Implement user exitTo 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.