cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CHANGE

lijisusan_mathews
Active Contributor
0 Kudos

Hi,

I want to change the quantity of order by using the function module BAPI_SALESORDER_CHANGE.

I used both the function modules BAPI_SALESORDER_CHANGE and 'BAPI_TRANSACTION_COMMIT'.

But after executing the function modules ,the required quantity which is passed is getting added with the existing quantity instead of updating the field with the new value .

eg: old value - 10

new value - 5

field should be - 5

but currently field is - 15

and here is my code.

DATA: w_order_header_in TYPE bapisdh1,

w_order_header_inx TYPE bapisdh1x,

it_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,

it_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,

it_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,

it_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,

it_return TYPE STANDARD TABLE OF bapiret2." OCCURS 0 WITH HEADER LINE.

DATA : wa_return LIKE LINE OF it_return.

REFRESH it_return[].

w_order_header_inx-updateflag = 'U'.

w_order_header_inx-collect_no = ''.

it_item_in-itm_number = '000020'.

APPEND it_item_in.

CLEAR it_item_in.

it_item_inx-updateflag = 'U'.

it_item_inx-itm_number = '000020'.

APPEND it_item_inx.

CLEAR it_item_inx.

it_schedule_linesx-itm_number = '000020'.

it_schedule_linesx-sched_line = '0001'.

it_schedule_linesx-updateflag = 'U'.

it_schedule_linesx-req_qty = 'X'.

APPEND it_schedule_linesx.

it_schedule_lines-itm_number = '000020'.

it_schedule_lines-sched_line = '0001'.

it_schedule_lines-req_qty = 10.

APPEND it_schedule_lines.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = '0000002968'

order_header_inx = w_order_header_inx

TABLES

return = it_return

order_item_in = it_item_in

order_item_inx = it_item_inx

schedule_lines = it_schedule_lines.

WAIT UNTIL it_return[] IS NOT INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

could you please help me in finding a solution.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

SCHEDULE_LINESX = it_schedule_linesx.

is missing in your example...

but then, it works perfect (not cumulating) in my system (ECC 6.0) also if more than one SchedLine are involved.

Are there already deliveries on your SaleItem ???

Answers (2)

Answers (2)

lijisusan_mathews
Active Contributor
0 Kudos

it worked when i used only schedule lines tables, and removed the fields for quantity from order_item tables.

former_member206632
Participant
0 Kudos

Hello,

Shouldn't you be filling ORDER_ITEM_IN-TARGET_QTY? From a quick look at your code it seems that you try to change the schedule but not the item.

Regards,

Joao