Change sold-to party BAPI_SALESORDER_CHANGE

Hello,
Does anyone know how to change partner function AG (sold-to-party) in a sales order header from within ABAP code ?
I'm using BAPI_SALESORDER_CHANGE function module to change partner functions. It works well for all other partner functions, but for the AG ("sold-to-party") function it yields a message saying that changing AG function is impossible.
Although changing "sold-to-party" partner function is disabled in user interface (VA02 transaction -> order header details), but the user DOES have the possibility to change "sold-to-party": he can change field KUNNR in main screen of transaction VA02 (this field is mapped to VBAK-KUNNR) - after changing it, the AG partner function in header details changes to the value set in it. Does anyone have an idea how to achieve the same from ABAP code ?
Regards,
Flavio.

REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
Selection Screen Definitions *
PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number
p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item
p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line
p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty
Internal Tables/Structures/Variables for calling BAPI. *
DATA: i_hdr TYPE bapisdh1,
i_hdrx TYPE bapisdh1x,
i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
wa_ret TYPE bapiret2.
DATA: BEGIN OF i_sched OCCURS 10.
INCLUDE STRUCTURE bapischdl.
DATA: END OF i_sched.
DATA: BEGIN OF i_schedx OCCURS 10.
INCLUDE STRUCTURE bapischdlx.
DATA: END OF i_schedx.
START-OF-SELECTION Event *
START-OF-SELECTION.
*" Initialize internal tables.
REFRESH: i_sched, i_schedx, i_ret.
CLEAR: i_sched, i_schedx, i_ret.
*" Fill required ORDER_HEADER_IN data.
i_hdrx-updateflag = 'U'.
*" Fill required SCHEDULE_LINES data.
i_sched-itm_number = p_posnr.
i_sched-sched_line = p_etenr.
i_sched-req_qty = p_reqqty.
i_schedx-updateflag = 'U'.
i_schedx-itm_number = p_posnr.
i_schedx-sched_line = p_etenr.
i_schedx-req_qty = 'X'.
APPEND i_sched.
APPEND i_schedx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = i_hdr
order_header_inx = i_hdrx
TABLES
return = i_ret
schedule_lines = i_sched
schedule_linesx = i_schedx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT i_ret.
WRITE / i_ret-message.
ENDLOOP.

