Skip to Content
0
Former Member
May 20, 2008 at 10:32 PM

Problem with SD_SALESDOCUMENT_CHANGE

297 Views

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