How to update pricing condition in sales in batch in the evening

Gurus,
I have a situation where I am supposed to update the freight charge condition type ("ZFR9" in my organization) on a scaled basis, depending on how much the customer (ship-to) has ordered on the same date. Since this changes from time to time, I need to write a program that does the following in the background in the evenings.
1) Accumulate the wt of the material ordered by the same ship-to customer on the same delivery date.
2) Find the scaled freight rate from a central universal freight charge table.
3) Update the ZFR9 by this new frieght rate in all such sales order/line items that have the delivery date in question.
The problem with using BDC is that the condition type ZFR9 appears on different lines depending on presence or absence of other condition types.
Also I could not find any BAPI that does the update on a line item pricing condition.
I am on 4.6C.
Thanks for any help you can offer me.
Regards
Raju

Guys,
I am trying to make this work. I am able to add extra pricing conditions to sales order but I can not understand
- how to change the value of an existing condition type OR
- how to delete the condition type from the sales order line item
Here is the sample code that I am using to test this out (most of the information is hard coded so that I can focus on a particular record)
REFRESH RETURN.
    CLEAR   RETURN.
    REFRESH ORDER_ITEM_IN.
    CLEAR   ORDER_ITEM_IN.
    REFRESH ORDER_ITEM_INX.
    CLEAR   ORDER_ITEM_INX.
    REFRESH PARTNERCHANGES.
    CLEAR   PARTNERCHANGES.
    REFRESH CONDITIONS_IN.
    CLEAR   CONDITIONS_IN.
    REFRESH CONDITIONS_INX.
    CLEAR   CONDITIONS_INX.
    CLEAR SALESDOCUMENT.
    CLEAR ORDER_HEADER_INX.
Move screen accepted docnumber TO SALESDOCUMENT.
    MOVE P_VBELN       TO SALESDOCUMENT.
    ORDER_HEADER_INX-UPDATEFLAG = 'U'.
    APPEND ORDER_HEADER_INX.
Move screen accepted line item
    ORDER_ITEM_IN-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_IN.
Move screen accepted line item
    ORDER_ITEM_INX-ITM_NUMBER = P_POSNR.
    ORDER_ITEM_INX-UPDATEFLAG = 'U'.
    APPEND ORDER_ITEM_INX.
