FM to convert charcacter to Float

Hi,
i am moving the Character set to Packed type.
is there any function module for the same?
please send me
thanks
shiva

Hai Shivakumar
Check with the code
Data : J_VALUE TYPE STRUC_DC_ATTRIBUTE_RFW-VALUE,
       J_ATTRIBUTE_ADM   TYPE STRUC_DC_ATTRIBUTE_ADM_RFW,
       J_ATTRIBUTE_ADM   TYPE STRUC_DC_ATTRIBUTE_ADM_RFW,
       j_pointer type ref to data.
FIELD-SYMBOLS <FIELD1> TYPE ANY.
CALL FUNCTION 'CONVERT_FROM_CHAR_SORT_RFW'
     EXPORTING
          CHARVALUE = j_value
          ABAPTYPE  = j_attribute_adm-abaptype
          rfieldname = j_attribute_adm-ref_field
          rtabname = j_attribute_adm-ref_table
    IMPORTING
         POINTER   = j_pointer
        assign j_pointer->* to <field1>.
Thanks & regards
Sreenivasulu P

Similar Messages

  • Converting string to float

    I have a decimal string "122339994" which i am trying to convert to float using Float.parseFloat. This results in incorrect value of 1.22339992E8.
    I thought for floats precsision comes into effect after decimal places.
    public static void main(String[] args) {
    String floatString = "122339994";
    float floatNumber = Float.parseFloat(floatString);
    System.out.println("Float is "+floatNumber+". Now double "+Double.valueOf(floatString));
    }

    See this API
    [Java2SE Float|http://download-llnw.oracle.com/javase/6/docs/api/java/lang/Float.html#valueOf%28java.lang.String%29]
    Note that trailing format specifiers, specifiers that determine the type of a floating-point literal (1.0f is a float value; 1.0d is a double value), do not influence the results of this method. In other words, the numerical value of the input string is converted directly to the target floating-point type. In general, the two-step sequence of conversions, string to double followed by double to float, is not equivalent to converting a string directly to float. For example, if first converted to an intermediate double and then to float, the string
    "1.00000017881393421514957253748434595763683319091796875001d"
    results in the float value 1.0000002f; if the string is converted directly to float, 1.0000001f results.
    Its better to see the Java APIs first for any information, we will get almost all the information we need from APIs
    Regards,
    Venkatesh

  • Convert string to floating-point

    Hi all,
    ..very basic question, but I tryed it for hours and only received short-dumps
    <b>How can I convert a string into a floating-point number?</b>
    Kind regards,
    Stefan

    hi
    try this
    to convert  string to float.
    data : a type f,
    s type string value '1.023'.
    a = s.
    write :/ a.
    to convert float to string.
    data : a type f value '1.023',
    s type string.
    s = a.
    write : s.

  • Looking for VI where i can convert covert a float number to Q 11.5 representation

    looking for VI where i can convert covert a float number to Q 11.5 representation and what exactly  Q 11.5 representation means.
    Kindly help me on the same.
    Solved!
    Go to Solution.

    Appears to be right, but don't forget to round to the nearest integer.
    http://zone.ni.com/reference/en-XX/help/371361H-01/glang/round_to_nearest/
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Converting Vector with Floats to float[] typecast error?

    Java Developers,
    I am able to convert my String vector to a
    String[] but just can't get the Vector with Floats to be converted to a float[] array. I have looked into google and java.sun.com Forums but still cant seem to find the answer. I would really appreciate your help!
    This is how I am making the conversion from Vector(String) to String[]:
    legendLabelsArray = new String[columnHeads.size()];
    int k=0;
    Iterator e = columnHeads.iterator();
    while(e.hasNext()){
    System.out.println("inside the enumerator");
    legendLabelsArray[k] = e.next().toString();
    System.out.println("Array elements at " + k + " are " + legendLabelsArray[k]);
    System.out.println(k++);
    How can I make something similar to work with a Vector with Floats to float[] instead of Strings?
    Thanks,
    Musaddiq
    [email protected]

    Something like this ...
    float[] floatArray = new float[vectorOfFloats.size()];
    int k=0;
    Iterator e = vectorOfFloats.iterator();
    while(e.hasNext()){
    floatArray[k] = ((Float) e.next()).floatValue();
    k++;

  • Convert Char to float

    Hi all,
    Am wanting to convert a char value (the infoobject is defined as NUMC) into float in order to perform a calculation in the FOX formula. It would not allow the char value to be stored into a float variable...comes back wz an error message - Types of operands F and <infoobject_numc> do not agree.
    Any ways of doing this? I thought about using a function to perform the conversion from char to float format but dont knw if such a function exists on the BI system?
    Thanks!

    Hi,
    I sometimes use a local variable of type STRING to pass on values to other data types:
    DATA local type STRING.
    local = A.
    B = local.
    But I'm not sure it will work for you. If not, you can do it with an exit function.
    D

  • Convert color to float

    Hello!
    I�m using a JColorChooser to pick a color and I wanted to convert this value in a float.
    Using :
    Color color = Painel_cores.getColor();
    float[] myColor = { color.getRed(), color.getGreen(), color.getBlue() };
    I get trash that can�t be used�
    Using:
    float corRed=color.getRed();
    float corGreen=color.getGreen();
    float corBlue=color.getBlue();
    I get the 3 components separate. How ca I join them to have (255,255,255) ?
    Thanks
    Nuno

    I�m using a JColorChooser to pick a color and I
    wanted to convert this value in a float.A float array, I assume after reading the following:
    Using :
    Color color = Painel_cores.getColor();
    float[] myColor = { color.getRed(), color.getGreen(),
    color.getBlue() };
    I get trash that can�t be used�That surprises me because you simply get a float array containing
    three elements, all set to their correct values after being cast to type
    float ...
    Have you tried to print the three values and what were the results?
    kind regards,
    Jos

  • Convert hex to float

    I have to convert a bit Hex string into a float. I built a vi from the following C code, but it only works on positive numbers. Any suggestions?
    sample16 = (short) ((MSB << 8) | LSB);
    sample = (float)sample16/32768.0;
    sample*=10.0;
    Attachments:
    Parse Response.vi ‏13 KB

    [email protected] wrote:
    Hi altenbach
    The data is come from flowmeter by MODBUS. 
    Thanks
    Hong
    You are not giving us any useful information.  Look up the manual of your device.  Somewhere in there should be a definition of how the numbers are built up.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Convert int to float

    How do I properly convert an int to a float?
    I input a number such as 0x42c26163
    The final number should be 97.19021
    I thought I could just do a cast so I tried this:
    int test = 0x42c26163;
    float test2 = (float)test;
    But test2 comes up 1.120035171 E9
    How do I get to the final 97.19021?
    In another project I'm working on using C#, the conversion works when I use the BitConverter class.
    I'm sure I am just overlooking the obvious, but can someone can help me?

    I suppose that int number is really the content of a float read back from raw memory or received from an instrument or on some communication channel. Rebuilding the float number has been discussed a couple of ways in the forums: I can suggest you look at this thread or this other one which give you feasible solutions.
    This is basically a reflect of how floating point numbers are stored in memory according to IEEE754 standard, which you may want to take a look at to understand a bit how all the matter is treated.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Convert short[] to float[]

    Hi, I'm trying to convert a short[] to a float[]. The following code works fine, but when I try to convert between arrays I get "cannot resolve symbol" error. Can anyone tell me the cause of this error? Thanks.
    short s=2;
    float f;
    f = new Float(s).floatValue(); //works fine
    short[] shortArray;
    float[] floatArray;
    floatArray = new Float(shortArray).floatValue(); //gets error

    Firstly don't use new AnyClass() to do conversions between primatives, it creates object unneccassaily. You can cast primative types from one value to another.
    Don't use float unless you really need to. double is just as fast and more accurate. The amount of memory you will save will be worth less than 1 cent. (most of the time)
        public static double[] convertToDoubleArray(short[] shortArray) {
            double[] ret = new double[shortArray.length];
            for (int j = 0; j < shortArray.length; j++)
                ret[j] = shortArray[j];
            return ret;
        }

  • Convert Object to Float

    Hello,
    I'm trying to convert an Object to a Float and can't seem to get it to work properly. I'm using a HashMap to store object key-value pairs. The values inserted into the HashMap were originally of type float. I can extract the value found in the map, but I cannot then convert that to a float to be assigned to another variable. For example:
    Object holdValue;
    holdValue = someHashMap.get(someKey); // so far so good
    float aFloatNumber = holdValue; // can't do this because
    // holdValue stores an object
    How do I convert "holdValue" from an Object to a float so that it can be assigned to "aFloatNumber"?
    Thank you.

    Well the keys could not have been of type float because float is a primative and HashMap will only take Objects as it's keys and data. So you have an incorrect notion of what is in your HashMap. If the key was a Float (the wrapper class of float) you can just cast it and you would be fine but there is no way to assign an Object to a float, you could convert threw some method (like fields 1 plus field 2 or something) but you can't just convert.

  • Problem in Converting string to float

    Hi,
    I am reading from textField and trying to convert that string value to float.
    Compiler is giving error cannot find symbol toFloat even though I have included java.lang in my program.
    Please help me with this one.
    Thanks.

    Use
    float f = Float.parseFloat(inputString); //where inputString is the string you want to parse

  • Convert double precision float string to a number

    I am a newbie with Labview.
    I have a GPIB link with a vector voltmeter and I receive the data as a double precision float string (IEEE standard 754-1985). I would like it to be recognized as a number, but I can't find the proper conversion function. The string to convert is 8 byte long. Does anyone have an idea how to do it? Thank you!

    Asumming your data is big-endian, you should be able to simply typecast it to a DBL (see attache LV 7.0 example).
    (It is possible that your DBL string is little-endian, in this case it will be slightly more complicated. Let us know )Message Edited by altenbach on 05-27-2005 04:49 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringToDBL.vi ‏23 KB

  • Converting double to float

    This problem only occurs when dealing with large numbers or numbers with a lot of fraction digits.
    Here is an example:
    double d = 7.1E9;
    float f1 = (float)d;
    float f2 = new Float(d).floatValue();
    System.out.println( d + " " + f1 + " " + f2);
    The result is:
    7.1E9 7.1000003E9 7.1000003E9
    I tried other ways of converting to float (using DecimalFormat) but unfortunately nothing works. The resulting float is not the same as the original double.
    Any ideas?
    Thanks.
    Igor.

    float is only 32 bit while double is 64 bit, so you can easily get differences like that.
    Is it a problem? If you results gets inaccurate you should stay with double or use BigDecimal if you really care about the precision. If it's because you want to round the result of before you display it, you can use DecimalFormat.

  • Converting string to float number

    Here's what I'm trying to do. The user types a number, such as 12.011, in an input box. I want to check to see if the number they typed is between two numbers, such as 12 and 12.1. Therefore, I want to convert the string in the input box to a float number, not an integer, so I can check to see if it's in the correct range. How do I convert a string into a float number?
    thanks
    Mark

    Did you try:
    Number(textinput1.text);
    if(Number(textinput1.text)>12 && Number(textinput1.text)<12.1)

Maybe you are looking for