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

Problem with SD_SALESDOCUMENT_CHANGE

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 21, 2008 at 03:54 AM

    Hi,

    DO not use SD_SALESDOCUMENT_CHANGE, use BAPI_SALESORDER_CHANGE.

    Cheers.

    ...Reward if useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 21, 2008 at 04:21 AM

    Use:

    BAPI_SALESORDER_CHANGE not SD_SALESDOCUMENT_CHANGE

    Reward points..

    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.