Set the condition value
    CONDITIONS_IN-ITM_NUMBER      = P_POSNR.
    CONDITIONS_IN-COND_ST_NO      = '230'.
    CONDITIONS_IN-COND_COUNT      = '01'.
    CONDITIONS_IN-COND_TYPE       = 'ZSR3'.
    CONDITIONS_IN-COND_VALUE      = '333.00'.
    CONDITIONS_IN-CURRENCY        = 'USD'.
    CONDITIONS_IN-COND_UNIT       = 'LB'.
    CONDITIONS_IN-COND_P_UNT      = '100'.
    APPEND CONDITIONS_IN.
    CONDITIONS_INX-ITM_NUMBER     = P_POSNR.
    CONDITIONS_INX-COND_ST_NO     = '230'.
    CONDITIONS_INX-COND_COUNT     = '01'.
    CONDITIONS_INX-COND_TYPE      = 'ZSR3'.
    CONDITIONS_INX-UPDATEFLAG     = 'X'.  " update
    CONDITIONS_INX-COND_VALUE     = 'X'.  " update
    CONDITIONS_INX-CURRENCY       = ''.   " no update
    CONDITIONS_INX-COND_UNIT      = ''.   " no update
    CONDITIONS_INX-COND_P_UNT     = ''.   " no update
    APPEND CONDITIONS_INX.
    WRITE: / 'BAPI Called for', P_VBELN, P_POSNR .     
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = SALESDOCUMENT
  ORDER_HEADER_IN             =
        ORDER_HEADER_INX            = ORDER_HEADER_INX
  SIMULATION                  =
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
      TABLES
    RETURN                      = RETURN
   ORDER_ITEM_IN               = ORDER_ITEM_IN
   ORDER_ITEM_INX              = ORDER_ITEM_INX
  PARTNERS                    =
  PARTNERCHANGES              = 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              =
  SCHEDULE_LINESX             =
  ORDER_TEXT                  =
  ORDER_KEYS                  =
     CONDITIONS_IN               = CONDITIONS_IN
     CONDITIONS_INX              = CONDITIONS_INX
  EXTENSIONIN                 =    .
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                WAIT = 'X'.
IMPORTING
  RETURN        =
    ELSE.                                           
     WRITE: ' BAPI RETURN CODE = ', SY-SUBRC.              
    ENDIF.

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

  • How to read pricing conditions on sales order

    Hi
    i need to retrive pricing conditions of sales order but before posting sales order
    any user exit avialable ...?
    also i hv found one user exit in that there is FM EXIT_SAPMV45A_003
    But i am not able to read pricing conditions values
    also no data is there in konv table coz sales order has yet not been post
    so before sales order can i read the pricing conditions values ...
    pls guide
    if possiple pls provide example also
    thanks
    Taran

    Hi
    The problem is you can't use the KNUMV, because u make sure to get the princing active in the document at run time.
    If you want to know the old data you can read the table KONV using field KNUMV, but here you can't know if some modification is done.
    U can try to know the field-symbols:
    DATA: XKOMV LIKE KOMV.
    DATA: FIELDNAME(30) VALUE '(SAPMV45A)XKOMV[]'.
    FIELD-SYMBOLS: <TKOMV> TYPE TABLE.
    ASSIGN (FIELDNAME) TO <TKOMV>.
    LOOP <TKOMV> INTO XKOMV.
    ENDLOOP.
    Max

  • How to update pricing condition type in a cancelled invoice?

    I have one invoice(let say invoice number 01) which did not posted any accounting documents because one condition type in pricing procedure didn't had any record at the time of creation of invoice. so i cancelled the previous invoice and maintained the condition record of the condition type and again invoiced(let say invoice number 02) the delivery which posted the correct accounting documents.
    Now the problem is that when i am going to the invoice number 01 in change mode and trying to update the pricing procedure by going to item level then the system is now allowing to update the pricing procedure as the UPDATE TAB is grayed out and i cant click on it. (is it because for invoice nummber 01 follow on cncllation invoice has been created? or any other reason and is ther a solution for this?)
    action required: i want to update the invoice number 01.

    Dear Manpreet500,
    If the invoice not having the accounting document no need to cancell that invoice.
    In your case you might have done like this without cancell the invoice 01.
    -->Create condition record for the condition type which was missed while creating invoice.
    -->After creation of condition record you just go to VF02 transaction enter invoice 01 then go to condition tab here you can find the Update tab click on the Update tab now system will take you to the Pricing selection screen here you select B- Carry out new pricing now system will consider the condition record for the missed condition type.
    Now you can release the 01 invoice manually by clicking on green Flag.
    You can not update the 01 invoice may be due to the subsequent document cancelled invoice.
    I hope this will help you,
    Regards,
    Murali.

  • Inserting Pricing condition in Sales order when saving the sales order

    Dear ABAPers,
           My customers requirement is when saving the sales order new pricing condition has to be updated in the line item.for this i am using the User Exit 'USEREXIT_SAVE_DOCUMENT_PREPARE' ( MV45AFZZ).While saving the Sales order i am calculating the Price and updating in the Pricing conditions.
    In XKOMV internal table i am appending the pricing condition.But the problem is ,it is not calculating the taxes and it is Updating in VBAK and VBAP.
    How to do this.
    Thanks & Regards,
    Ashok.

    Dear ABAPers,
    I have Solved this Problem.
    Thanks & Regards,
    Ashok.

  • How to update  pricing in open sale order

    Hi all
    in open sale order suppose my basic price has been changed .how Can i update all open sales order basic price in one shot.

    Dear Sachin,
    Please follow the point as given below;
    1. In VTFL for your item category maintain pricing type as B if it is delivery related billing and if it is order related billing VTFA maintain pricing type as B and one more thing maintained Billing Quantity as C if you using VTFA and Billing Quantity as D if you using VTFL.
    2. Create the new condition records in VK11 for your new price ( Do not change the existing  condition record in VK12) with proper validity dates
    3. Use update button in billing the system will pick the new record by accessing VK11 in billing.
    Try this, it will work.
    Regards,
    Bharat B

  • How to migrate pricing condition data using lsmw

    Hello All,
                 can any one explain how to migrate pricing condition data using lsmw.
    the scenario is we are trying to extend the pricing conditions from one sales area to other sales area on a combination of sales organization, distribution channel and division.

    Hi Sreedhar Kodali
    Pricing conditions can be extended with the following options:-
    1)  Customer / material with release status
    2)  Sales Org / Dist. Channel / Cust group / Material
    3)  Price List category / Currency / material with release status
    4)  Material with release status
    Assuming that your pricing condition in one sales area is different to another, first you have to create LSMW recording to extend the sales area and then pricing conditions can be uploaded accordingly.
    Thanks
    G. Lakshmipathi

  • Update Pricing elements for sales order item

    Hello All,
    I want to add few manual pricing elements to a sales order item through code (the pricing elements to be added will be determined dynamically). Is there any BAPI  or user exit to update the same?
    Regards,

    Hi
    You can use the BAPI_SALESORDER_CREATEFROMDAT2 for creating  the sales order.Using this you can populate the pricing conditions for sales order. To pass the Pricing conditions use the str ORDER_CONDITIONS_IN & ORDER_CONDITIONS_INX in BAPI.
    Regards,
    Raghu.

  • Authorisation for pricing conditions in sales order

    Hi,
    This could be a tipical requirement. he requirement is a sfollows:
    Some users should not be allowed to enter / change some of the pricing conditions (manual) in the create / change mode of sales order (VA01/VA02). But they should be allowed to enter/change couple of other condtion types (manually).
    The other requirement is to disable the functionality of adding new condtions type through dropdown in the item pricing condition screen in VA01/VA02. The pricing update button also should be in a disabled mode for some users.
    Please advice me whether this can be achieved through some user exits or Basis authorisation?
    Regards,
    Sam

    Hi,
    Yes this can be done. If you are on EP4 you cna use the Badi PRICING_AUTHORITY_CHECK_UI to disallow users to use certain conditions.
    If you are not on EP4 you can still use the exit userexit_field_modification in program LV69AFZZ to check against authorisation.
    Choose the one that best suits your needs.
    Regards,
    Naveen

  • 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

  • How to update cost condition VPRS and Updation from VPRS to new cond ZVPR

    Hi All,
    How to do and is there any way to update the VPRS cost condition whenever vendor sends confirmation of material and cost after purchase order.
    After receiving the confirmation form the vendor,the VPRS cost condition should get updated in the system automatically.
    We have one cost condition type ZVPR which is same and consists of same properties of VPRS. How to update this ZVPR condition from VPRS Condition.
    Thanks in advance....
    Regards....Venkat
    Edited by: venkat t on Feb 16, 2009 11:57 AM

    Hi venkat
    Check the link
    [How to update cost condition VPRS and Updating from VPRS to new cond ZVPR;
    NOTE : Dont post in many forums
    Regards
    Srinath

  • How to view pricing conditions in a scheduling agreement?

    Dear Friends
    Will you please tell me how to see pricing condition and tax conditions in a scheduling agreement?
    Thanks
    Chandra

    Hi chandra,
    U can select line item & use shift+F6 u wll find conditions.
    If u want to see conditions like in PO.   Select line item go to header tabs in item   select price simulation
    Here put the qty u want to have simulation then see the result.
    Hope this will solve ur problem.
    Pls give ponts if answer is correct.
    Regards
    Gitesh

  • Manual Pricing Condition for sales order!!

    Hi,
    I have an issue, My requirement is I have to add a manual pricing condition in sales order header level. I have define the pricing condition for Freight Charges and that I have added to the pricing procedure that we have used for the transaction.
    The problem is when Iam creating the order in the condition tab manully want to choose the condition type, but what I created condition type (Freight Charges) is not appearing in the view. Only exesting condition types only appearing in tha selection view. I am on CRM Stand alone
    Pls anyone can advise where I miss the setting, I am new in CRM PRICING
    Regards
    VJ

    Hello VJ,
    You must consider that there is a setting "manual" in the pricing procedure customizing, indicating that the condition must be manually entered, and also a setting in condition type  customizing regarding changes that can be made. In condition type customizing you should NOT have option D "Not possible to process manually". Have you checked condition type customizing?
    Additionally please execute function module from note 867428 ( IPC_DET_CLEAR_CUST_BUFFER ).                
    This will ensure that all the customizing changes are immediately available  ( otherwise you would need to wait until the automatic buffer refresh occurs, by default once per day 
    Best Regards
    Luis Rivera

  • How to update to ios7 beta??without paying the mebership fees

    how to update to ios7 beta??without paying the mebership fees

    You're asking how to breach the terms and conditions of your contract on a forum on apples official site.

  • Sales order: How to add pricing conditions at item level in BDC of VA01

    Hello Experts,
    Am writing BDC for sales order, in this process I need to add ITEM PRICING CONDITIONS, so, am selecting item and pressing the DOLLAR symbol button and am adding the conditions by pressing PLUS button in loop!! but am getting this erorr- Field KOMV-KMEIN (2) is not an input field!! when I execute it in we19-BACK GROUND only!! if I execute the same CODE IN we19-Fore ground, I dont have any issue!!  I checked this SDN (field status in config), Google, but did not helped me!
    Pls. let  me know is there any other way to add conditions at item level in VA01 in BDC code?
    THank you

    Hi,
    It is happening because the second row of the item level data screen is becoming display only. Please check whether In foreground mode you are pressing an extra enter to give data in the second row of the item level data after giving data in the first row and in BDC recording you have not recorded that 'Enter'.
    Regards,
    Gargi

Maybe you are looking for

  • Can't install windows seven on lion...

    Hi! Configuration is: macbook pro 15" 2011 mac os Lion 10.7.2 bootcamp is 4.0.1 My windows Seven licence is a MSDNAA licence with sp1 included ... I can't install it. I define 30Gb partition for windows using bootcamp. It formats the partition then r

  • Plz tell me about witch module is the best for me

    Dear Frnds..... i am completed MBA (HR & Marketing) Please tell me witch SAP module is the best one for my feature Please give me some suggestions.....

  • Border levels not matching between columns

    Hi! Ihave a little problem within one of my reports as the border hights doesnt match between two columns, see  under Affordable and Core in the picture below. Anybody that has a solution to this problem? Br Arne Arne Olsson

  • Flashing folder with a question mark in it when starting up

    Hi, I own a white MacBook that is fairly new. When I boot it there is a flashing folder with a question mark in it. I read here: http://support.apple.com/kb/TS1440 what to do. I inserted my Leopard disc, held C while booting and then opened Disc Util

  • NSU 01.03.040.27060 does not install

    THE NSU INSTALLATION QUITS SAYING MINIMUM MEMORY REQUIREMENT IS 256 MB, THOUGH I HAVE A HP CENTRINO LAPTOP WITH 256 MB RAM. WHAT IS THE SOLUTION TO THIS PROBLEM? ANY FIXES AVAILABLE? I REALLY WANTED TO UPDATE MY PHONE SOFTWARE......PLEASE HELP!!!!!!!