Simple calculation involving  KOMV-KBETR giving issues

Hello Experts,
I have a pricing routine in which I am doing some calculation on a field typed on KOMV-KBETR. The calculation is similar to the code  shown below. But this simple calculation is not giving correct results. For example, the correct result from the sample code below should have been 180.00, but the result I am getting is 18000.00. Please help to resolve this. Thanks in advance
Also, if you try to execute the below code in a custom program, you will get the correct result. But the issue is happening in a pricing routiine.
TABLES: komv.
DATA:  ws_value LIKE komv-kbetr VALUE '200.00',
             g_value TYPE bsgrd value '90.00'.
IF sy-subrc EQ 0.
  ws_value = g_value * ws_value / 100.
ENDIF.
Regards
Arun.

- How did you fill KOMV (are you in an exit, a specific program, do you use a FM like PRICING_GET_CONDITIONS ?)
- Is KOMV-WAERS currency key filled (?)
Nevertheless - from [Predefined ABAP Types|http://help.sap.com/saphelp_wp/helpdata/en/fc/eb2fd9358411d1829f0000e829fbfe/frameset.htm]
it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
You can convert from currency to decimal field using FM for BAPI like BAPI_CURRENCY_CONV_TO_EXTERNAL and BAPI_CURRENCY_CONV_TO_INTERNAL. (or old FM like CURRENCY_AMOUNT_SAP_TO_DISPLAY)
Regards,
Raymond

Similar Messages

  • Java simple calculation involving double

    *public static void main(String[] args) {*
    System.out.println("Output "+300.025d100.0);*
    The above code is returning me 30002.499999999996 though I was expecting 30002.5

    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class Test {
    NumberFormat f = new DecimalFormat("0.0");
    System.out.println("Output "+new Float(f.format(300.025d*100.0)));
    }

  • Update KOMV-KBETR field for sales order and billing

    I would like to update the KOMV-KBETR (condition amount or percentage) under condition tab for both Sales order and billing.
    example:There are two condition types ZA00 and ZB00 and need to get the KBETR value from ZA00 and add it to KBETR value of ZB00 and update the sum in KBER value of ZB00.
    1. creation of sales order & billing.
    2. Change of sales order & billing.
    3. For single & multiple line items in both sales order & billing.
    4. during updation of price in the change mode of sales order & billing.
    5.When user click on Update button in the condition tab(i.e., when clicked on Carryout new pricing)
    I tried with the VOFM routine but as the routine is triggering multiple times the sum is calculated again and again.For that I set flags also.It is working for sales orders but for billing creation the field XKOMV-KBETR is cleared after this routine.
    So I would like to know are there any EXITS for this scenario or any one entountered the similiar issue which I am facing.

    Hi Brad,
       It is an Client requirement.So need to do the addition of that condition types.
    Can you please let me know the configuration point where we can do it and the condition type which we need to update the Rate/Amount value.ie., KOMV-KBETR is and Price list value and not the subtotal one.
    Thanks,
    Srilakshmi Lagisetty.

  • Simple calculations not working in acrobat 9

    I have text form fields made in Acrobat 9 from a previously made pdf, where I need a simple calculation, but I cannot get it to work.
    The form is not for submission, only for personal tracking, so I don't even need validation.
    FieldA (a number they enter) x a number I have entered in the calculation = FieldB
    FieldB x FieldC (a number they enter) = FieldD In FieldB I have a simple javascript Calculation in the form field: FieldA * .115, which should automatically calculate answer into FieldB, when tabbed.
    In FieldD I have a Calculation in the form field: FieldB * FieldC, which should automatically calculate answer into FieldD. All fields are set as numbers.
    I have left the Trigger Action as Mouse Up.
    I don't need to validate, as this is personal use, and is not being submitted.
    I have all fields in the correct tab order.
    I have reader enabled the form. When I open the form in Reader, I can enter the numbers, but no calculations are being performed. It reads 0 in FieldB and FieldD. Any assistance would be greatly appreciated.

    Hello Everyone,
    I use the following VBS code, but to tell the truth, I don't know if it works or not. The main idea was to enable commenting from Adobe Reader. But after execution code, saving document and reopening it in Reader, commenting is still 'Not Allowed'. Is showAnnotToolsWhenNoCollab really capable to allow this and there is only error in my code? Or is the functionality different and this way can never be used for what I want?
    There is another issue that application is not closed on Exit, but is still shown.
    scriptPath = "C:\Acrobat\"
    Set gApp = CreateObject("AcroExch.App")  
    Set pdDoc = CreateObject("AcroExch.PDDoc")
    sampleFilePath = scriptPath & "AR_test_orig.pdf"
    pdDoc.Open sampleFilePath
    pdDoc.OpenAVDoc "myFile"
    gApp.Show
    Set formApp = CreateObject("AFormAut.App")
    'formApp.Fields.ExecuteThisJavascript "app.alert(""hello"");"
    formApp.Fields.ExecuteThisJavascript "Collab.showAnnotToolsWhenNoCollab = true;"
    Set formApp = Nothing
    pdDoc.Save 1, scriptPath & "AR_test.pdf"
    'pdDoc.Close
    gApp.CloseAllDocs
    gApp.Exit
    Set pdDoc = Nothing
    Set gApp = Nothing
    Thanks for any ideas.
    Jan
    PS: I use Acrobat 9.0 Pro

  • Need Help please KOMV-KBETR

    Hi guys, I am struggling to identify a data field in the condition record of a purchase order. The filed name is KOMV-KBETR, which is a calculated subtotal. KOMV is a structure and I can’t find where the actual calculation of this subtotal takes place. I looked all over in IMG and in VOFM and cannot figure this one out. Is any one knows where are calculations usually stored for pricing Purchase Orders and how to get to the actual calculation routines.
    Thank you so much!

    There are a couple of ways by which you can get this value.
    1)go to table a003
    give the Application value(KAPPL)
    Condition Type for which value is needed
    Country and tax code
    this will give you the KNUMH
    go to KONP and give this KNUMH value it will give you the kbetr value.
    2) you can use the function module J_1I6_DETERMINE_EXCISE_RATE
    I hope these solutions would help you.
    Regards
    Narayani

  • In PO invoice tab select tax code shown amount column KOMV-KBETR as 100%

    Hi,
    In PO invoice tab select tax code shown amount column KOMV-KBETR as 100% we need as 10% my alculation is correct but showing only 100%
    i have assigned tax rate in j1id as 10% and Ftxp as same tax code as 100% and condition is JM02 as non-deductable.
    in PO condition value is showing as 10% correct value but showing in amount column as 100%
    Please suggest
    Thanks
    Shital

    No reply

  • Simple calculations in Universe not working for XI 3.0

    Simple calculations in Universe using key figures are not working in XI 3.0(without any Fix Pack)
    Below is the steps I followed.
    1. Using key figure [Jan] I am trying to round the values by deviding it by 1000.
    <EXPRESSION>@Select([Jan])/1000</EXPRESSION>
    This gives me a null cell value.
    2. I tried addition then
    <EXPRESSION>@Select([Jan])+1000</EXPRESSION> result was all the cell values changed to 1000.
    3. Finally without calculation I tried
    <EXPRESSION>@Select[Jan]</EXPRESSION> this also resulted null value
    But without EXPRESSION tag if I try @Select[Jan] it works fine.
    Am I missing anything in above expressions.
    As of now I am creating variable in report to incorporate the rounding.
    Thanks
    Raghu

    It was my mistake while writing the question. Path I have used is correct one only @Select(Key Figures/.
    If i use the above alone, I am able to se the data. But if I use in betwen <EXPRESSION> then it gives null value.
    Note: Pls dont confuse with flower bracket i used it just to avoid coverting it to a html link and also the backslash it was not showing in preview
    I have followed that pdf and created calculation in universe.
    Edited by: Raghavendra Barekere on Feb 6, 2009 6:42 AM

  • Need help with starting a simple calculator

    I have this simple calculator I just started on, and I'm having just a few problems. First of all, I don't know how to append text to a textfield. Maybe I would have to create a string buffere or something. Then, when the user clicks one of the buttons, the compiler goes crazy, and nothing is displayed.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Calculator extends JFrame implements ActionListener
         JButton[] btnNums;
         JButton btnBack;
         JButton btnClear;
         JButton btnCalculate;
         String[] strNames;
         JTextField txtDisplay;
         public Calculator()
              Container content = getContentPane();
              setSize(210,250);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              /*  construct a JPanel and the textfield that
               *  will show the inputed values and outputed
               *  results
              JPanel jpDisplay = new JPanel();
              jpDisplay.setLayout(new BorderLayout());
              txtDisplay = new JTextField(15);
              txtDisplay.setHorizontalAlignment(JTextField.RIGHT);
              jpDisplay.add(txtDisplay);
              /*  contstruct a JPanel that will contain a back
               *  button and a clear button.
              JPanel jpRow2 = new JPanel();
              btnBack = new JButton("Backspace");
              btnClear = new JButton("Clear");
              btnClear.addActionListener(this);
              jpRow2.add(btnBack);
              jpRow2.add(btnClear);
              /*  construct a string array with all the names of the
               *  buttons, then in a for loop create the new buttons
               *  and add their name and an actionListener to them.
              String[] strNames = {"7","8", "9","/", "4", "5", "6","*", "1", "2", "3","+", "0", "+/-", ".", "-"};
              btnNums = new JButton[16];
              JPanel jpButtons = new JPanel();
              jpButtons.setLayout(new GridLayout(4,4));
                for (int i = 0; i < 16; i++)
                     btnNums[i] = new JButton(strNames);
                   btnNums[i].addActionListener(this);
                   jpButtons.add(btnNums[i]);
              /* construct the final JPanel and add a
              * calculate button to it.
              JPanel jpLastRow = new JPanel();
              btnCalculate = new JButton("Calculate");
              btnCalculate.addActionListener(this);
              jpLastRow.add(btnCalculate);
              /* set the contentPane and create the layout
              * add the panels to the container
              setContentPane(content);
              setLayout(new FlowLayout());
              setResizable(false);
              content.add(jpDisplay, BorderLayout.NORTH);
              content.add(jpRow2);
              content.add(jpButtons);
              content.add(jpLastRow);
              setTitle("Mini Calculator");
              setVisible(true);
         public void actionPerformed(ActionEvent ae)
              for (int i =0; i < 16; i++)
                   if (ae.getSource() == btnNums[i])
                        txtDisplay.setText(strNames[i]);
         public static void main(String[] args)
              Calculator calc = new Calculator();

    First of all, I don't
    know how to append text to a textfield.
    textField.setText( textField.getText() + TEXT_YOU_WANT_TO_APPEND );
    Then,
    when the user clicks one of the buttons, the compiler
    goes crazy, and nothing is displayed.No, the compiler doesn't go crazy, the compiler has done it's job by then. However, you do get a NullPointerException, and the stacktrace tells you that the problem is on the following line:
    txtDisplay.setText(strNames);
    It turns out that strNames is null. I leave it to you to find out why. ;-)

  • Simple Calculations in BPS Web

    Hi,
    I am using the BPS web layouts (ALV Grid not the Excel Web Component). I would like to add a couple of very simple calculations (difference of columns/percentages etc). Is it possible to do this without using the Excel OWC ?
    Thanks
    Shailesh

    Hi
    the simplier way to achieve yor result is to use FOx formula to calculate your results at runtime .
    You should create a formula function and add FOX code to it .
    Check this link for examples
    http://help.sap.com/saphelp_nw04/helpdata/en/d3/8057f830a911d4b2be0050dadfb23f/frameset.htm
    Hope it helps
    Andr

  • Problem with KOMV-KBETR field

    Hi ,
        In VAO1, in field KOMV-KBETRi.e., label Amount when I  enter value' 60' and press 'ENTER' I get the value as '60,00'.
    Now, in my own  ALV Report output , I have a editable field ZNETPR of type KOMV-KBETR.
    Here, I enter value  '60' and press 'ENTER'  but I dont get value as  '60,00' here, when I refresh I get value as '0,60'.
    What should I do to get the value as '60,00'  here too.
    Plz help me,
    Waiting for ur replies.....
    Thanks,
    Shivaa...
    Edited by: shiva prasad on Jul 14, 2009 2:46 PM

    Hi Vijay,
    ***I think you might used no decimals in fieldcat log for this field.
    This is how I created.
    wafc-fieldname = 'KBETR'.
      wafc-tabname = 'IT_ALV'.
      wafc-col_pos  = 177.
      wafc-edit = 'X'.
      wafc-seltext_m = 'User Price'.
    What additions should I make?

  • Has anyone seen a simple calculator pod that will work in Acrobat Connect Pro?

    I need a simple calculator to total up responses from participants in web meetings. Does anyone know of one that can work as a pod where everyone will see the numbers that are pushed and the calculation display?

    If this one works with you: http://connect.wezupport.se/p39142940/
    I've attatched so you can download it from here - cheers

  • Simple calculator to use log, successor, predecessor ?

    Hello. I have this simple calculator program, and I am having trouble with the log, successor (if 8 entered returns 9), predecessor (if 8 entered returns 7). The log gets this error:
    Calculator.java:113: log(double) in java.lang.Math cannot be applied to (int,int)
                   result = (int)Math.log(result, stringToInteger(ioField.getText()));
    I did the same thing with power, and it seems to work so I'm a little confused about that.
    If anyone can help me out it would be greatly appreciated, and thanks in advance!
    Here's the code (commented out code is what I need help with):
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Calculator extends JFrame implements ActionListener
         public static final int WIDTH = 400;
         public static final int HEIGHT = 200;
         public static final int NUMBER_OF_DIGITS = 30;
         private JTextField ioField;
         private int result = 0;
         public Calculator()
              setSize(WIDTH, HEIGHT);
              setTitle("GUI Calculator");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLayout(new BorderLayout());
              JPanel textPanel = new JPanel();
              textPanel.setLayout(new FlowLayout());
              ioField = new JTextField("Enter numbers here.", NUMBER_OF_DIGITS);
              ioField.setBackground(Color.WHITE);
              textPanel.add(ioField);
              add(textPanel, BorderLayout.NORTH);
              JPanel buttonPanel = new JPanel();
              buttonPanel.setBackground(Color.BLUE);
              buttonPanel.setLayout(new GridLayout(5, 2));
              JButton addButton = new JButton("+");
              addButton.addActionListener(this);
              buttonPanel.add(addButton);
              JButton subButton = new JButton("-");
              subButton.addActionListener(this);
              buttonPanel.add(subButton);
              JButton multButton = new JButton("*");
              multButton.addActionListener(this);
              buttonPanel.add(multButton);
              JButton divButton = new JButton("/");
              divButton.addActionListener(this);
              buttonPanel.add(divButton);
              JButton expButton = new JButton("^");
              expButton.addActionListener(this);
              buttonPanel.add(expButton);
              JButton logButton = new JButton("v");
              logButton.addActionListener(this);
              buttonPanel.add(logButton);
              JButton sucButton = new JButton("s");
              sucButton.addActionListener(this);
              buttonPanel.add(sucButton);
              JButton preButton = new JButton("p");
              preButton.addActionListener(this);
              buttonPanel.add(preButton);
              JButton clearButton = new JButton("C");
              clearButton.addActionListener(this);
              buttonPanel.add(clearButton);
              add(buttonPanel, BorderLayout.CENTER);
         public void actionPerformed(ActionEvent e)
              try
                   assumingCorrectNumberFormats(e);
              catch(NumberFormatException e2)
                   ioField.setText("Error - Reenter number.");
         public void assumingCorrectNumberFormats(ActionEvent e)
              String actionCommand = e.getActionCommand();
              if(actionCommand.equals("+"))
                   result = result + stringToInteger(ioField.getText());
                   ioField.setText(Integer.toString(result));
              else if(actionCommand.equals("-"))
                   result = result - stringToInteger(ioField.getText());
                   ioField.setText(Integer.toString(result));
              else if(actionCommand.equals("*"))
                   result = result * stringToInteger(ioField.getText());
                   ioField.setText(Integer.toString(result));
              else if(actionCommand.equals("/"))
                   result = result / stringToInteger(ioField.getText());
                   ioField.setText(Integer.toString(result));
              else if(actionCommand.equals("^"))
                   result = (int)Math.pow(result, stringToInteger(ioField.getText()));
                   ioField.setText(Integer.toString(result));
    /*          else if(actionCommand.equals("v"))
                   result = (int)Math.log(result, stringToInteger(ioField.getText()));
                   ioField.setText(Integer.toString(result));
              else if(actionCommand.equals("s"))
                   result = result + 1;
              else if(actionCommand.equals("p"))
                   result = result - 1;
    */          else if(actionCommand.equals("C"))
                   result = 0;
                   ioField.setText("0");
              else
                   ioField.setText("Unexpected error.");
         public static int stringToInteger(String stringObject)
              return Integer.parseInt(stringObject.trim());
         public static void main(String[] args)
              Calculator gui = new Calculator();
              gui.setVisible(true);
    }

    A 'double' is not the same as an 'int' and they can't fit the one value-type into the memory of the other.
    Although this is a logical math problem, simple for us, we have better memory than a computer.
    An integer maps a certain amount of memory to fix its maximum value, when you cast, you must cast into a type that is the same or smaller in terms of memory byte size.
    Just like you can't cast some objects as others, you can't cast a double as an int.
    The error is telling you that the result of a method call is incompatiable with the argument of another method call.
    The fault lies at Calculator.java source file at line 113 in the file. This is where you call the method log() which requires an argument of type 'double' which is located in Math class log method where the two arguments are 'int' and 'int'.
    However, in your call, you inflect the reference 'result' as the product of the method call in which the 1st argument is also 'result'
    That in itself is bad design. It's like saying "Joe is the product of Mike (who uses Joe)."
    Memory-wise, this could cause possible leaks.

  • Process sampled data and perform simple calculation to by pass Matlab?

    I have files that contain large number current samples (like 300,000 for example). I need them to performing simple calculations (for example to calculate energy).
    Before, I used Matlab to load all those samples into array and to do all calculations there.
    However... that process is kind of slow. What can I use to simply this and replace Matlab by some script?
    Can I use perl or php to perform this operation on set of sample files to spit out final calculation values into new file?
    Last edited by kdar (2012-05-11 13:21:05)

    I'm surprised no one has suggested numpy and scipy, which are modules for python 2. They have syntax that's similar to mattlab, they're very fast, and python is useful in other circumstances and easy to learn.
    I did something similar for spectral data. Here's an example of what I did in python:
    #!/usr/bin/env python
    #This program goes through rayleigh line data and finde the mean shift
    #in nanometers and the standard deviation
    import sys, os
    import numpy as np
    import scipy as sp
    import scipy.optimize as op
    import time
    ray = []
    filenames = []
    line = 633
    def rs(wavelength,laser):
    return ((float(1)/laser)-(float(1)/wavelength))*(10**7)
    def main(argv): #Goes through a file and finds the peak position of the rayleigh line
    f = np.loadtxt(argv).transpose() #opens the file
    maxi = np.amax(f[1]) #Finds the value of hte peak of the rayleigh line
    intensity = [f[1,i] for i in range(len(f[1]))] #extrants the array into a list
    indi = intensity.index(maxi) #Finds the index of the rayleigh line
    ray.append(f[0,indi])
    filenames.append(str(argv))
    # Goes through each file named in the CLI call and applies the main function to it
    for filename in sys.argv[1:]:
    main(filename)
    # Use numpy for some basic calculations
    mean = np.mean(ray)
    StandardDeviation = np.std(ray)
    median = np.median(ray)
    variance = np.var(ray)
    ramanshift = [rs(ray[i],line) for i in range(len(ray))]
    rsmean = np.mean(ramanshift)
    rsSD = np.std(ramanshift)
    rsmedian = np.median(ramanshift)
    rsvariance = np.var(ramanshift)
    tname = str(time.asctime())
    # Write all calculations to a file
    output = open('rayleigh_'+tname+'.dat','w')
    output.write('#The files used for this compilation are:\n')
    for i in range(len(filenames)):
    output.write('#'+filenames[i]+'\n')
    output.write('The wavelengths of the Rayleigh line are (in nm):\n')
    for i in range(len(ray)):
    output.write(str(ray[i])+'\n')
    output.write('The raman shifts of the rayleigh line for '+str(line)+'nm are (in rel. cm^(-1):\n')
    for i in range(len(ray)):
    output.write(str(ramanshift[i])+'\n')
    output.write('Mean = '+str(mean)+'nm, or '+str(rsmean)+' rel. cm^(-1)\n')
    output.write('Standard Deviation = '+str(StandardDeviation)+' nm, or '+str(rsSD)+' rel. cm^(-1)\n')
    output.write('Median = '+str(median)+'nm or, '+str(rsmedian)+' rel. cm^(-1)\n')
    output.write('Variance = '+str(variance)+'nm or, '+str(rsvariance)+' rel. cm^(-1)\n')
    output.close()
    Last edited by Yurlungur (2012-05-13 21:14:54)

  • Add a simple calcul to a table with Personalize menu

    Hi
    is it possible to add a column (Message Styled Text) that will do a simple calculation ((score +50 *10000) /quote total) in an existing table (Personalize "Supplier Summary Table")
    thanks

    Thank you Bernd, but that is only part of the solution.  For example, I do set the Page Layout to 1-page-continuous.  MOST of the time it keeps this setting, but some documents either override that setting, or perhaps it reverts back to a default (maybe with version upgrades?).  The other part is that I always want the menu-bar and toolbar to show up.  Some documents hide these when they open.  I realize that I can hit [F8] and/or [F9] to toggle these, but there are additional settings.  I also want to always have the selection tools available, etc.  Bottom Line: I just want a collection of settings that I can call up with a single, simple shortcut or button, so I don't have to perform multiple steps just to get the tool back to my standard configuration whenever something changes it.

  • Enable Amount field (KOMV-KBETR) in VA01 for Documen type DR (Debit Note)

    Hi All,
    Is it possible to enable the input of Amount field in item level at the VA01 screen?
    I can input it in item level at VA01 screen for Normal order, but not found when input the Debit note...
    The user want to input it in the main screen not want to input in Condition screen...
    Please help.
    Thanks.
    Terry

    Hi Raja,
    Thanks for your reply.
    I found that the field exist in Document type OR, when I change the Screen sequence group from GA to AU,
    the field KOMV-KBETR appear.
    But is it possible to change my own Screen sequence group, and assign usable fields in the group?
    Terry

