IPC Java userexit-pricing routines

Hi experts,
I am new to IPC  java pricing routines and i have a requirement like this,
1. The user enters manually in Quote the new price. (say cond type ZNEW)
2. The cond record for ZTKE is available with the price as well as Max price and Min Price.
3. The Routine formula should validate with ZTKEcondition record with maximum and minimum price available.
4. If the new price is within the max/min range then pass it. System will do nothing and accept the manual price entered.
5. If the price is not within the range then issue error message u2018Price not within the rangeu2019. The system does not accept the manual entry of the new price.
Please let me know how to approach for the solution of the above.
I know how to raise the error messages ,my main concern is to check the new price of condition type with the other condition type min n max values.
Please provide me some pointers on it.
Thanks.

Hi Micheal,
Thanks for the reply. I am not doing anything with ZTKE. I need to check with ZNEW.when user enters the new price in ZNEW condition type ,that price should be checked with the price in ZTKE with its min n max values. I.e if the entered new price is in the range between max n min values ,system will take that entered new value ,if its not it will through a error.
So, for this i need to get the condition record value of min n max and compare with the entered new price in ZNEW and check for the above. I hope you got my point.
Please let me knoe which way i can proced to do so....
Thanks.

Similar Messages

  • IPC  java user exit- pricing routines

    Hi experts,
    I am new to IPC  java pricing routines and i have a requirement like this,
    1. The user enters manually in Quote the new price. (say cond type ZNEW)
    2. The cond record for ZTKE is available with the price as well as Max price and Min Price.
    3. The Routine formula should validate with ZTKEcondition record with maximum and minimum price available.
    4. If the new price is within the max/min range then pass it. System will do nothing and accept the manual price entered.
    5. If the price is not within the range then issue error message u2018Price not within the rangeu2019. The system does not accept the manual entry of the new price.
    Please let me know how to approach for the solution of the above.
    I know how to raise the error messages ,my main concern is to check the new price of condition type with the other condition type min n max values.
    Please provide me some pointers on it.
    Thanks.

    Hi Faiq,
    I am facing the same problem as you.
    I tried to solve it via the following code sample:
    throw new PricingRuntimeException([MessageClass], [MessageNumber], [Attributes], [RootCauseException]);
    throw new PricingRuntimeException("ZTEST", 0, new String[] {"test2"}, null);
    But no error appeared.
    Another possibility can be the following method!?
    But I do not know how to use it:
    pricingItem.getUserExitDocument().setStatusMessage(new StatusEvent());
    Perhaps meanwhile you have found another solution.
    If yes it will be nice if you post it.
    Greets Ruben

  • IPC Pricing routine for Product Family Margin in Quotation is not working

    Hi,
    I am working on the IPC Pricing Routine to calculate Item's Product Family Margin in the Quotation. 
    Process followed:
    Step 1:  Created a Group condition ZPFM for Product Family Margin and assigned to the pricing procedure. 
    Step 2:  Created a Value Routine to determine ZPFM's Condition Rate and Condition Value.
    Logic: 
              1.  Collect (Sum Of)  the Cost (ZSVC) and the Subtotal 3 of the items which are in same Material Group.
               2.  Assign the ZPFM Condition Value = Sum of Subtotal 3 - Cost.
    Issue:  The condition value for ZPFM is calculating correct for all line items except the last item.  I am getting some junk value always to the last item. If I delete the last time, again next last item is giving wrong value.  The calculation value in the routine debugging log (SM53) is showing correct value.  However, assigning the wrong value.  No other routines have been assigned to this condition type in the pricing procedure. 
    Routine Code:
    package stanley.pricing.userexits.val;
    import java.math.BigDecimal;
    import com.sap.spe.pricing.customizing.PricingCustomizingConstants;
    import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
    import com.sap.spe.base.logging.UserexitLogger;
    import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
    //import com.sap.spe.pricing.transactiondata.userexit.IPricingCondition;
    public class Z_CondValueRoutine730 extends  ValueFormulaAdapter{
       private static UserexitLogger uelogger =
              new UserexitLogger(Z_CondValueRoutine730.class);
      public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,
             IPricingConditionUserExit pricingCondition) {
      // Variable Declarations.
      BigDecimal conditionValueZCVC=PricingTransactiondataConstants.ZERO;
      BigDecimal conditionValueZCVCAccrual=PricingTransactiondataConstants.ZERO;
      BigDecimal subTotal3=PricingTransactiondataConstants.ZERO;
      BigDecimal subTotal3Accrual=PricingTransactiondataConstants.ZERO;
      if(pricingCondition.getConditionTypeName().equalsIgnoreCase("ZPFM")){
                IPricingItemUserExit[] prItems;
                prItems = pricingItem.getUserExitDocument().getUserExitItems();
                String materialGroup = pricingItem.getAttributeValue("MATL_GRP");
                uelogger.writeLogDebug("  Material Group  :"+materialGroup);
                for (int i=0;i<prItems.length;i++){
                     String materialGroup1 = prItems[i].getAttributeValue("MATL_GRP");
                     if (materialGroup1.equalsIgnoreCase(materialGroup)){
                          subTotal3 = prItems[i].getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_3).getValue();
                          subTotal3Accrual = subTotal3Accrual.add(subTotal3);
                          IPricingConditionUserExit[] conditionsForCumulation = prItems[i].getUserExitConditions();
                          for (int j = 0; j < conditionsForCumulation.length; j++) {
                               if(conditionsForCumulation[j].getConditionTypeName()==null) {
                                   continue;
                               else if ( conditionsForCumulation[j].getConditionTypeName().equalsIgnoreCase("ZCVC")){
                                    conditionValueZCVC = conditionsForCumulation[j].getConditionValue().getValue();
                                    conditionValueZCVCAccrual = conditionValueZCVCAccrual.add(conditionValueZCVC);
                BigDecimal conditionValueZPFM=PricingTransactiondataConstants.ZERO;
                conditionValueZPFM = subTotal3Accrual.subtract(conditionValueZCVCAccrual);
               BigDecimal conditionRateZPFM=PricingTransactiondataConstants.ZERO;
               conditionRateZPFM = conditionValueZPFM.multiply(new BigDecimal ("100"));
              conditionRateZPFM = conditionRateZPFM.divide(subTotal3Accrual,7,BigDecimal.ROUND_FLOOR);
             uelogger.writeLogDebug(subTotal3Accrual+"-"+conditionValueZCVCAccrual+" = "+conditionValueZPFM);
             uelogger.writeLogDebug("Condition Rate  :"+conditionRateZPFM);
           pricingCondition.setConditionRateValue(conditionRateZPFM.setScale(2,BigDecimal.ROUND_HALF_UP));
           pricingCondition.setConditionValue(conditionValueZPFM.setScale(2,BigDecimal.ROUND_HALF_UP));
              return null;
           return null;

    Hi,
    I think you should change xkwert variable instead of komv-kwert.
    Standard routines does the same.
    Aslo check in SPRO settings that routine is attached and
    getting triggered by putting break-point.
    Regards,
    Vishal

  • Replicate pricing routine in CRM

    Hi all,
    I'm trying to replicate pricing routine from R3 to CRM 5.0 without using IPC.
    Most of the master data and copy control is done already, pricing routine is the only one that I'm having a problem with since we don't use IPC here.
    Have anyone experienced this before?  Appreciate all the help.
    Thanks
    Gilbert

    Gilbert
    1. <a href="http://help.sap.com/saphelp_crm50/helpdata/en/8b/06f837aea75351e10000009b38f8cf/frameset.htm">How Pricing is done in CRM ?</a>
    2. <a href="http://help.sap.com/saphelp_crm50/helpdata/en/f6/6f6d28bf197247918ae66002feec75/frameset.htm">Differences in Pricing in SAP CRM and SAP R/3</a>
    3. Pricing in crm
    Happy Working !
    Thanks
    <b>Allot pointzs if this helps!</b>

  • Pricing routine 901 in the pricing procedure

    Can you tell me in detail (step by step) How to write pricing routine 901 in the pricing procedure?
    I know ABAP coding. I am new to SD (pricing).
    The only thing I know is the VOFM 901 Pricing Routine development is in ABAP program RV64A901.
    Purpose : Pricing Routine for calculating the price difference due to increase or decrease in the copal contract price from the copal actual price
    Description :
    Routine 901 : Copal Difference Calculation
    The formula to be used is : Copal Adjustment = ( Copal Contract Price + Copal Actual Price ) x Amount of Copal / 1000
    Where
    Copal Contract price is the condition type Y001 from the pricing procedure Z00003.
    Copal Actual price is the condition type Y002 from the pricing procedure Z00003.
    Amount of Copal is the condition type Y005 from the pricing procedure Z00003.
    Copal Adjustment is the condition type Y003 from the pricing procedure Z00003.

    Hi,
    Go to the transaction VOFM.
    In the menu..Choose...Formulas -> Condition value
    At the of the table ..Enter 901 and give the description..
    Then select that row and press source text button or F5.
    It will ask for the access key...
    Get the access key for the corresponding object
    R3TR PROG RV64A901
    Then in the code..
    READ TABLE XKOMV INTO LWA_Y001 WITH KEY KSCHL = 'Y001'
                                                      KPOSN = KOMP-POSNR.
    READ TABLE XKOMV INTO LWA_Y002 WITH KEY KSCHL = 'Y002'
                                                      KPOSN = KOMP-POSNR.
    READ TABLE XKOMV INTO LWA_Y005 WITH KEY KSCHL = 'Y005'
                                                      KPOSN = KOMP-POSNR.
    Sum up the values in LWA_Y001, LWA_Y002 & LWA_Y005
    And then move it to XKWERT
    Thanks,
    Naren

  • Pricing routine is not called even after assigning it in pricing procedure.

    Hi
    I created a pricing routine (Condition value) for one ZCondition type. I saved it in the workbench request. Functional consultant assigned this pricing routine to condition in Pricing Procedure. The routine was called while creating a PO. It works perfect in development system. But after we transported to quality server the routine is not getting called. Routine is displayed in pricing procedure in quality server. Routine program also exists in quality server. But the program include statement is not found in standard program RV64ANNN in quality. But in development the include statement appears in this program. How this program was not modified in quality server after transport? Its a SAP standard program and it was not saved in any request and was not modified manually too.
    Can anyone explain me what could be the reason that the program RV64ANNN is not updated in quality server to include the routine?
    How can we update this program without modifying it manually?
    Would deleting the pricing routine and recreating it help resolve this problem?

    Hi,
    Refer to the following Notes:
    [Note 22808 - Transferring formulas|https://service.sap.com/sap/support/notes/22808]
    [Note 388998: VOFM: Check report for entries in TFRM/TFRMT|https://service.sap.com/sap/support/notes/388998]
    [Note 28683: PERFORM_NOT_FOUND: VOFM routine is not active|https://service.sap.com/sap/support/notes/28683]
    Note 22808 - Transferring formulas is the first place you should look.  FYI, there is a lot of information on this topic available by searching for SAP Notes that have "RV80HGEN" and/or "VOFM" as keywords.
    Regards,
    Jamie
    Edited by: James Gaddis on Mar 19, 2008 10:59 AM - Added an additional SAP Note number and comment about searching for more Notes.

  • BAPI_PO_CREATE1 - Overriding standard pricing routine with fixed price

    Hi,
    I have to post a purchase order with BAPI_PO_CREATE1. It's important that the price in BAPIMEPOITEM-NET_PRICE is relevant for posting this purchase order and nothing else. I don't want to search for the price in any pricing routines of SAP, I want to take the price that I input explicitly.
    How can I tell BAPI_PO_CREATE1 that I want to use the fixed price in BAPIMEPOITEM-NET_PRICE?
    Thank you very much!
    Ralf

    Hi,
        if u have code for bapi_po_create1     ( purchase order creation bapi ) can u send me when i write the prog. it gave the error
           No instance of object type PurchaseOrder has been created. External reference:
    Thanks,
    mukesh

  • Issue in pricing routine

    Hi,
    I have an issue while writing code in the pricing routine. while calculating KBETR if the value is 1.035 it is rounding off to 1.04.
    Since KBETR has only two decimals it is rounding-off but client wants 1.035 only.
    Please help me.
    Regards,
    Anvesh Gummadapu.

    Hi Anvesh,
    Table for decimal decimal places in currency is TCURX .
    If ur currency does not supports 3 decimal places then may be u need to create a Z version of that currecny with 3 decimal places.
    Please check SAP documentaion [Special Output Formats |http://help.sap.com/saphelp_470/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm]   & 
    [Defining Currencies|http://help.sap.com/saphelp_40b/helpdata/en/08/51410a43b511d182b30000e829fbfe/frameset.htm]

  • Get Delivery date(EKET-EINDT) in MM Pricing routine(group condition)

    Hi All,
    I have created an MM pricing routine RV65A092 in VOFM. So when creating PO(ME21n), this routine will trigger..
    Now the problem is I need EKET-EINDT for grouping condition. It was mentioned to call program SAPLMEPO and get EKET data.
    Please help me how to get delivery date in that routine  which is filled in Item level during PO creation
    Thanks
    Ram

    Hi Ram,
    For SD you have the SAP Note 531835 - Using field PSTYV in the condition access. For MM is simmilar, although you must use the enahncements. Instead use the userexits that note says, use the enhancement LMEKO001 (EXIT_SAPLMEKO_001) to populate fields ZZ in KOMK and LMEKO002 to populate KOMP.
    I hope this helps you
    Regards
    Eduardo

  • Multiple calls of same pricing routine while saving sale order

    Hi,
    I have a requirement where I have to modify a pricing routine 9XX for sale order. In pricing procedure, I observed that this routine 9XX is assigned to multiple pricing conditions (ZNN, ZMM, ZDD etc). I saw that this routine is getting called many times in debugging for each of these assigned pricing conditions. May I know on what basis this pricing routine gets triggered multiple times for the corresponding pricing condition?
    Thanks in advance.
    Regards,
    Sri

    Sri,
    For everychange at ITEM level,Pricing mechanism will be repeated.
    You can check in debugging as below
    1.FM Pricing.
    2.Subroutine perform xkomv_aufbauen_aus_komt1.
    3.Check for the below code
      * L O O P Pricing Procedure
        loop at komt1 from komk-ix_komt1_v to komk-ix_komt1_b.
    4.Within this loop you will find a subroutine
       perform (bedingung_pruefen) in program saplv61a if found.
    Put a break point on this LOOP and check what is happening at the desired condition type while it is running through all the condition types of that Pricing Procedure.
    K.Kiran.

  • REFERENCE DOCUMENT TYPE IN PRICING ROUTINE

    HI ABAP GURUS,
    i am modifying pricing routine.
    i need to get reference docuemnt type for validation purpose . how do i get it..
    Thanks,
    Neo

    Hi
    check the KOMK-VBTYP field , which is document type of the document
    First see what are the structures available there in that routine
    like KOMP,KOMK like that structures
    double click them and see the different fields in those strutures
    I am sure you will find it.
    Regards
    Anji

  • VOFM pricing routine

    I have a requirement where I need to check pricing condition for BOM material.The requirement is that,if the material is a BOM in a sales order,then the pricing routine should trigger for its sub material. The problem we are facing is that the pricing routine is not getting triggered for the sub material. If anybody have worked on such requirement ,please give some input.I want the pricing routine to be triggered for the submaterial.

    Hi ,
          Whatever logic u write in ur routine .The final value which will go out from the routine is xkwert which is condition value .so in ur logic you will have to populate a value to the field xkwert .

  • What is pricing routine?

    hi all
        what is pricing routine for currency conversion and why that concept is used.im new to it .please can anyone explain..i read thro many docs but it gave a vague explanation.
    regards
    asha

    Hi Asha,
      Routines are small ABAP code which is assigned in the pricing procedure, this carries out additional check before processing/updating the document.
    If the document currency and local currency are different, SAP has provided standard function module for currency conversion, "CONVERT_TO_LOCAL_CURRENCY". Based on your requirement you can use this FM to achieve at the correct price in local currency.
    Hope this helps.
    Regards
    Raj

  • IPC Java routine for subtotal

    Hi All,
    I am a java developer new to SAP and IPC CRM pricing, the below subtotal routine is already implemented in ECC,we need to implement the same in CRM.
    FORM FRM_KONDI_WERT_906.
    *{   INSERT         SE1K900344                                        1
    if xkomv-kinak na 'AKLMXZ'.
        komp-ZZWI1 = xkwert.
    alternative solution if formula is used several times:
      add xkwert to komp-ZZWI1.
      endif.
    *}   INSERT
    ENDFORM.
    Please help on this.
    Regards
    Sabarinathan

    I am a java developer new to SAP and IPC CRM pricing
    Writing IPC pricing exits requires not just Java. It requires basic understanding of SD pricing and CRM / IPC pricing.
    IF
         you have
         Java knowledge AND
         SD Pricing knowledge AND
         CRM / IPC Pricing knowledge
    THEN
    DO
        IPC exit programming happily.
    ELSEIF
         you have time
         _Please_ get some basic knowledge in the above items.
    ELSE
         Engage someone who knows the stuff.
    ENDIF

  • IPC Pricing routine

    Hi all,
    I have created new pricing user routines. I am trying to create the JAVA code by myself, so can anyone helps me letting me know how the following code would be in Java?:
    Data: va_value type type komp-wavwr,
             wa-xkomv like xkomv.
             if sy-subrc = 0.
                clear wa_xkomv.
                read table xkomv into wa_xkomv with key KSCHL = 'ZPCO'
                if wa_xkomv-KBETR = 0.
                  clear wa_xkomv.
                  read table xkomv into wa_xkomv with key KSCHL = 'VPRS'.
                  wa_value= wa_xkomv-kwert.
               else.
               wa_value = wa_xkomv-kwert.
               endif.
            endif.
            xkwert= komp-kzwi3-va-va_import.
    Should I use jave methods to get that information for the tables or a connection to the database and a select?
    Thanks,

    Hi Max:
       Thanks very much for your quick response.
       Following your instrucctions, we understand that we can use getConditionTypeName()to check as follows:
       prCondition.getConditionTypeName() == "ZPCO"
       But we I'm not sure how I could check the followinf sentence: if wa_xkomv-KBETR = 0.
       Thanks in advance.
    Abel

Maybe you are looking for