Application Development and Automation 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: 
Read only

Problem with SD_SALESDOCUMENT_CHANGE

Former Member
0 Likes
1,755

Hello,

I am facing problem with SD_SALESDOCUMENT_CHANGE. I've to update field valuation of special stock (field KZBWS with value M) which is present in table VBAP. This field is available in the structure BAPISDIT (Table ITEMS_EX in function module SD_SALESDOCUMENT_CHANGE).

I've written following code snippet to check the update

&----


*& Report ZTEST_046341

*&

&----


*&

*&

&----


REPORT ztest_046341.

DATA: it_order_inx TYPE bapisdhd1x,

it_ord_in TYPE bapisdhd1,

it_return TYPE STANDARD TABLE OF bapiret2,

wa_return TYPE bapiret2,

it_item_ex TYPE STANDARD TABLE OF bapisdit,

wa_item_ex TYPE bapisdit,

it_sc TYPE STANDARD TABLE OF bapischdl,

it_scx TYPE STANDARD TABLE OF bapischdlx,

it_it TYPE STANDARD TABLE OF bapisditm,

it_itx TYPE STANDARD TABLE OF bapisditmx,

v_flag(1),

it_logic_switch TYPE bapisdls.

*item info

wa_item_ex-doc_number = '0000000098'.

wa_item_ex-itm_number = '000010'.

wa_item_ex-valspecsto = 'M'.

APPEND wa_item_ex TO it_item_ex.

CLEAR wa_item_ex.

it_order_inx-updateflag = 'U'.

*schedule line

DATA: wa_sc TYPE bapischdl.

wa_sc-itm_number = '000010'.

wa_sc-sched_line = '0001'.

wa_sc-req_qty = '96'.

APPEND wa_sc TO it_sc.

DATA: wa_scx TYPE bapischdlx.

wa_scx-itm_number = '000010'.

wa_scx-sched_line = '0001'.

wa_scx-updateflag = 'U'.

wa_scx-req_qty = 'X '.

APPEND wa_scx TO it_scx.

CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

EXPORTING

salesdocument = '0000000098'

order_header_inx = it_order_inx

TABLES

return = it_return

items_ex = it_item_ex.

IF sy-subrc EQ 0.

LOOP AT it_return INTO wa_return.

WRITE:/ wa_return-type, wa_return-message.

IF wa_return-type = 'E'.

CLEAR v_flag.

ELSE.

v_flag = 'X'.

ENDIF.

ENDLOOP.

IF v_flag = 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

ENDIF.

ENDIF.

But no success!!

Could anyone help me with this?

Thanks in advance.

Anup

3 REPLIES 3
Read only

Former Member
0 Likes
928

Hi,

DO not use SD_SALESDOCUMENT_CHANGE, use BAPI_SALESORDER_CHANGE.

Cheers.

...Reward if useful.

Read only

0 Likes
928

Hello J Mong,

Thanks for the reply.

I was trying BAPI_SALESORDER_CHANGE earlier.But I could not find field KZBWS in any of the structure of this BAPI.

Regards,

Anup

Read only

Former Member
0 Likes
928

Use:

BAPI_SALESORDER_CHANGE not SD_SALESDOCUMENT_CHANGE

Reward points..