Maybe you are looking for

  • Tables in which basis users details are stored

    Hello, I'm writing an application to read Basis users details using JCO. But I'm not able to locate in which tables the users details are stored. I tried looking at USR* tables, but most of its tables doesn't have data. Only usr01 and usr02 are havin

  • DVD Player in Lion

    In DVD Player in Snow Leopard, I used to be able to create video clips (that is, short sections of DVDs to play for my students in school).  DVD Player in Lion does not seem to offer that feature.  Bookmarks are not good enough for my purposes, becau

  • Upgrade to Final Cut 10.0.7 destroyed my generators created in Motion that include drop zones. Anyone experienced the same problem ?

    In Motion 5 I created generators that included a drop zone. The objective it to bring them into Final Cut and insert into the drop zone a clip of the same duration. In FCX 10.0.6 I used to bring a clip to the time line and re size it to the exact dur

  • PowerPC G4 memory issue

    I recently bought Adobe Creative Suite 2 and attempted to install it on my PowerPC G4 with Mac OS 10.2.8 installed. However, before the installation could begin, the installer does a background computer check to see if the computer is able to handle

  • Migration from MS SQL7 to Oracle 8i

    Has any one successfully migrated from MS SQL7 to Oracle 8i (basically tables & stored procedures). Any suggestion would be greatly appreciated. Thanks Anish null