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

BAPI_SALESORDER_CHANGE changing ship-to party

Hi,

i want to change ship-to party for sale's order.how to do this using BAPI_SALESORDER_CHANGE.

thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 28, 2005 at 07:22 PM

    I believe you can do this by populating the table-parameter: <b>PARTNERCHANGES</b>

    You can pass values like document no, item no, old partner number, update flag, new partner number, partner role and partner address number.

    Message was edited by: Sam

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      pradeep,

      I still see this thread as open. Please review this code as a more clear solution.

      REPORT ZR_SANDBOX_PROG.

      data: vb like BAPIVBELN-VBELN.

      data: cl like BAPISDH1X.

      data: rt type table of BAPIRET2 with header line.

      data: rt2 type BAPIRET2.

      data: pt type table of BAPIPARNRC with header line.

      vb = '0000153147'. " your sales order here

      cl-updateflag = 'U'.

      pt-DOCUMENT = vb.

      pt-ITM_NUMBER = '000000'. "header line item = 000000

      pt-UPDATEFLAG = 'U'.

      pt-PARTN_ROLE = 'WE'.

      pt-P_NUMB_OLD = '0003300744'.

      pt-P_NUMB_NEW = '0003300074'.

      append pt.

      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

      EXPORTING

      SALESDOCUMENT = vb

      ORDER_HEADER_INX = cl

      TABLES

      RETURN = rt

      PARTNERCHANGES = pt.

      loop at rt.

      write: / rt-MESSAGE.

      endloop.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

      WAIT = 'X'

      IMPORTING

      RETURN = rt2.

      Reward points accordingly.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 28, 2005 at 07:17 PM

    loop at table PARTNERS table where PARTN_ROLE = 'SH'.

    PARTNERS-PARTN_NUMB = 'your new number'.

    modify PARTNERS.

    endloop.

    loop at table PARTNERCHANGES table where PARTN_ROLE = 'SH'.

    PARTNERCHANGES-UPDATEFLAG = 'U'.

    modify PARTNERCHANGES.

    endloop.

    And don't forgot to use BAPI_TRANSACTION_COMMIT.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 28, 2005 at 07:19 PM

    P-SHIPTO = 'SHip to party'.

    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
           EXPORTING
                SALESDOCUMENT    = CMRTAB-NUMBER
                ORDER_HEADER_IN  = H1
                ORDER_HEADER_INX = H1X
           TABLES
                RETURN           = BAPIRETURN
                ORDER_ITEM_IN    = ITMFLD
                ORDER_ITEM_INX   = ITMUPD
            <b> PARTNERCHANGES       = P-SHIPTO</b>
                CONDITIONS_IN    = P-Z03X
                CONDITIONS_INX   = P-UPDATES
                ORDER_TEXT       = ORDTEXT
                EXTENSIONIN      = ORDATAB.
    
      IF SY-SUBRC = 0.                      "GOOD BAPI RETURN
        REFRESH BAPIRETURN.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
                  WAIT   = 'X'  "WAIT FOR SALES ORDER SAVE
             IMPORTING
                  RETURN = BAPIRETURN.
    
        LOOP AT BAPIRETURN WHERE TYPE = 'E'.
          WRITE: / BAPIRETURN.
        ENDLOOP.
         IF SY-SUBRC <> 0.
           CMRTAB-STATUS = 'X'.
           MODIFY CMRTAB.
         ENDIF.
      ELSE.
        WRITE: / 'ERROR IN COMMIT'.
      ENDIF.

    Message was edited by: Vijay Babu Dudla

    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.