2009 Jul 30 9:15 PM
Hi ,
I need to split a line item into 2 line based on qty.
Say Customer orders material A for 100 Qty. I need to split this into 2 line items for pricing requirements (client requirement).
So, I MV45AFZZ Program, in user exit, userexit_save_document_prepare.
I am adding other line item by adding folowing code. in debug I am seeing that XVBAP is appeneded with new line item, but I am getting a system error at later point and forcing me to exit for sales order creation screen. order is never saved.
Please help me, I guess i am missing some important..
IF XVBAP-MATNR = 'XXXX' AND
XVBAP-KWMENG GT 100.
DESCRIBE TABLE XVBAP LINES W_LINES.
W_POSNR = XVBAP-POSNR + 00010.
w_adj_qty = xvbap-kwmeng - 100.
READ TABLE XVBAP WITH KEY MATNR = 'XXXX'.
XVBAP-KWMENG = 80.
MODIFY XVBAP.
MOVE-CORRESPONDING XVBAP TO I_VBAP_TEMP.
MOVE W_POSNR TO I_VBAP_TEMP-POSNR.
MOVE kwmeng TO w_adj_qty.
APPEND I_VBAP_TEMP TO XVBAP.
vbap = xvbap.
perform preisfindung_gesamt using 'C'.
ENDIF.
2009 Jul 31 6:43 AM
i think u are not updating internal table YVBAP at the same time ....
regards
Prabhu
2009 Jul 31 2:53 PM
Hi Prabu,
Thank you for your reply. I have added
yvbap = xvbap
Now, I am not getting error '' No status object is available for SDI 0 " and I am force to exit and unable to save the order.
please help.
Anitha.
Edited by: Anitha Reddy Rapole on Jul 31, 2009 4:16 PM
Edited by: Anitha Reddy Rapole on Jul 31, 2009 4:33 PM
2009 Aug 03 6:38 AM
Hi Anita,
This enhancement is very complicated, so be very careful.
I have done this in the PAI section of the include MV45AIZZ in va01. After the all line item redetermination, i wrote the logic to
re-determine everything in the line item. U need to update these things in ur code.
1. Update xvbap, so that u will get split line item. U will not see these value into screen unless u update ivbap and svbap. These two are the index table of xvbap. Update three of them synchronously.
2. Update schedule line. For this update table xvbep, ivbep1, ivbep and svbep. Update forur of them synchronously.
**svbap, ivbep, svbep are the index table, the availability of data in these internal table depends on the current line item
screen data. So be careful while updating these three.******
3. After the above updates call the subroutine as mentioned in my post to update pricing.
Hope this will help u.
2009 Aug 03 3:28 PM
Thank you Bhaskar for your reply.
I have updated table xvbap (by adding new line item and changing posnr) and copied corresponding from xvbap to ivbap and svbap.
in your reply you said
Update three of them synchronously.
.
Can you please explain, if possible give code.
Also I am having little hard time in updating xvbep and associated tables, please help.
Thank u.
Anitha.
2009 Aug 03 4:18 PM
2009 Aug 04 3:14 PM