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

Similar Messages

  • HT204088 Dear sirs,  Could you please help me on my problem with my apple ID  I create new account with security questions, and when I try to purchase paid application,it ask me for answers the questions but it's not working,  My account have 50$ and stil

    Dear sirs,
    Could you please help me on my problem with my apple ID
    I create new account with security questions, and when I try to purchase paid application,it ask me for answers the questions but it's not working,
    My account have 50$ and still didn't buy anything

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    (100546)

  • I'm trying to create a new ichat Acc because for some reason the old one is not working, so I go to Create an Apple ID and start creating a new apple ID, when I submit the Acc it tells me that my Email address is already verified for another Apple ID and

    I'm trying to create a new ichat Acc because for some reason the old one is not working, so I go to Create an Apple ID and start creating a new apple ID, when I submit the Acc it tells me that my Email address is already verified for another Apple ID and thats the only email address I have... What can I do?

    There is no way to consolidate iTunes accounts.
    Setting up an iPhone has never required creation of a new Apple ID.
    You've apparently purchased content with both Apple ID's.  Sign into the device with the correct Apple ID and sync the content.

  • HT202157 New apple is not asking for the WIFI password.Home sharing is not working,i am getting Error while streaming videos from Youtube.

    I got new Apple TV 10 days back,its not asking for the WIFI password.Home sharing is not working,i am getting Error while streaming videos from Youtube.
    I can only see pics and video saved in my iphone. No other options are working.The worst part is that its not asking wifi passoword.
    Not able to connect istores and itunes.
    I cannot do software update. Can anyone help in this content?

    Thanks Brian- I am not connecting it with iphone teethering. I am using it with my DSL wifi.
    I am using it with ethernet cable then its working fine.If i am trying to use it with WIFI then its giving error.
    I tried using Netwrok testing but its giving same error.

  • Need driver for canon mg 5250 as scanner is not working with version 10.7. Can you please help me to find the driver so scanner works with WIFI?

    need driver for canon mg 5250 as scanner is not working with version 10.7. Lion. Can you please help me to find the driver so scanner works with WIFI?

    Try with the latest Apple driver package for Canon (released 15th Feb):
    http://support.apple.com/kb/DL899
    This solved my problem with the printing.

  • My ipod classic got wet back in August.. it seemed to work fine for about a month, but recently is not working at all..screen appeared to get cloudy and then it just stopped working. thanks.

    my ipod classic got wet back in August.. it seemed to work fine for about a month, but recently is not working at all..screen appeared to get cloudy and then it just stopped working. thanks.

    Most likely, water damage.
    You can try putting your iPod in a tupperware, half filled (maybe half inch) with rice grains, close the cover for about a week.
    If you have done this, as soon as it got wet, higher chances of success, now looks like the water moisture is getting to the LCD screen.
    Then you can always bring it to Apple Genius bar, for a an overhaul. (may cost you half the price of a new iPod classic.)

  • HT5557 The ibooks dictionary works fine for my iPhone 5, but it does not work for my iPad 2. Is this fixable?

    The iBooks dictionary works fine for my iPhone 5, but it does not work for my iPad 2. Is this fixable?

    I went to the Audio store to see about getting a surround sound and the salesperson asked me why I wasn't using AirPlay, he said it was better than the Bluetooth, better quality. So I do have AirPlay on my Sony and I installed the app on my iPhone 5 but they can't find eachother.......when I try looking for my iPhone on my receiver it does not show it. The Sony display works through my TV, the set up screen is there but it says no devices found. Like I said, the Bluetooth finds the iPhone and works ok, but the AirPlay does not.....looking at the manuel it says that the AirPlay will recognize my device (iPhone 5) but it does not..........

  • I have iphone 4s and i updated it for iso 6 , the icon passbook its not working what shall i do

    I have iphone 4s and i updated it for iso 6 , the icon passbook its not working what shall i do, please note that i live in united arab emirates

    Hae you tried to do a hard reset of your phone? This will not lose any data. Hold the sleep/wake button and the home button until the phone turns off ignoring any slide to power off messages. Then power the phone back on.

  • "Validation" enabled for the composite and my testsuites are not working

    I have posted the below issue in Test suite in JDEV - Studio Edition Version 11.1.1.2.0 But I felt that this is the right forum, so posting this again here:
    I have mediator calling bpel. Mediator is exposed as web service. Whenever I run the service using "Test" button on EM with validation turned on
    then it works and the process will be completed.
    But I have initiate xml in the test suites. I select "UnitTests" and select my test case xml that was associated to "Initiate Message for operation",
    I see that the process is still in the "Running" state. I put in exactly the same values as I use for testing the service from EM.
    Did anybody face this issue? This happens only when we turn the validation to "Enabled" in EM.
    I have "Validation" enabled for the composite and my testsuites are not working. When I test using unit tests, I am only seeing "Running" status of the processes and these are not getting completed.

    Hello there, RevDebMN.
    The following Knowledge Base article is always a great fallback article for troubleshooting Mail issues:
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/ts3276
    Particularly useful, in your case:
    Mail Connection Doctor shows one or more red dots () in the account Status column
    Check your Incoming IMAP or POP and Outgoing SMTP email account settings
    Use Apple's online Mail Setup Assistant to discover what the correct settings should be for both your Incoming (IMAP or POP) and Outgoing SMTP email servers. If your email service provider is not listed in the Mail Setup Assistant, visit your email service provider's website or contact their support staff to get the correct settings. You can use this "cheat sheet" when asking your email service provider about the settings you need.
    After you have the correct email service provider settings, make sure Mail is configured properly.
    Click here if your Incoming and Outgoing email account settings are correct, but the issue persists
    What alert message is shown in the Mail Connection Doctor "Details" column affected account?
    Click here if a "Could not connect to this (server type) server…" message appears
    Click here if a "Trying to log in to this (email server provider name) account failed…" message or any other error message appears
    If the issue persists, then you'll want to remove the account and then add it again using this article:
    Mail (Mountain Lion): Remove accounts
    http://support.apple.com/kb/PH11794
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • HT2731 I was ask for my secure question and they did not work. So I went into my account and tap on my secure question that I forgot my secure question. It replied back that it just sent me a email. The email never came. I did this three time. My email is

    I was ask for my secure question and they did not work. So I went into my account and tap on my secure question that I forgot my secure question. It replied back that it just sent me a email. The email never came. I did this three time. You have myy email as correct. I have check my account and it show as being correct.

    It's a really bad idea to post your email addresess - it's an invitation to spam - and I've asked the Hosts to remove them.
    This is a user-to-user forum and no-one on here can take any direct action. If your Yahoo address is not working that's something you would need to take up with Yahoo - have you checked it by sending yourself an email to it?
    Otherwise you will need to contact Support: go to https://expresslane.apple.com/ and click on 'iTunes' in the center column and then 'iTunes Store' in the right-hand column and proceed from there.

  • The keyboard for my iMac 9, 1 got wet and is not working correctlly. Delete,return, and some other keys not functioning. In all caps including numerals. I've left it to dry for a few days but still will not work. Computer now in Safe boot mode and I c

    The keyboard for my iMac 9, got wet and is not working correctly. Delete ,return, and some other keys not functioning. In all caps including numerals. I've left it to dry for a few days but still will not work. Computer now in Safe boot mode and I can't login due to all caps and numbers being symbols. Is there anything I can do?

    Buy a replacement keyboard. They're only $50-65 USD.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • I'm in Camera Raw and for no reason my adjustment brush will not work. Any suggestions

    I'm in Camera Raw and for no reason my adjustment brush will not work. Any suggestions

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I have iPhone 4 and I update it to iOS 7 and when I try to start the personal hotspot it crashed and for sometime my cellular data was also not working then allot a sudden the personal hotspot icon disappeared from my settings

    I have iPhone 4 and I update it to iOS 7 and when I try to start the personal hotspot it crashed and for sometime my cellular data was also not working then allot a sudden the personal hotspot icon disappeared from my settings.
    Has anyone faced a problem like this!!!

    No. If you go Settings App > General > Reset > "Erase All Content and Settings", you will have the same iOS that was on the iPhone when you tapped the Erase button. If you believe your iPhone is Jailbroken, then this will not work. If you use iTunes on computer, this will put iPhone to current iOS which is iOS 7.0.2

  • Is their a fix for photoshop elements 11 move tool? Not working with Yosemite OS upgrade.

    Is their a fix for photoshop elements 11 move tool? Not working with Yosemite OS upgrade.

    Hi,
    We sincerely apologize for the problem customers are facing while using a trackpad with Photoshop Elements 11 & 12 on Mac OSX 10.10 (Yosemite).
    We have been actively working with Apple to resolve this problem as quickly as possible. We're hopeful this will get completely resolved in an upcoming update of Yosemite(MAC 10.10).
    In the meanwhile, you have two options to work around this problem:
    1. Option1: Use a mouse instead of the trackpad
    2. Option2: Install a plug-in which should workaround the problem
    Plug-in installation instructions:
    1. Close Photoshop Elements
    2. Download this zip file to a location you can easily find (e.g. your desktop)
    3. Unzip the file, WhiteWindowWorkaround.plugin, and move it to the Plug-In folder:
    • For Elements 12 – //Applications/Adobe Photoshop Elements 12/Support Files/Plug-Ins/
    • For Elements 11 - //Applications/Adobe Photoshop Elements 11/Support Files/Plug-Ins/
    You can verify the plug-in is installed by launching the Photoshop Elements Editor and choosing Help > System Info... Scroll to the bottom of the text in the dialog and look for the plug-in name "WhiteWindowWorkaround.plugin".
    Note: This plugin is a temporary workaround and should be used until this issue is addressed in Mac OSX 10.10 (Yosemite). Please remove this plugin once the issue is officially resolved by Apple.
    If you are using a stylus in conjunction with a trackpad, you might see issues with your trackpad. Workaround in this particular case is to use mouse instead of the trackpad.
    Hope this helps!
    Regards,
    vaishali

  • Redemption code for Adobe photoshop/premiere elements 11 does not work

    redemption code for Adobe photoshop/premiere elements 11 does not work

    I am having the same issue except that my premiere elements code worked great, but the photoshop elements key failed. Ugh.

Maybe you are looking for