cancel
Showing results for 
Search instead for 
Did you mean: 

IPC: How to read the Condition Rate(KBETR) in Java checkRequirement method.

Former Member
0 Kudos

Hi Experts,

As part of an IPC development, we need to read the Condition Type Rate (KBETR) in a Requirement Formula. The condition rate is the rate for the current record of the pricing procedure, e.g. Condition Type ZAB1.

I can successfully read the condition rate in a Value formula using this piece of code:

public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,IPricingConditionUserExit pricingCondition) {

BigDecimal ZConditionRate = pricingCondition.getConditionRate().getValue();

}

In a Value Formula "IPricingConditionUserExit pricingCondition" is a input parameter of the overwriteConditionValue() method. However in a Requirement formula the standard method checkRequirement(IConditionFindingManagerUserExit item, IStep step, IAccess access) does not have any parameter which can give me the rate.

I wrote the following logic in the requirement class, but line 2 is not executed.

1. public boolean checkRequirement(IConditionFindingManagerUserExit item, IStep step, IAccess access) {

2. IPricingConditionUserExit pricingHeader = (IPricingConditionUserExit) item;

3. BigDecimal ZConditionRate = pricingHeader.getConditionRate().getValue();

}

Please suggest how we can retrieve the condition rate in a requirement formula class using teh standard methods & classes.

Accepted Solutions (0)

Answers (1)

Answers (1)

MichaelNe
Employee
Employee
0 Kudos

Hello,

a requirement in pricing is used whether a condition is applicable and needs to be determined or not. Thus the requirement processing takes usually place before the rate has been determined and hence there is no interface provided to read the rate. As you already pointed out the rate is accessible via a condition value formula (and in condition base formulas) and within the condition value formula you could still decide to set the condition inactive flag to make sure, that the condition does not get applied at a certain condition is true. Maybe this is a workaround for your business requirement. In addition, you could check whether any condition exclusion could help to meet your business requirement.

Best Regards,

Michael

Former Member
0 Kudos

Hi,

I have to set the condition rate as percentage in one of my codition value formula routine which i am developing based on java.

I have overwritten  the method overwriteConditionValue() in my pricing routine which is 927. My logic is below.

When I open my quotation using crmd_order, condition rate is not being displayed with % for unit condition rate coulmn in my pricing conditions.

If I try to change my quotation for ex: Agrred price: xworke, then 927 formula is called and condition rate is displayed as %.

So condition rate value is displayed perfectly , but when my quotation is in display mode condition rate value is coming as USA, but it should be % irrespective of my quotation is in display mode or change mode. I have attached the two screen shots for quotation display mode and change mode.

Can some body throw insight what is wrong in my pricing routine logic in setting % condition rate rather than USD for the Condition rate value.

public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,
  IPricingConditionUserExit pricingCondition) {
 
  BigDecimal condValue = null;
  BigDecimal discountValue = null;
  try{ 


    BigDecimal xworkg = pricingItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_G).getValue();
    userexitlogger.writeLogDebug(" 927 formula, Date=["+new Date()+"] , xworkg=["+xworkg+"]");
    BigDecimal xworke = pricingItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_E).getValue();
    userexitlogger.writeLogDebug(" 927 formula, Date=["+new Date()+"],  xworke=["+xworke+"]");
 
    pricingCondition.setCalculationType(PricingCustomizingConstants.CalculationType.PERCENTAGE); 
 
    if (xworkg.compareTo(PricingTransactiondataConstants.ZERO) != 0) {   
   
    condValue =  xworkg.subtract(xworke);
    pricingCondition.setConditionValue(condValue); 
   
    // Calculate percentage with 3-decimal-precision (as does ABAP-Version by multiplying with 100.000 instead of 100)
    pricingCondition.setConditionRate(condValue.multiply(PricingTransactiondataConstants.HUNDRED).divide(xworkg,
      3, BigDecimal.ROUND_HALF_UP), "%");

   
    pricingCondition.setPricingUnit(new BigDecimal(0), null);
   
    }
    else {


    pricingCondition.setConditionRate(PricingTransactiondataConstants.ZERO, "%");
    pricingCondition.setPricingUnit(new BigDecimal(0), null);
   
    }

   
  }
  catch (Exception ex) {
    //pricingCondition.setInactive(PricingCustomizingConstants.InactiveFlag.INACTIVE_DUE_TO_ERROR);
    userexitlogger.writeLogError("Error Occured in 927 formula, reason code=["+ex.getMessage()+"]");
    return null;
  }

  //return condValue;

  return null;
    }

Thanks

Srikar