Similar Messages

  • How to change sold to party in sales order

    Hi
    We have the below requirment of changing sold to party after creation of sales order...
    Below is the scenario
    Once sales order is created,purchase requisition is created autamatically and purchase order is created with reference to the purchase requisition..So when Goods receipt is done,the respective stock is getting reserved for that sales order...
    We wanted to change the sold to party option.
    After creation of purchase order,sold to party option in sales order is display only..
    Can u tell us how to make it changeable...
    Regards
    Sudha

    Hi,
    Why don't you try to make the Partner Function for Sold to Party as Modifible (Don't select Non Modifible) for the Sales Order Header in partner determination determintaion setting in customizing.
    You have to check with the partner determination procedure assigned to your sales order type and check accordingly.
    Reward points if it helps.
    Regards,
    Harsh

  • How to change sold to party description

    Hi all,
    I want to change sold to party description to customer in VA11/ VA21/VA01 (sold to party).
    Is there any possibility to change it?
    Please give me solution if it is possible............
    Thanks in advance
    Babu

    Dear Babu,
    There are two ways to change the description of Sold to party:
    1. XD02 / VD02 - Change the Customer description, which would be Master Data change & would effect all Documents.
    2. At time of Sales Order processing (which is what you want): VA01 / VA02 - Double click on Sold-to-party code & you will go to Header - Partner Data - Here once again click on Customer Code of required partner (Sold-to-Party in your case) & make the necessary changes.
    There changes would be applicable only for the particular Sales Order & the Master Data would not be changed.
    Hope this helps...
    Thanks,
    Jignesh Mehta

  • Change sold to party in sales order

    hi all.
    can anyone help me out in changing the sold to party in sales order where can we change
    Thanks
    sridhar

    Dear sridhar
    If no subsequent document is generated, you can change the sold to party in VA02.  If delivery or invoice is generated, then you cannot change the sold to party in sales order.  Either you have to reverse / cancel those subsequent documents or create a fresh order
    thanks
    G. Lakshmipathi

  • How to change Sold-to party in S.O when creating with ref to Quotation

    Dear All,
    We are creating Sales Orders with reference to Quotation.
    The requirement is that the same quotation will be used for different sold-tp parties when creating sales order. Currently the System does not allow to change the Sold-to when creating Sales Order for a different Sold-to with reference to a Sales order (that was created with a different Sold-to).
    Please let me know the best possible options so that the sold-to party in the sales order can be changed when creating with reference to Quotation that is created with a different sold-to party.
    Regards
    Venkat.

    Hi,
    Try This.
    IMG-SD-SALES-MAINTAIN COPY CONTROL FOR SALES DOC-SALES DOC TO  SALES DOC.
    Choose the required sales DOCs and change the settings of Coping Requirements to 2
    I think this will solve ur issue..
    Regards,
    boseavi

  • Change sold-to party VA02 - XD02 supply company code

    Hello everyone
    I am in the editing or creation mode of an order (VA01/VA02) and want to change the data of the sold-to party. Therefor i use the 'Display sold-to party'-Icon in the order (F6) to jump to the customer change dialog (XD02).
    I get the message "Customer XXXXXXXX has not been created for company code XXXX" and the message is correct, cause in the XD02 dialog the company-code field is initialized with the wrong company code.
    For example:
    The order is created for sales organization 0300 and company code 0300 and the sold-to party is also created for these. But if i jump to the 'customer change'-Transaction useing the button in the oder (F6) the sales-organization-inputfield is initialized with 0300 and and the 'company code'-field is initialized with 0100.
    While debugging i saw that the called transaction XD02 determines the company code useing GET PARAMETER ID 'BUK' FIELD rf02d-bukrs, but the parameter was never set by VA02/VA01.
    How can i teach the VA01/VA02 to supply the company code to the called transaction (XD02)?
    Kind regards
    Markus

    Hi,
    Pl clarify on the following points:-
    1> When you click F6 in sales order after entering sold to party, it will not take you to XD03 screen rather it should be VD03.  So how did you get the extension error message?
    2> Have you provided any sales org in the initial screen where we usually give order type and sales area?  From there sales org would've come in order header.  Based on the mapping of sales org to company code in SPRO, company code would ve been determined.  (Hope you have one to one mapping)
    3> If you have not provided any sales area in the initial screen, it would've prompted you to select the sales area from the available list of sales areas.
    Since you are not entering into the company code view of customer from sales order, it is not necessary to supply company code from order to XD02.
    Regards,
    P Gomatheeswaran

  • Changing Sold-to party on an open sales order deletes item text

    Hi,
    When changing the sold-to party on an open sales order document, all of the item text is deleted.  Is there a way to prevent this from happening, or is this standard?
    Thanks,
    Craig

    If u r wishing to change the sold to party for a particular item it means u r not selling that item to him. U cant have 2 different sold to parties  in a single sales order.. U can change other partner functions at sales order level but not sold to party partner function....
    U can assign reason for rejection to close this particular order and raise a fresh order in favor of the sold to party u wish to for that particular item...
    Message was edited by:
            srinivas rao

  • BAPI_SALESORDER_CHANGE problem: change sold-to-party

    Hi guys,
    I am having a problem with my current dev. I am using BAPI_SALESORDER_CHANGE to change the sold-to of a sales order.
    However, I am getting error message: "You cannot change entry in partner function XX".
    Can anyone help me on this?
    Thanks!
    jac

    hi,
    REPORT  ZMYBAPI2                                .
    data : ordervbeln like bapivbeln occurs 0 with header line,
           order_header_in like bapisdh1 occurs 0 with header line,
           order_header_ix like bapisdh1x occurs 0 with header line.
    data : order_items_in like bapisditm  occurs 0 with header line,
           order_items_ix like bapisditmx occurs 0 with header line.
    data : order_partners like bapiparnr occurs 0 with header line.
    data : return1 like bapiret2 occurs 0 with header line.
    data : w_vbeln like bapivbeln occurs 0 with header line.
    data:
         order_schedules_in like bapischdl occurs 0 with header line,
         order_schedules_inx like bapischdlx occurs 0 with header line.
    order_header_in-sales_org  = 'JNJ1'.
    order_header_in-distr_chan = '02'.
    order_header_in-division   = 'J1'.
    order_header_in-sales_off  = 'JNJ1'.
    order_header_in-purch_no_c = 'testbapipo'.
    order_header_in-purch_date = sy-datum.
    order_header_in-req_date_h = sy-datum.
    append order_header_in.
    order_items_in-material      = '000000000000000727'.
    order_items_in-plant         = 'JNJ1'.
      append order_items_in.
      order_partners-partn_role = 'AG'.
      order_partners-partn_numb = '0000000011'.
      append order_partners.
      order_schedules_in-itm_number = '10'.
      order_schedules_in-req_qty   = '10'.
      append order_schedules_in.
    *Updating the indices
      order_header_ix-updateflag = 'U'.
      order_header_ix-sales_org  = 'X'.
      order_header_ix-distr_chan = 'X'.
      order_header_ix-division   = 'X'.
      order_header_ix-sales_off  = 'X'.
      order_header_ix-purch_no_c = 'X'.
      order_header_ix-purch_date = 'X'.
    order_header_ix-req_date_h = 'X'.
      append order_header_ix.
      order_items_ix-updateflag    = 'U'.
      order_items_ix-material      = 'X'.
      order_items_ix-plant         = 'X'.
      order_items_ix-division      = 'X'.
      order_items_ix-target_qu     = 'X'.
      append order_items_ix.
      order_schedules_inx-updateflag        = 'U'.
      order_schedules_inx-itm_number       = 'X'.
      order_schedules_inx-req_qty          = 'x'.
      append order_schedules_inx.
    call function 'BAPI_SALESORDER_CHANGE'
      exporting
       salesdocument               =
       ORDER_HEADER_IN             = order_header_in
        order_header_inx            = order_header_ix
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      tables
        return                      = return1
       ORDER_ITEM_IN               = order_items_in
       ORDER_ITEM_INX              = order_items_ix
       PARTNERS                    = order_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              = order_schedules_in
      SCHEDULE_LINESX             =
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
    if sy-subrc ne 0.
        write: return1-message,return1-number,return1-type.
      else.
          write: return1-message,return1-number,return1-type.
          call function 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         WAIT          =
       IMPORTING
         RETURN        =
      endif.
    This may give an idea, This program written on 4.6B.
    still u r problem not solved, please post the code
    regards,
    pavan

  • How to change sold to party

    Dear Gurus,
    We need to create a lot of Quotations each day and only few of them get converted to sales order. So if we create Customers Masters for the creation of Quotations, we will end up with a lot of useless customer masters. So we want to create a Quotation with a One Time Customer account and then only if the customer confirms the deal we want to create the sales order with the newly created customer code.
    But in the over view screen of the sales order (which is created with reference to the Quotation), system is not allowing the change of SP.
    In VTAA for these documents we have assigned 002 'Header Diff Customer' in Copying Requirements. Still . . . .
    What can I do to acheive this requirement, with out this, we will end up with unnecessary CMRs. Plz help us out here gurus.
    Thanks and regards.
    Venkat - Hyd

    Sorry all, I just noticed my error in asking a question. I should have clarified that we need to create an Inquiry - Quotation - Sales Order.
    Dear Amitesh,
    Like I said in my question, in VTAA's copy requirements putting 002 is not working. Anything else?
    Dear Anjaneyulu,
    The requirement is to create an Inquiry - Quotation - Sales Order. Since our client receives around 30 to 40 enquiries per day, they need to capture them and prepare those many Quotations and sent out.
    They need to do all this in the system so the management can track the number of Inquiries received, the number of Quotations sent and the number of Order secured.
    For this they dont want to create Customer Master Records since all the Quotations will not get them orders, hence the need to create Inquiry and Quotation with a One Time Customer, where all the Enquirers' details are captured and then for only those Orders which are received, they want to create a Customer Master Record and with that number create a Sales Order. They need to have a Document Flow from Inquiry to Quotation to Sales Order for all the orders received, so we need to change customer number in the sales order. Cannot change in Quotation as there is an Inquiry as a preceeding document and system is not allowing to change the SP.
    Any ideas??
    Regards
    Venkat - Hyd

  • Reversing the billing an change the sold to party...

    Hello Experts...
    We have a complete Sales Order submitted which has a mile stone based billing. The sold to party (A) has paid 4 installments out of 10 installments. He now wants to take back his 4 payments and change the Sold to Party to B. The new Sold to party (B) will pay the 4 installments and continue with the payment of balance installements. There is no change in the materials sold and pricing. The customer does not want to cancel the sales order and create a new sales order.
    This is a high priority issue. Kindly advice asap.
    Thanks and Regards

    Dear Patnaik,
    I think you can do like this, try with this......
    You do the reverse or cacel for the 4 instalments which sold to party A has paid.
    You need to reverse or cancel the all susequent documents of the sales order
    Make sales order status as open
    Now you can change sold to party to B in the sales order in VA02 transaction
    I hope it will help you
    Regards,
    Murali.
    Edited by: Murali Mohan.Tallapaneni on May 16, 2008 2:43 PM

  • Change the sold to party

    Hi expert,
                     Can i change " Sold to party code"  after the creation of the sales order.
    Regard
    Shashi

    Hi
    After the sales order say order no 10000 saved for sold to party as X you cannot change the sold to party in VA02 transaction as Y for order no 10000
    That means if the order is created and saved then you cannot change the Sold to party for that order
    But while processing it self before saving in VA01 transaction itself it is possible to change the SP
    after the creation of the sales order.
    Not possible
    You cannot touch SP in VA02 transaction irrespective of subsequent document is there or not and the
    img settings said under partner determination for sales document types  say TA for standard order there also i dont think you can change the standard settings as the SP is mandatory and not modifiable
    You cannot  remove the tick in non modifiable for  SP for TA the standard sales doc type partner determination and make it
    modifiable
    Regards
    Raja
    Edited by: ramanathan raja on Nov 1, 2009 12:33 PM

  • How to make Sold-to party field changable in va02

    Dear all,
    I want to change sold to party in Sales order but this field is coming in grey mode. How I can make it to changable.
    Thanks&regards
    Manoj Topal

    Hi Manoj
    -> Use t.code SHD0
    -> Give t.code VA02 , Then give Business object - BUS2032
    -> Select the Program screen and click on display /  change icon and enter into that screen and then check   wheather required data is in which mode , (disable/ required/visible)
    ->Then change the data to disable/ required/visible mode as per your requirement
    NOTE : Search in the forum also
    Regards
    Srinath

  • Sold to party non editable in return case

    HI ..All,
    I have a scenario after return of sales process ,business wants  the same material to be delivered to the customer in normal sales process again.In that case while creating a new sales orde for that it will take the reference of original sales order and copy all from there . Now i want that in this new sales order Sold to party field should come as non editable mode so that no one can change sold to party.
    Pls advc how to do it
    thnks in advc

    Hello,
    Anyways you are creating a new Sales Order with reference to previous document make Partner Function of Sold to Party Non-modifiable in Sales Order.
    IMG - Sales and Distribution - Basic Functions - Partner Determination - Set Up Partner Determination - Set Up Partner Determination for Sales Document Header -
    Here select TA - Standard Order & Double click on "Partner Functions in Procedure" on left side.
    In the subsequent screen select conbination if TA (Standard order) & SH (Sold to Party) & insert Tick Mark in Check Box of non-modifiable.
    This will ensure that Sold-to-Party in Non-modifiable in Sales Order. This is also a standard SAP recomended setting.
    Hope this helps...
    Thanks,
    Jignesh Mehta

  • Regarding Sold to party

    Hi Friends
    Can we change sold to party to ship to party
    or
    Ship to party to Sold to party
    If possible what is the procedure
    Plz reply me

    Hi,
    Changes to the account group and the accompanying partner functions can only be made from a lower level to a higher level.
    For example, this means that a sold-to party cannot be assigned the function of a payer as fields which have already been maintained for this sold-to party would have to be masked. However, you can assign the sold-to party function to a payer.
    You can change the account group for the following partner functions:
    Ship-to party, Bill-to party, Payer.
    So a ship-to-party can be changed to Sold-to using  XD07.
    Prase

  • Not able to change the value in 'sold to party' once disabled.

    Hi,
    I am validating the Business partner entered in the 'sold to party' field while creating a sales order in webclient UI.
    The error message pop up as expected but the field becomes disabled. I tried changing the field to editable by setting  rv_disabled = 'FALSE' in method GET_I_SOLDTO_NAME.
    Now the field is editable but it does not take the new value which i enter. it takes the old value only.
    How do i make the field to accept new values?
    Thanks in advance.
    Regards
    Shanthi.

    Hi Shanthi,
    Just check small config in your Partner determination profile if it helps you:
    Path: SPRO->CRM->Partner Processing->Define Partner Determination Procedure-
    Open you Partner determination Profile and go in details Sold-to-party partner and Mark Check box Changable to allow to make changes in partner.
    Regards,
    Dipesh.

