cancel
Showing results for 
Search instead for 
Did you mean: 

Serial number validation when saving a sales document (VA01/VA02)

Jelena
Active Contributor

There is a 2016 question on the same subject but thought I'd ask again and add some info as well. When a sales document is saved (in VA01/VA02 and such), we need to run some validations against custom tables for all the serial numbers in the document.

Unfortunately, serial number data is not available in the good old USEREXIT_SAVE_DOCUMENT_PREPARE. This is because serial number functionality is used all over SAP and lives in it's own little "universe" in a separate program. There are designated user exits for serials (in SMOD transaction, look for IQSM* enhancements) but they are all triggered only for each item individually. But in this case, we must check the serial combination for multiple items.

There are lots of existing posts on this subject. The one linked above is the only one that has a viable answer, all others are either unanswered, mention the same IQSM... user exits or are just complete nonsense.

I'm able to get the serial numbers using "dirty assign" with (SAPLIPW1)XOBJK[] internal table (there are some others in the same program) but this is not great. Has anyone ever managed to find a better solution for this?

Thank you!

View Entire Topic
orestis_x
Explorer
0 Kudos

I had a similar requirement and for me the below worked. I have activated component IQSM0004 in tcode CMOD. This is called every time you press the ok button in the technical objects screen and in here i am exporting the equipment list in memory.

Then in MV45AFZZ=> in form userexit_save_document_prepare i am importing the list from memory and i do my validations.

The only downside is that the list with serial numbers is not linked to the corresponding line item in the sales order which is not such a problem since you have the material number.

Thank you,

FredericGirod
Active Contributor
0 Kudos

Instead of playing with memory or worst "(SAPLIPW1)XOBJK[] " you could use a SingleTon Design pattern.

This is a way to share information inside a transaction from different user-exit.

(exactly like a function group someone already used for a long time)