Skip to Content
avatar image
Former Member

Bapi for SO change

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Oct 20, 2008 at 12:47 PM

    are you using ORDER_ITEM_INX segment correctly?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 01:09 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2008 at 09:03 AM

    HAVE U GOT ANY SOLUATION?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Nov 10, 2008 at 12:28 PM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 11, 2008 at 05:19 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 11, 2008 at 06:44 AM

    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

    Add comment
    10|10000 characters needed characters exceeded