Maybe you are looking for

  • Quantifying "NULL" in Sharepoint Designer 2013

    I am a bit new to Sharepoint Workflows and development so this could be an easy question but, I am trying to figure out how to quantify NULL as a value I am looking for in an If statement. The purpose of the workflow is to notify a user when he/she h

  • Convince me to buy a zen mi

    Hi, I'm using a zen touch which is great and now my son wants a zen micro, having read the posts on here, I get the impression that it is a pile of junk! However I do realize that most people posting here are looking for answers to problems and there

  • Cannot use yahoo mail with the mailto feature

    I bought a new computer with 2 users on it and installed firefox. I changed the 1st user firefox to use yahoomail for the mailto feature ok.. However, on the 2nd user the link to be sent was in the address of yahoo mail. I have not solved this proble

  • HT201317 IPad and PC syncing of Photostream not working?

    Hi, my ipad says that sync will resume when my Windows PC is available. ie no photos are loading to iCloud. I`ve checked that Photostream is ticked on PC - any ideas where I`ve gone wrong? Thanks.

  • Flash menu bar's hyperlink doesn't work after imported into dreamweaver

    I have major problems when I tried to import a flash menu bar with hyperlink (created in flash) into dreamweaver. I have 5 buttons in the same flash banner file and each button is supposed to have its unique hyperlink. None of these 5 hyperlinks is w