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: 

Bapi for SO change

Former Member
0 Kudos

Hello every body,

For Sales Order Update , I am using BAPI

" BAPI_SALESORDER_CHANGE ".

I could delete So line item and insert line item, successfully.

But for Updating SO line item,

Im also Updating Schedule lines,

My problem is : while updating my line item with new quantity , it is adding the new quantity with existing quantity.

Reason behind this is , this BAPI is creating a new schedule line rather than updating a existing schedule line.

Udate Flag for schedule line is "U", i am passing schd_line number also for update.

Example :

If existing SO item Qty is 20.

i want to update it to 30, by passing quantity 30 to BAPI.

After executing BAPI.

Present Qty is 50. But i am expecting 30.

Thanks In advance.

Regards

Sunil

8 REPLIES 8

Former Member
0 Kudos

are you using ORDER_ITEM_INX segment correctly?

Former Member
0 Kudos

Hi,

I guess you need to pass the difference of the new and the old quantity.

See in debug mode by putting a break point in the function

SD_SALES_DOCU_MAINTAIN

on line 870. its adding to the schedule line.

I unable to test at the moment with schedule lines thus not sure what happens.

regards,

Advait

Former Member
0 Kudos

HAVE U GOT ANY SOLUATION?

0 Kudos

i didn't got any solution. Do u have any solution for this.

I had tried to delete the schedule line and insert a new schedule line for the same.

But it doesn't worked as , my Payment Requisition number will be changed. which is important for PO creation.

If u have any solution for the same, please help me..

Thanks in advance

regards

Ravi

0 Kudos

Hi,

Did you try to pass the difference between the existing scheulde quantity and the new schedule quantity ?

example if the existing quantity is 20 and you want to update it to 30, pass 30-20 = 10 to the BAPI

regards,

Advait

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

i face same problem but now i solve .

u can pass schedule line (vbep-etenr) with order item (vbap-posnr)

then append it and then pass into bapi like

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p_vbeln

order_header_in = i_hdr

order_header_inx = i_hdrx

TABLES

return = i_ret

schedule_lines = i_sched

schedule_linesx = i_schedx.

Former Member
0 Kudos

Thanks a lot for all your help and support.

I had solved this issue.

Problem was :

while passing schedulelinesx to bapi, i was passing 'X' in the schedule line item, but we are supposd to pass line item munber, as we are passin item_number as posnr in item -X table.

Regards

Sunil