Skip to Content
author's profile photo Former Member
Former Member

BAPI_SALESORDER_CHANGE

Hi All,

I am trying to change the item quantity in a Sales order using <b>BAPI_SALESORDER_CHANGE</b>

My Code is as follows:

Passing the following values.

<u>CODE:</u>

DATA: BAPISDH1X type BAPISDH1X.

BAPISDH1X-UPDATEFLAG = 'U'.

data:I_BAPISDITM TYPE TABLE OF BAPISDITM,

I_BAPISDITMX TYPE TABLE OF BAPISDITMX,

I_BAPIRET2 TYPE TABLE OF BAPIRET2,

I_BAPISCHDL TYPE TABLE OF BAPISCHDL,

I_BAPISCHDLX TYPE TABLE OF BAPISCHDLX.

DATA:W_BAPISDITM TYPE BAPISDITM,

W_BAPISDITMX TYPE BAPISDITMX,

W_BAPISCHDL TYPE BAPISCHDL,

W_BAPISCHDLX TYPE BAPISCHDLX.

W_BAPISDITMX-ITM_NUMBER = '000020'.

W_BAPISDITMX-MATERIAL = 'X'.

W_BAPISCHDLX-REQ_QTY = 'X'.

W_BAPISDITM-ITM_NUMBER = '000020'.

W_BAPISCHDL-REQ_QTY = '90'.

W_BAPISDITM-MATERIAL = 'PRETZEL6OZ'.

APPEND W_BAPISDITM TO I_BAPISDITM.

APPEND W_BAPISDITMX TO I_BAPISDITMX.

APPEND W_BAPISCHDL TO I_BAPISCHDL.

APPEND W_BAPISCHDLX TO I_BAPISCHDLX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = '0000000072'

ORDER_HEADER_INX = I_BAPISDH1X

TABLES

RETURN = I_BAPIRET2

ORDER_ITEM_IN = I_BAPISDITM

ORDER_ITEM_INX = I_BAPISDITMX

SCHEDULE_LINES = I_BAPISCHDL

SCHEDULE_LINESX = I_BAPISCHDLX.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

The dat which i have given is checked from tables...

I go into VA02 the old qty is still there without change.

What could be the problem?

Regards,

Praveen.D

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 18, 2005 at 07:47 PM

    I don't think that you are filling the tables correctly. Try this.

    
    * Sd Items
    W_BAPISDITMX-ITM_NUMBER = '000020'.
    W_BAPISDITMX-MATERIAL = 'X'.
    W_BAPISDITMX-REQ_QTY = 'X'.
    
    W_BAPISDITM-ITM_NUMBER = '000020'.
    W_BAPISDITM-MATERIAL = 'PRETZEL6OZ'.
    
    * Schedule Lines
    W_BAPISCHDLX-ITM_NUMBER = '000020'.
    W_BAPISCHDLX-REQ_QTY = 'X'.
    
    W_BAPISCHDL-ITM_NUMBER = '000020'.
    W_BAPISCHDL-REQ_QTY = '90'
    
    

    REgards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 07:43 PM

    Pass data to items tab and schedules tab.

    check the code below.

    *-- Internal tables and Structures for BAPI

    data: x_order_header_in type bapisdh1,

    x_order_header_inx type bapisdh1x,

    it_orders_items_in type standard table of bapisditm

    with header line,

    it_orders_items_inx type standard table of bapisditmx

    with header line,

    it_order_schedules_in type standard table of bapischdl

    with header line,

    it_order_schedules_inx type standard table of bapischdlx

    with header line,

    it_return type standard table of bapiret2

    with header line.

    *-- Item Details

    it_orders_items_in-itm_number = it_file-item.

    it_orders_items_in-target_qty = it_file-zmeng.

    it_orders_items_in-target_qu = it_file-zieme.

    append it_orders_items_in.

    clear it_orders_items_in.

    it_orders_items_inx-itm_number = it_file-item.

    it_orders_items_inx-updateflag = c_u.

    it_orders_items_inx-target_qty = c_x.

    it_orders_items_inx-target_qu = c_x.

    append it_orders_items_inx.

    clear it_orders_items_inx.

    *-- Schedule Lines

    it_order_schedules_in-itm_number = it_file-item.

    it_order_schedules_in-sched_line = c_0001.

    it_order_schedules_in-req_qty = it_file-zmeng.

    it_order_schedules_in-req_dlv_bl = it_file-lifsp.

    append it_order_schedules_in.

    clear it_order_schedules_in.

    it_order_schedules_inx-itm_number = it_file-item.

    it_order_schedules_inx-sched_line = c_0001.

    it_order_schedules_inx-updateflag = c_u.

    it_order_schedules_inx-req_qty = c_x.

    it_order_schedules_inx-req_dlv_bl = c_x.

    append it_order_schedules_inx.

    clear it_order_schedules_inx.

    Thanks,

    Rajesh.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 08:18 PM

    Hi there,

    Pass the 'UPDATEFLAG' of 'ORDER_ITEM_INX' and 'SCHEDULE_LINESX' as 'U'.

    Naveen

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.