Changing Price Conditions in Sales Order with SD_SALESDOCUMENT_CHANGE

Hello there!
I need to change the value of a price condition in a sale order ;I'm using the f.m.  SD_SALESDOCUMENT_CHANGE.
It doesnt' work as I want, 'cause it creates an other price conditions instead of just changing the price value of the actual one.
Waiting for your tips,
thanks.
This is how my code looks like:
PARAMETER: p_vbeln LIKE vbak-vbeln.
data: st_order_header_inx   TYPE  bapisdhd1x,
        st_conditions LIKE bapicond,
        st_conditionsx LIKE bapicondx,
        tb_conditions TYPE TABLE OF bapicond,
        tb_conditionsx TYPE TABLE OF bapicondx,
        tb_return TYPE TABLE  OF  bapiret2.
st_order_header_inx-updateflag = 'U'.
  st_conditions-itm_number = '0010'.
  st_conditions-cond_type = 'PR00'.
  st_conditions-cond_updat = 'X'.
  st_conditions-cond_value = '100'. "Value I want to enter
  APPEND st_conditions TO tb_conditions.
st_conditionsx-itm_number = '0010'.
  st_conditionsx-cond_type = 'PR00'.
  st_conditionsx-updateflag = 'U'.
  st_conditionsx-cond_value = 'X'.
  APPEND ls_conditionsx TO tb_conditionsx.
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
    EXPORTING
    salesdocument                = p_vbeln
      order_header_inx          = st_order_header_inx
    TABLES
      return                           = tb_return
      conditions_in               = tb_conditions
      conditions_inx              = tb_conditionsx  .

Get the conditions records first from the Sales Order with BAPI BAPISDORDER_GETDETAILEDLIST
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
  EXPORTING
    i_bapi_view          = lw_bapi_view
  TABLES
    sales_documents      = lt_order
    order_conditions_out = lt_conditions_out.
Then populate the conditions internal table with the data that you get from the previous code
move-corresponding lw_conditions_out to lw_order_conditions_in.
lw_order_conditions_in-cond_value = '100'   " the value that you want to modify
APPEND lw_order_conditions_in TO lt_order_conditions_in.
CLEAR lw_order_conditions_inx.
lw_order_conditions_inx-itm_number = lv_kposn.
lw_order_conditions_inx-cond_st_no = lw_conditions_out-cond_st_no.
lw_order_conditions_inx-cond_count = lw_conditions_out-cond_count.
lw_order_conditions_inx-cond_type  = lw_conditions_out-cond_type.
lw_order_conditions_inx-updateflag = 'U'.
lw_order_conditions_inx-cond_value = lc_x.
APPEND lw_order_conditions_inx TO lt_order_conditions_inx.
You didn't populate the fields cond_st_no and -cond_count. Then just call BAPI SD_SALESDOCUMENT_CHANGE to change the Sales order.
Hope that helps.
Erwin

