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

BAPI_SALESORDER_CHANGE fails to change delivery date

We need to change a scheduled delivery date for a sales order line item.

Here is the code we are using:

DATA: WA_SALESORDER LIKE BAPIVBELN-VBELN,

WA_ORDER_HEADER_IN LIKE BAPISDH1,

WA_ORDER_HEADER_INX LIKE BAPISDH1X,

WA_ORDER_ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,

WA_ORDER_ITEM_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,

WA_SCHEDULE_LINES LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,

WA_SCHEDULE_LINESX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE,

WA_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

WA_SALESORDER = '0001706785'.

WA_ORDER_HEADER_IN-SALES_ORG = '0010'.

WA_ORDER_HEADER_IN-DISTR_CHAN = '0010'.

WA_ORDER_HEADER_IN-DIVISION = '10'.

WA_ORDER_HEADER_IN-SALES_OFF = '0010'.

WA_ORDER_HEADER_IN-SALES_GRP = '073'.

WA_ORDER_HEADER_INX-UPDATEFLAG = 'U'.

WA_SCHEDULE_LINES-ITM_NUMBER = '000001'.

WA_SCHEDULE_LINES-SCHED_LINE = '0001'.

WA_SCHEDULE_LINES-DLV_DATE = '20061005'.

WA_SCHEDULE_LINES-REQ_QTY = '3'.

APPEND WA_SCHEDULE_LINES. CLEAR WA_SCHEDULE_LINES.

WA_SCHEDULE_LINESX-ITM_NUMBER = '000001'.

WA_SCHEDULE_LINESX-SCHED_LINE = '0001'.

WA_SCHEDULE_LINESX-DLV_DATE = 'X'.

WA_SCHEDULE_LINESX-REQ_QTY = 'X'.

APPEND WA_SCHEDULE_LINESX. CLEAR WA_SCHEDULE_LINESX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = WA_SALESORDER

ORDER_HEADER_IN = WA_ORDER_HEADER_IN

ORDER_HEADER_INX = WA_ORDER_HEADER_INX

  • SIMULATION =

  • BEHAVE_WHEN_ERROR = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

TABLES

RETURN = WA_RETURN

  • ORDER_ITEM_IN =

  • ORDER_ITEM_INX =

  • PARTNERS =

  • PARTNERCHANGES =

  • PARTNERADDRESSES =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

SCHEDULE_LINES = WA_SCHEDULE_LINES

SCHEDULE_LINESX = WA_SCHEDULE_LINESX

  • ORDER_TEXT =

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN = .

.

LOOP AT WA_RETURN.

WRITE: / WA_RETURN-MESSAGE_V1, WA_RETURN-MESSAGE_V2,

WA_RETURN-MESSAGE_V3, WA_RETURN-MESSAGE_V4.

ENDLOOP.

REFRESH WA_RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = ''

IMPORTING

RETURN = WA_RETURN.

LOOP AT WA_RETURN.

WRITE: / WA_RETURN-MESSAGE_V1, WA_RETURN-MESSAGE_V2,

WA_RETURN-MESSAGE_V3, WA_RETURN-MESSAGE_V4.

ENDLOOP.

RESULTS OF THIS CODE:

The structure containing results contains four entries. None are errors:

"ORDER_HEADER_IN has been processed successfully"

"SCHEDULE_IN has been processed successfully"

"Purchase order number in document number: 0001225849 already exists"

"Standard Order 0001225865 has been saved"

We're not sure why we get the third message, but it is only a warning so we don't believe it causes the update to fail. The delivery date change is not applied to the sales order.

We also tried it without specifying the requested qty field, and we still fail to update the delivery date.

There is only one line item in the sales order and only one schedule line item. We are on release level 4.6C.

Does anyone have suggestions as to why the above did not work or what else we could try?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 03:28 PM

    Hi Tim,

    Try adding two more lines in your code -

    WA_SCHEDULE_LINES-DATE_TYPE = 'D'.

    WA_SCHEDULE_LINESX-UPDATEFALG = 'U'.

    at the correct place i.e before append.

    Cheers.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Srinivas Adavi

      Hi,

      I am a colleague of Tim & here is where we are running into a dead wall!

      The Date_type field value did not solve the issue. It give a message that the Goods issue date is in the future with reference to the Delivery Date. Our question is how do you change the delivery date only or in conjunction with the GI date?

      Easwar

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.