Point in a decimal number

Hi experts,
I want to convert a number as follows :
200,00 will  get 200.
200,23 will  get 200,23
2000 will get 2.000 (with a punt )
Is there any fm for ? how i can achieve this operation ?
Thanks

Do u want the input of an amount field to be changed according to user settings???
If so do as below..
    CALL FUNCTION 'CLSE_SELECT_USR01'  --> this will give ur user settings....
      EXPORTING
        username     = sy-uname
      IMPORTING
        decimal_sign = lv_decimal_sign
        separator    = lv_separator.
              IF lv_decimal_sign EQ ','.  --> check ur user setting
                WRITE: wa_itab-betrg TO lv_numeric_2_string.
                SPLIT lv_numeric_2_string AT '.' INTO lv_decimal lv_fraction.
                REPLACE ALL OCCURENCES OF ',' IN lv_decimal WITH  '.'   .
                CONCATENATE: lv_decimal ',' lv_fraction INTO lv_final_amount.
                WRITE: lv_final_amount TO wa_itab-betrg.
             Endif.

Similar Messages

  • Comma or point in decimal number

    Hi,
    I wonder how to handle decimal number input from jsp page with comma or point. Is there a way to take care of this automatic so a comma get parsed to a point or vice versa.
    Thanks in advance.

    I don't know if it will be a comma or a dot that is inputed. My keyboard uses a comma on the numeric pad but if i change it to a US keyboard it will use dot instead so I can't tell what a user will input. And if I understand everything when java calculates a double it has to be with a dot, or am I completly wrong.
    So with this in mind i decided to replace all dots with a comma and then parse it to a double with NumberFormat and do my calculation and then format it with NumberFormat again. This works fine and gives me a nice output if no one tries to input more than one point or comma.
    I can't think of another way to do it so if this is completly wrong so please point me in the right direction.

  • How to convert fractional decimal number to hex number?

    Hi,
    Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
    if u have any code please share.
    thanks
    neethu

    neethukk wrote:
    Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
    if u have any code please share.
    This question is not clear at all.
    "Fractional decimal" is not a data type, but a way of formatting in readable form using numeric characters and a decimal separator.
    Same to "hex number", but only for integers.
    What do you mean by "convert"? Do you want to keep the value the same or retain the bit pattern of the numeric data type?
    Hexadecimal is for integers. Are you talking about fixed point?
    We clearly need significantly more information. What are the input and output data types? What are you actually trying to do?
    Do you have an example input and corresponding output?
    LabVIEW Champion . Do more with less code and in less time .

  • Decimal Number Validation.

    Hi All,
    I'm working on Interface currently where I need to load data from flat file to db. I use the sql loader to load the data, but before I saved the data I need to validate certain fields. How i can validate do decimal number validation. For an example, 1.11 is valid and 1.111 is invalid (2 decimal level). When i do the validation i need to check the field so it contains 2 decimal points only. If i contains 3 decimal point the data is invalid. Appreciate if anyone can help me with this. Thanks alot.

    1. Will you want to load only valid data ??
    2. Fail the load if one such invalid data found?
    you need to use WHEN clause functionality in the sql loader - foe examples pls visit -
    http://psoug.org/reference/sqlloader.html
    WHEN clause shud look something like following -
    WHEN LENGTH(substr(:columnname,INSTR(:columnname,1,'.')+1,LENGTH(:columnname))) <=2Using above will load only records having one or two digits after the dot [upto 2 decimal]
    Assumption - Column name what ever you are choosing shud have only one decimal [one dot]in its designated start and end places.
    Hope this helps..
    [Untested]
    Edited by: Sri on Mar 22, 2011 8:34 PM
    Typo fixed.. :)
    Edited by: Sri on Mar 22, 2011 8:36 PM

  • How to read number of digits in a given decimal number by using abap

    Hi ,
    How can we read the number of digits present in a decimal number , just before decimal.
    For example: I have this number - 200.00
    Now I want to read how many digits are present in this number before decimal ( . ) point. so in this case the number of digits are 3( 200). Similarly if we have a number 15.00, in this case number of digits is 2 ( 15 ) before decimal point.
    How can i acheive this by using abap.
    Regards
    PG

    Hi
    There are differenent logics available.The previous reply was really good. get another way also.
    Data: v_dec type p decimals 3,
             v_temp   type char20,
              v1 type char10,
              v2  type  char10,
               v_len type i.
    v_temp   = v_dec.
    split  v_dec at  '.'  into v1 v2 .
    condense v1  no-gaps.
    len = strlen( v1 ).
    Regards,
    Chellamma Chandrasekar.

  • Regarding Converting the Decimal number into rounded value...

    Hi,
       i have a decimal number as "   58240990.00 " , i wanted this to rounded value .
      for example I am expecting to see 58241 for the above number.
      shell we can do in any way.. if so please let me knw fast.. it is urgent..
      thanks in advance.
    thanks,
    Suresh..

    Dear Suresh,
    Go through the following code chunk:
    DATA : p TYPE p DECIMALS 2 VALUE '2.49'.
    DATA i TYPE i.
    i = CEIL( p ).
    WRITE : i.
    Regards,
    Abir
    Don't forget to award Points *

  • Rounding off 2 decimal number

    Hi,
    How can i round up float number to two decimal number.
    For example
    Number is 45.987654532 then It should be rounded up to 45.98
    Number is 45.987654546 then It should be rounded up to 45.99Appriciated sample souuce (If any)
    Tanks in advance

    You could have a look at String's format() method. The format strings are
    described in detail here:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.htmlpublic class Round {
        public static void main(String[] args) {
            double number = 45.987654546;
            String roundStr = String.format("%.2f", number);
                // Rounded is 45.99
            System.out.println("Rounded is " + roundStr);
                // The same thing
            System.out.printf("Rounded is %.2f%n",  number);
    }Note: these methods generate rounded Strings from floating
    point numbers. Also, they round to a string representing the "nearest"
    number - your first example is a little hard to understand in this regard.

  • How to convet a decimal number of in to base 64.

    Hi friends,
    my requirement is how to convet a decimal number of in to base 64.
    ex:decimal number could be any type 1,1.2,-1,-1.2 etc
    i found an API Base64.java but iam not able to use .
    Please Help me out.

    try this
    Typecast your array of integers to Byte[] and use method byteArrayToBase64() as:
    String encodeArray = Base64.byteArrayToBase64( new byte[]{ 3, 34, 116, 9 } );Also, browse the below link for more details
    http://kickjava.com/src/java/util/prefs/Base64.java.htm
    Message was edited by:
    Mayank_03

  • I can't use a decimal number in a update routine

    Hi,
    I want to use a decimal number in a udate routine (in a updating rule). I've a code similar to this:
    IF COMM_STRUCTURE-/BIC/ZSATIAUX1 LT 1,5.
      RESULT = 'GOOD'.
    And when I save the routine I get the following error:
    E:Comma without preceding colon (after IF ?).
    The COMM_STRUCTURE-/BIC/ZSATIAUX1 field is numeric field with three decimal positions.
    Can anybody tell me why I can't use decimals in my routine?
    Thanks in advance.
    Regards.

    Hi,
    Try following code:
    Data: Val type COMM_STRUCTURE-/BIC/ZSATIAUX1 .
    val = 1.5.
    IF COMM_STRUCTURE-/BIC/ZSATIAUX1 LT val.
    RESULT = 'GOOD'.
    endif.
    Regards,
    Geetanjali

  • How to convert data read in byte to decimal number?

    The following are a source code to read from a serial port, but i can't convert the data that i read to decimal number and write it on a text file.....can anyone kindly show me how to solve it? thanks
    import javax.comm.*;
    import java.io.*;
    import java.util.*;
    public class Read implements Runnable, SerialPortEventListener {
         // Attributes for Serial Communication
         static Enumeration portList;
         static CommPortIdentifier portId;
         SerialPort serialPort;
         static OutputStream outputStream;
         InputStream inputStream;
         Thread readThread;
         public static void main(String s[])
         portList=CommPortIdentifier.getPortIdentifiers();
         while(portList.hasMoreElements())
              portId=(CommPortIdentifier)portList.nextElement();
              if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL)
                   if(portId.getName().equals("COM1"))
                        System.out.println( portId.getName());
                        Read ss=new Read();
              }     // end of while
    }          // end of main
    public Read()     {
    try{
              serialPort=(SerialPort)portId.open("Read", 2000);
    catch(PortInUseException e)     {}
         try{
              inputStream=serialPort.getInputStream();
              System.out.println(inputStream);
    catch(IOException e)     {}
         try{
              serialPort.addEventListener(this);
    catch(Exception e)     {}
              serialPort.notifyOnDataAvailable(true);
         try{
              serialPort.setSerialPortParams(9600,
              SerialPort.DATABITS_8,
              SerialPort.STOPBITS_1,
              SerialPort.PARITY_NONE);
              }catch(UnsupportedCommOperationException e)     {}
              readThread=new Thread(this);
              readThread.start();
         }//end of constructor
         public void run()
              try     {
                   Thread.sleep(200);
              }catch(InterruptedException e)     {}
         public void serialEvent(SerialPortEvent event)
              switch(event.getEventType())
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                   break;
                   case SerialPortEvent.DATA_AVAILABLE:
                   byte[]readBuffer=new byte[8];
                   try{
                        while(inputStream.available()>0)
                             int numBytes=inputStream.read(readBuffer);
                             //System.out.println("hello");
                        System.out.print(new String(readBuffer));
                        }catch(IOException e)     {}
                   break;
                   }     // end of switch
                   try     {
                        inputStream.close();
                        }catch(Exception e5)     {}
         }          // end of serialEvent

    Is it a float or a double?
    For a float, the decimal should be 4 bytes (small numbers like 1.1 start with the byte 0x40). Convert these 4 bytes to an int, using byte-shifting would probably be easiest.
    int value = ((b3 << 24) + (b2 << 16) + (b1 << 8) + b0);//b# are bytesNow to convert it to a float, use
    Float.intBitsToFloat(value);Now if you want double percision, You will have 8 bytes instead of 4, and need to be converted to a long instead of an int through byte-shifting. Then use Double.longBitsToDouble(long bits) to get the double

  • Removing leading spaces in a decimal number

    I have a decimal number field of length 28 with 9 spaces.I have to print it right justified and remove the leading spaces.I appreciate if anyone can let me the statement for this

    Hi,
      Try this..
    DATA: V_P TYPE P DECIMALS 2.
    V_P = '112.00'.
    WRITE: / V_P.
    DATA: STR TYPE STRING.
    STR = V_P.
    SHIFT STR LEFT DELETING LEADING SPACE.
    WRITE: / STR.
    Thanks,
    Naren

  • Add a date to decimal number

    hello
    pls tell me how to add a date to decimal number as
    4 years and 3 months for example ?
    EX.
    ===
    1/1/2001
    +
    4 years and 3 months
    Regards,
    Abdetu...

    If you want a specific result, then post your desired result...we don't know your desired format mask.
    In case it's yyyymmdd:
    SQL> select to_date('1/1/2001', 'dd/mm/yyyy') dt
      2  ,      add_months(to_date('1/1/2001', 'dd/mm/yyyy'), 51) dt2
      3  ,      to_number(to_char(add_months(to_date('1/1/2001', 'dd/mm/yyyy'), 51), 'yyyymmdd')) num
      4  from   dual;
    DT                  DT2                        NUM
    01-01-2001 00:00:00 01-04-2005 00:00:00   20050401
    1 row selected.

  • Program to convert binary to decimal number?

    I only know how to do a program that converts only 4 numbers, but it to convert any amount of digits the number enters, I think you need to use a loop or something, but I'm not sure how. Could someone please help me? This is my code so far:
    import javax.swing.JOptionPane;
    public class bintodec {
         public static void main (String[] args) {
              String input;
              int number,digit1,digit2,digit3,digit4,result;
              input = JOptionPane.showInputDialog ("Enter a binary number.");
              number = Integer.parseInt(input);
              digit1 = ((number % 10000) - (number % 10000 % 1000)) / 1000;
              digit2 = ((number % 1000) - (number % 1000 % 100)) / 100;
              digit3 = ((number % 100) - (number % 100 % 10)) / 10;
              digit4 = (number % 10);
              result = (digit1 * 8) + (digit2 * 4) + (digit3 * 2) + (digit4 * 1);
              System.out.println ( "Binary number: " + input + "\nConverted Decimal Number: " + result);
              System.exit( 0 );
         } // main
    } // bintodecany help is super-appreciated.

    I am not sure if this will help you. Check it out, run it and let me know if it helped.
    import java.util.*;
       public class BitwiseTest1 {
           public static void main(String[] args){
            System.out.println("Enter a integer number:");
            Scanner keyboard = new Scanner(System.in);
            int n1 = keyboard.nextInt();
            System.out.println( "n1 as binary " +
                   Integer.toBinaryString( n1 ));
            System.out.println( "NOT n1 =     " +
                   Integer.toBinaryString( ~n1 ));
            System.out.println("Enter another integer number:");
            int n2 = keyboard.nextInt();
            System.out.println( "n2 as binary " +
                   Integer.toBinaryString( n2 ));
             System.out.println( "NOT n2 =     " +
                   Integer.toBinaryString( ~n2 ));
    }

  • Prefix zero to a decimal number

    Hi All,
    I need to send a value to third party system. The value is a decimal number but before sending it i need to prefix zero.
    Eg: 1.25---> 00000000001.25
    The Functiom module CONVERSION_EXIT_ALPHA_INPUT works only for integers.
    Can you please suggest a function module which wil satisfy my requirement.
    Thanks
    Rohit

    Use a For loop to index into the array, then use the Not Equal To Zero comparison to convert it to true/false. Then Index out of the For and use the Bool Array to Int from the boolean pallete.
    Here is an example in 8.2
    Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
    using LV 2010 SP 1, Windows 7
    Attachments:
    Convert Bit Array to Int.vi ‏8 KB

  • We can't add a decimal number column with the create table forms

    In the version 4, we can't add a decimal number column with the create table forms.

    In the GUI, I found the following column (I translate from french to english): PK, Name, Data_type, lenght, not null, default, comments.
    In the lenght field, if I enter 9,3 to have a NUMBER(9,3), I have a message saying that the number must be an integer.

Maybe you are looking for