Similar Messages

  • How to change pricing Conditions in Sales order in change sales order bapi

    Hi Experts,
    How to change pricing Conditions in Sales order in change sales order bapi.
    I have used the 2 function modules bapi-changesalesorder and sd salesdocument change, But it is creating the new record , instead of changing the existing one, Could please assist regarding the same
    Thanks in Advance .
    NLN

    HI NLN
      I have just tried on my system and managed to overwrite the existing price by passing the following parameters.
      <b>Import Paramters:</b>
         SALESDOCUMENT - Sales Document Number
         ORDER_HEADER_INX - UPDATEFLAG as <b>'U'</b>.
         LOGIC_SWITCH - Import Structure - Pass 'X' to LOGIC_SWITCH-COND_HANDL.
      <b>Tables:</b>
         CONDITIONS_IN - ITM_NUMBER,
                         COND_COUNT, -> Condition counter same as KONV-ZAEHK generally it is <b>'01'</b>
                         COND_TYPE,
                         COND_VALUE,
                         CURRENCY.
         CONDITIONS_INX - ITM_NUMBER,
                          COND_COUNT,
                          COND_TYPE,
                          UPDATEFLAG as <b>'U'</b>,
                          CURRENCY.
       Hope i have clarified your query.
    Kind Regards
    Eswar

  • Report to list manual changes to conditions in sales orders and invoices

    Hi experts,
    Is there a Standard Report to list the manual changes of pricing conditions in sales orders and invoices?
    Should be a selection on the field KONV-KMPRS.
    Please advice.
    Rgds,
    Pri

    Hi priya,
    In the Sales Order,Select Environment and then Changes to See all Changes made.
    Follow the Same procdure for Invoice also.
    There is no Standard report as such to see the changes.
    Thanks,
    Neelima.

  • Add price conditions in sales order and purchase orders

    Hi,
    I need add five price conditions in a sales order, and a purchase order.
    I need filled KOMV table, however, i don't found the user-exits appropiated (example: the exit EXIT_SAPLMEKO_002 haven't parameter KOMV),
    Regards,

    Quite a few years ago I did something like this in sales orders... found the code in my notes, here it is.
    I used USEREXIT_PRICING_PREPARE_TKOMP in include RV60AFZZ.
    * Check if this condition record exists already
      read table xkomv with key kschl = c_condition_name
                                kherk = 'C'             "(depending on the task)
                                kposn = vbap-posnr.
      if syst-subrc ne 0.   "condition wasn't added yet
          clear xkomv.
          xkomv-kschl = c_condition_type.
          xkomv-kbetr = condition_amount.
          call function 'PRICING_CHECK'
            exporting
              comm_head_i = tkomk
              comm_item_i = tkomp
              komv_i      = xkomv
              preliminary = 'X'
            importing
              comm_head_e = tkomk
              comm_item_e = tkomp
              komv_e      = xkomv.
          xkomv-KWERT = xkomv-kbetr.
          append xkomv.
      endif.
    Keep in mind that I haven't used this logic for years, so you'll have to test if it still works, but it worked for me back then.
    If I'd have to do this now, I'd probably try to find a suitable enhancement point though...

  • Price conditions on Sales Orders via EDI

    Hi,
    I need to know if there is a way to bring prices over on the IDOC while posting a sales order via EDI. I have a situation where the price does not have to be determined based on condition records setup within SAP but rather update the price sent on the IDOC itself.
    Thanks
    MR

    Hi,
    Let the inbound Idoc have the price field and the price of the material. And keep the price condition type open/manual entry allowed. Once this is done the system will not do it from the condition record and will populate the data that is there in the Idoc.
    Hope this helps.
    Kind Regards
    Chakradhar

  • Watching price condition in sales order during configuration product

    Hello evrybody,
    I have a little question about product configuration during the sales order creation.
    I have done all my configuration structure and I have add prices on certain characteristics.
    However, I would like to see the price of each value of characteristic when I click on the matchcode to select the component what I need (column Condition scheduled to dysplay "Pricing information on a value").
    Can you help me please ?
    Thanks a lot for your help !!!
    Thierry

    Hi Rieu,
    I believe you are referring F4 to display the prices values instead of the conditions. You need two notes to avail the functionality. Notes 1259021 (VC ) and 1267335 (SD). If you want the values to be shown then please ensure that c_condition_price is set to X in INCLUDE LCEI0FS4
    Regards
    Amber
    SAP Support

  • Specific Price conditions at Sales Order level

    Dear Gurus,
    We have introduced some Pricing conditions and their calculations at Sales Order level and we have made it to appear at the Sales Order Output which is for Internal reference.
    We dont want the Pricing conditions to be shown in Customer Invoice.
    Kindly advise.
    Regards,
    RK

    Create the new Document Pricing procedure of the Billing Type & don't assign the Document Pricing Procedure to the Sales Area / Document Pricing procedure / customer Pricing procedure.
    Best Regards,
    Ankur

  • Change open sales order with new condition schema

    Hi SD Experts,
    I have to change condition type on condition schema. For example, now we have ZPVI (Discount %). I have to change with ZPFI (Discount %). But we have some open sales orders with old schema. Can I correct old sales orders with new condition schema? Is it possible?
    Thank you.
    Gulay Celik

    >
    Shai Sinai wrote:
    > 3) The item categories of document items are assigned to billing plan types. This customization does create separate billing plan for each item, but the billing plans of item are refrenced to the header billing plan (according database field FPLA-RFPLN and screen field RV60F-KFREL), what  means that item's values are not taken into consideration.
    >
    In this case it is obvious that it's not possible to have an item on the same document, which would have a billing plan different from the header. Unless, of course, you are ready to change the existing configuration or create a new item category, which would be independent from the header billing plan.
    If, despite configuration, such entry is possible in VA41/VA42, then you'll have to use BDC instead of BAPI. Unfortunately, BAPIs do not have all the same functionality that might be available in the transaction.

  • How to update the condition price in the sales order for all the items

    Hi,
    How to update the condition price for all the itmes in the sales order to carry out the new price automatically through a stand alone program, for all the orders in the billing due list table?
    Thanks,
    Balaram

    Hi,
    There is a change in the requirement.
    Scenario:
    I have created a sales order with some 4 condition types, in that 2 condition types are of class A & B and the other two is of class C. Here I need to update the condition price of class A & B only and the remaining condition types should not get update even though there is an updated price is available.
    For the above scenario, I need to write a standalone program. Do we have any function modules to update the price of the single condition in the sales order? Please tell me how we can update the sales order at item condition level.
    Thanks.
    Balaram

  • Automatic Freight price on Sales Order with minimum total freight for order

    Hi,
    I am stuck trying to solve a freight pricing scenario on sales orders and I was hoping that someone might have seen this problem before. There are a number of basic requirements:
    1. The freight should be calculated automatically.
    2. The freight should be based on weight and shipping condition.
    3. The total freight of the order should be minimum X Euro.
    The problem we have is to try combining these three requirements since access sequences and condition records are not used on header conditions. The first 2 should be possibe to solve using a copy of standard item freight condition KF00 and creating a new access sequence including shipping condition. However, when including the last requirement we must see to the freight price of the complete Sales order and the system must automatically if the total reaches the minimum level.
    For example, say that we have a sales order with 2 items and the minimum freight for a total order should be 10 Euro. Based on weight and shipping condition the system automatically finds condition records giving item 1 a freight price of 2 Euro and item 2, 3 Euro -> giving us a total freight of 5 Euro.
    The system should see that the total freight of the 2 items does not reach the minimum freight price and automatically use the minimum price instead.
    I have been looking at the possibility to use 2 separate condition types (since the minimum should be a fixed price), or maybe it is possible to solve this through a user exit somehow? Has anyone seen this type of problem before?
    Any input and thoughts would be highly appreciated.
    Regards,
    /Dan

    Hi Dan
    For the 1st  query , maintain access sequence and assign it to the condition type and maintain condition record for that freight condition type
    For your 2nd query , in V/06 change the calculation type of the freight condition type to gross weight /Net weight
    But as  issue is concerned   in VK12 maintain minimum & maximum values. So if the Minimum value reaches then only the condition type triggers
    So in your pricing procedure say you have a 2 freight condition types of  ZXXX & YXXX . So assign minimum & maximum order values in VK12 for ZXXX condition type . And if its maximum value exceeds then YXXX condition type should trigger.
    Regards
    Srinath

  • Restrict manual change in sales order with respect to quotation

    Hi All,
    The user use to create sales order with respect to quotation.  The user can able to change pricing as well as some header and item fields.  How can I restrict user for manual change in sales order expect some specific fields.
    Thanks.

    Hi Sunil,
    It is possible through configuration better you can post in sd forums.
    For the condition type settings , ensure that the manual entries is 'D'. it wont allow any changes in the order.
    Regards,
    Madhu.
    Edited by: madhurao123 on Aug 1, 2011 1:08 PM

  • Change header pricing condition in sales order

    Hi,
    I have an requirement in VA01 and VA02 to automatically edit one header pricing condition. The user can able to change the value of that condition type in header not in items . Does anyone know what user exit I can use for this requirement.
    Thanks

    Hi Sunil,
    Plealse find below 2 methods to change header pricing conditions in sales order.
    1.Goto SE38, give prog name as MV45AFZZ and in that write logic under USEREXIT_PRICING_PREPARE_TKOMK . (OR)
    2) The same can be done by creating a Alt Calculation type routine through VOFM and writng the logic in the routine, which will then be assigned to the pricing procedure in the condition type which will automatically calculate the condition.
    Try with the options mentioned above..
    Regards,
    KK

  • All changes in sales orders with in a week

    Hi gurus,
    I want to display a report to display all the changes in sales orders with in a week,
    Can anybody help me .If anybody already developed this report can you send to me.
    regards,
    D..

    Query table CDHDR and CDPOS with the following fields:
    CDHDR-TCODE = VA01 or VA02
    CDHDR-UDATE = <specified date range>
    Now select from CDPOS where
    CDPOS-OBJECTCLAS = CDHDR-OBJECTCLAS
    CDPOS-OBJECTID = CDHDR-OBJECTID
    CDPOS-CHANGENR = CDHDR-CHANGENR
    The rest of the details for the change can be found from the other fields in CDPOS. like tablename, fieldname, old value, new value etc.
    Hope this helps.
    Sudha

  • Create Sales order with reference to a Billing Document - Net price issue

    Hi Everyone,
        The Billing Document has one line item with Net value of 16,000. However, when I create the Sales Order with reference to the Billing Document, the net price shows 64,000.  When I check the Document flow of the Billing Document, there were two Contracts on top of my Billing Document. One is a contract with the overall status of "Being Processed" and this is where I checked the net value is 64,000. The next contract invoice is already completed (net value is 16,000).
        Has anyone encounter such case? How would I be able to create the sales order with reference to the Billing document and have the net value of what is in the Billing Document (16,000). Which part of the configuration is setting this up. Thanks!

    Hi,
    This is a very rare case, if you are sure of the scenario, would suggest you two alternatives:
    1) whenever you go against the flow of SAP, you have customize it, so its better you discuss this matter with your ABAP person.
    2) never tried it out but you can:
    you cannot see that in Billing Document that which is the sales document assigned to it, but to estblish that relationship,
    we do copy control setting from Billing Document to Sales Order type (T.Code:VTFA).
    Menupath: SPRO >> IMG >> Sales & Distribution >. sales >> Billing Document >> Copy Control >> Copy Control from Billing Document to Sales Order Type.
    Hope this will help you.
    Regards,
    Siddharth.

  • Do not change the payment term created a Sales Order with reference

    Hi Gurus,
    Do not change the payment term created a Sales Order with reference to a contract where the payer of the change in Sales Order.

    Hello ,
    As per my understanding , you do not want the payment terms to be changed even if the payer partner function is changed ,
    as standard sap redetermines the payment terms with change in partner function, you may use the exit
    USEREXIT_MOVE_FIELD_TO_VBAK- header level
    USEREXIT_MOVE_FIELD_TO_VBAP- Item level
    in this you could write a small code which will not change the payment terms when payer is redetermined
    hope this helps
    Thanks
    akasha

