12-07-2006 7:21 AM
Hi Friends,
My requirement is to add new sub items to the sales order with the reference to the item entered while saving the document. I have added the sub items to the respective tables XVBAP, XVBEP and XKOMV. This works great in transaction VA01 but when I change the main item of same document in VA02, the changes have to reflect in the sub items. But the changes are not reflected. Please some body help me in this regard.
Thanx in advance,
Ram
12-07-2006 7:53 AM
Hi Ram
It's not easy to say whats wrong in your case. You should at least tell us something about what user exit you use.
You mention "create" and "change", but you shold also think about "delete".
As far as I remember you have to be very carefull how you maintain the X..... structures. In some cases you must also maintain the Y.... structures. And if this is done wrongly you could create some inconsistencies that can cause very bad performance.
I have seen examples of code that made a salesorder blocked for 10 minuttes in update task after save was pressed in VA02.
A very important OSS note is 50551.
Best regards
Thomas Madsen Nielsen
12-07-2006 7:53 AM
Hi Ram
It's not easy to say whats wrong in your case. You should at least tell us something about what user exit you use.
You mention "create" and "change", but you shold also think about "delete".
As far as I remember you have to be very carefull how you maintain the X..... structures. In some cases you must also maintain the Y.... structures. And if this is done wrongly you could create some inconsistencies that can cause very bad performance.
I have seen examples of code that made a salesorder blocked for 10 minuttes in update task after save was pressed in VA02.
A very important OSS note is 50551.
Best regards
Thomas Madsen Nielsen
12-07-2006 8:47 AM
Hi Thomas,
Thanx for the reply. Let me explain the scenario. In VA01 transaction, if I enter an Item, by taking some of its data and add new sub items to this item. Lets say if I enter item 10, new sub items will be 11 and 12. I am doing this in the user exit 'USEREXIT_SAVE_DOCUMENT_PREPARE. This works fine when I am creating a sales order. But when I am changing the main item in VA02, the corresponding sub items should change accordingly. But its not happening. Please provide solution if you know.
Regards,
Ram
12-07-2006 9:40 AM
Hi Ram
I also use 'USEREXIT_SAVE_DOCUMENT_PREPARE in similar solution.
First of all you should make sure (debug) that your code is also executed when called from VA02. That is the normal case, but you may have some conditions in the code (if or case or ..) that cause an exit from the userexit.
And I will repete from my first answer: Please make sure that changes in XVBAP, XV.... are made according to OSS note 50551.
The methode of OSS note 50551 suggest that you don't update XVBAP etc. but directly in VBAP etc.
Ex.:
loop at xvbap where updkz ne updkz_delete. "OSS 50551
svbap-tabix = sy-tabix. "OSS 50551
perform vbap_bearbeiten_vorbereiten(sapfv45p). "OSS 50551
perform vbap_fuellen(sapfv45p). "OSS 50551
if vbak-vgtyp = 'G'. "Custom code
vbkd-kurrf = vbkd-kursk. "Custom code
else. "Custom code
vbkd-kursk = vbkd-kurrf. "Custom code
endif. "Custom code
vbap-someotherfield = 'X'. "Custom code
perform vbap_bearbeiten(sapfv45p). "OSS 50551
perform vbap_bearbeiten_ende(sapfv45p). "OSS 50551
endloop. "OSS 50551
Plase also consider other actions needed depending on what field you change. I.e. an other thread in this forum says:
"if you override the plant at the time of order save - you have to redetermine shipping point & route based on new plant."
Good luck
Thomas Madsen Nielsen
12-07-2006 10:14 AM
Hi again
I suppose that you already know that the link betweeen main item and sub item is found in VBAP-UEPOS (or XVBAP).
Best regards
Thomas
12-07-2006 4:43 PM
You need to be very careful with where & how you are adding subitems, it's not enough to just add item to some tables, are you sure that these subitems have proper data (statuses, object statuses, item categories, plant, availability control, texts, pricing info if they are relavant to pricing, proper ratio to the main item if you updated their UEPOS to point to the high-level item, ...)
Do you really have the same behaviour in the following 2 cases :
- you added subitems by your code
- you just create sales order in VA01, add item in VA01, add subitems and link them to the high -level item by updating "high-level" field.
If you need to copy some info form the top item to subitems - you can do it in the userexit_move_field_to_vbap for example, and do it when top item is changed.
03-14-2007 2:59 PM