Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Split line item - Sales Order

Former Member
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

i think u are not updating internal table YVBAP at the same time ....

regards

Prabhu

0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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.

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.