Maybe you are looking for

  • Eexception in java.awt.AWTError

    Hi all, I am starting with java in my Ubuntu box, and am faced with a problem. Consider a simple program import javax.swing.*; import java.awt.*; class helloSwing{      public static void main(String[] args)           JFrame myWindow;           myWin

  • Failing by duplicate database from active database

    Hallo, i'm working with 11g on one server and want to duplicate a database in active mode. what i do: i create a new password-file using orapwd - orapwNEW i create a new entry for ORANEW in tnsnames.ora and listener.ora then i execute rman TARGET sys

  • Edit ContactSheet_ID.jsx to include default template

    We're using Bridge CS3 to generate contact sheets with InDesign CS3 using Bridge CS3's Tools > InDesign > Create InDesign Contact Sheet command. We've defined an InDesign template which we're using for these contacts sheets but find it annoying to ha

  • Pictures - "media library can't be accessed"

    I have migrated from a 9860 - all phone and SD Card data (music, vids, pics) show up on Blackberry Link, through Win Explorer. I can access music and videos but when open Pictures the error msg ""media library can't be accessed. Please try again late

  • What is the correct Valuation Class?

    Hi, Can we find out most appropriate Valuation class by seeing material master data? This is for the finished Product. Since due to some integration this product has added, Now we have to suggest Appropriate Valuation class and do configuration for a