Converting HEX to FLTP

Hi All,
  I want to convert a hex value to FLTP. How can I do it?..
Normal covnersion rules say it is first converted to a packed number and then to floating point number giving me the wrong results.

Hi
As you have said that ABAP supports automatic type conversion for all the fields with the exception that you  can't assign type t to type d and vice versa.
I feel whatever you are getting is the correct value after automatic type coversion.
Try to use correct data types wherever possible.SAP is also recommending this.
Abdul

Similar Messages

  • Java code to convert - Hex to Dec

    I'ld like to convert an Integer or a String from hexadecimal format to a decimal format;
    For example: 30 give 0; 50 give P and so on.
    Can any one help me sending to me a java code that do it please?
    Thanx a lot

    This doesn't convert hex to decimal, but it does convert hex to the character representation, which is what it sounds like you want. At any rate, given "30" it will print "0" and given "50" it will print "P". Also, given "P" it will print "is invalid".
            try
                int in = Integer.parseInt(s, 16);
                Character ch = new Character((char)in); // should validate range here
                System.out.println("In: " + s + ", out: " + ch);
            catch (NumberFormatException e)
                System.out.println("In: " + s + " is invalid.");
            }

  • Converting hex to dec

    Hi everybody,
    I want to join this two numbers and convert them from hex to dec. I have tried using joint and conversion but I still couldn't work it. In the following screen shot I took it suppose to be 3E8 in hex which equals to 1000 in dec. I need suggestion from you how to approach this.
    Thanks
    Solved!
    Go to Solution.

    SOBGA wrote:
    As I was reading all the answers about converting Hex to Dec,I found out that many of you are making it so complicated.To make it easier for a learner or beginner,this is what it takes:
    Open a blank VI
    Click on numeric control
    Right click on the same numeric control
    Scroll down to "Representation"
    Click on "U8"
    Go to numeric indicator and repeat step 4 and 5
    Then right click again on numeric control
    Scroll down to "Properties" and click
    Click on "Data entry",if necessary,change the minimum and maximum
    Pass to "Display format" 
    Click on "Hexadecimal" then you are done.The rest is to go on the block diagram to wire the numeric control to the numeric indicator and it works.
    You can do the same process reverse for dec to hex.But you must know that what we did for "numeric control" on (Hex to Dec) will be done to "numeric indicator" on (Dec to Hex).This same process can apply to octal and binary without the use of complicated array,string while loop and so on...
    I'm a beginner in Labview and I understand that you need to explain more to understand better.
    If you really read all of the comments, you would see that Altenbach already stated this (saying it is just a cosmetic property for the indicator).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Converting Hex to Integer Value

    I'm trying to convert hex code to the corresponding integer, which can then be used to display a character.
    For example I have the code.
    int i = 0xE7;
    System.out.println(i);
    System.out.write(i)This produces the output as expected with the first output outputting 231, and the second line outputting the corresponding character.
    My problem comes when trying to make it so the hex code is variable.
    For example, I receive an output of 7
    This output is then the last digit of the hex code (so i check if needs to be converted to a, b etc.) then try and combine it with the prefix 0xE to create the hex code.
    I'm not quite sure how to do this bit as I cant carry out
    num = 7;
    hex = "0xE"+num;
    int i = hex;as the last line doesn't calculate due to hex being a string.
    Many thanks for your help.

    leesto wrote:
    The char array is currently being created using:
    char [] hexchar = "0123456789ABCDEF".toCharArray();
    Look this is OK, you need to do nothing but just the following:
    // I am using the very first example you provided
    // i is the index for the char
    String hex = "0E" + hexchar;
    Integer.parseInt(hex, 16);
    System.out.println(i);

  • Convert  Hex to Dec in Numbers

    Hi,
    Can some one let me know how to Convert Hex to Dec in Numbers.
    When ever I type Hex 00E0 it will appear in the cell like this 0.00E+00 ,who do i fix this.
    Thanks
    Ashan

    -+-+-+-+-+-+-+-
    Entering the Help and Terms of Use area you will read:
    *What is Apple Discussions and how can it help me?* 

    Apple Discussions is a user-to-user support forum where experts and other Apple product users get together to discuss Apple products. … You can participate in discussions about various products and topics, find solutions to help you resolve issues, ask questions, get tips and advice, and more.
    _If you have a technical question about an Apple product, be sure to check out Apple's support resources first by consulting the application Help menu on your computer and visiting our Support site to view articles and more on our product support pages_.
    I have a question or issue—how do I search for answers? _
It's possible that your question or issue has already been answered by other members so do a search before posting a question._ On most Apple Discussions pages, you'll find a Search Discussions box in the upper right corner. Enter a search term (or terms) in the field and press Return. Your results will appear as a list of links to posts below the Search Discussions Content pane.
    -+-+-+-+-+-+-+-
    Taking care of that, you would already know the response.
    Using the really cumbersome keystring "convert AND hex" as described in the forum's help returns two entries.
    One is you question.
    The other is: http://discussions.apple.com/thread.jspa?messageID=7242325
    which gives a link to:
    http://discussions.apple.com/thread.jspa?messageID=7078123
    Yvan KOENIG (from FRANCE jeudi 24 juillet 2008 09:19:34)

  • How to convert hex string to time stamp?

    Hello everyone..
    I am currently working on a project in which I have to read the data from a unit and display that data using LabVIEW. I am using serial communication for reading the data. The read data is in hex format. 
    Now, I want to convert this hex string to a time stamp value. I am reading total 16 bytes. How to convert this hex data to a time stamp value. I have developed a VI. But I want to know that the displayed time stamp is correct or not? Or suggest me some other solution. 
    I am using LabVIEW 2011.
    Thanks & Regards,
    Manisha
    Attachments:
    Test.vi ‏7 KB

    Hi mancan,
                      As Iam using LV2009 Iam unable to open your example.Anyway for converting hex to time stamp
    Thanks as kudos only

  • Convert hex to Decimal and keep leading zeros..

    Hi,
    I hope you can help?
    How to convert hex to Decimal and keep leading zeros
    I read 002C, hex, and I want to convert it to 0044 decimal.
    sscanf (MyNum, "%4x", &DecNum); will only give me 44.
    It have been working up till I started to get leading zeros.
    We will always have a 4 digit hex input in a range
    We must have the leading 00 in this case.
    How is this best done?
    Thanks for the help
    Simon
    Solved!
    Go to Solution.

    Hi,
    I don't really understand your problem. Is this stuff what you need ?
    int main (int argc, char *argv[])
    const char MyNum[] = "002C";
    int DecNum;
    sscanf (MyNum, "%4x", &DecNum);
    printf ("%04d", DecNum);
    getchar ();
    return 0;
    "0044" appears on standard output when printf function executes...

  • Convertion Hex String to 32bits Decimal floating point??

    Hi,
    I would like to know how to convert hexa like: 416b0ac3 in decimal 32bits floating-point. The result of this string is suppose to be 14.690127.
    So i must be able to do:
    From 32-bit Hexadecimal Representation To Decimal Floating-Point
    Thanks for your support
    RiderMerlin

    RiderMerlin
    You can use the typecast function to do this.
    David
    Message Edited by David Crawford on 09-06-2006 03:31 PM
    Attachments:
    Typecast to Single.jpg ‏6 KB

  • Convert Hex to ASCII

    Is there an easy way to convert a HEX file format or string to ASCII format? It's easy to convert ASCII to HEX using using "toHexString" but how do you convert HEX back to ASCII?

    Integer.parseInt(hexString, 16);

  • How to convert hex into a string value

    hei evryone!
    can anyone please help me on how to convert a hex value into a string suppose.. Example i want to convert 4275646479 which is a hex value, into a string "BUDDY"? how will i do that???
    Any suggestion, tutorial site would be appreciated?
    Thx!

    something like this will convert string to byte[]
    e.g.
    you want to convert following.
    656667 => ABC
    String toConvert = "656667";
    byte[] returnVal = String2byteArr (toConvert );
    String FinalStr = new String(returnVal);
    public static byte[] String2byteArr(String Result)
    byte[] byteRet = new byte[Result.length()/2];
    int k=0;
    for (int j=0; j<(Result.length()); j+=2)
    try
    Integer I = new Integer (0);
    I = I.decode ("0x"+Result.substring(j, j+2));
    int i = I.intValue ();
    if (i > 127)
    i = i - 256;
    byteRet[k++] = new Integer(i).byteValue();
    catch(Exception e)
    System.err.println(e);
    return byteRet;
    }// String2byteArr
    Hope this will help you, So that i can get 3$ (:-)
    Avi

  • 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

  • Converting hex to number & date

    Hi!
    Im having a problem converting the hex code to the number & date.
    select low_value,high_value from ALL_TAB_COL_STATISTICS;
    Iv tried HEX_TO_CHAR and that works fine.
    select column_name, UTL_I18N.RAW_TO_CHAR(low_value),UTL_I18N.RAW_TO_CHAR(high_value),low_value, UTL_I18N.RAW_TO_CHAR(high_value) from ALL_TAB_COL_STATISTICS where owner = 'user' and table_name = 'table_name';
    if you type this statement you will see that numeric fields and date fields get caught up in (¿) type of fields.
    Any solution for this?
    BR / S-A
    Edited by: SweAnderline on 2008-nov-14 12:58

    Hi William!
    Need your help again.
    Iv taken your statement and alterd it a bit.
    SELECT c.table_name table_name, c.column_name, c.data_type
    , c.histogram
    , CASE c.data_type
    WHEN 'NUMBER' THEN TO_CHAR(UTL_RAW.CAST_TO_NUMBER(c.low_value))
    WHEN 'VARCHAR2' THEN UTL_RAW.CAST_TO_VARCHAR2(c.low_value)
    WHEN 'DATE' THEN
    RTRIM(TO_NUMBER(SUBSTR(c.low_value,1,2),'XX') -100 ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,3,2),'XX') -100,2,'0') || '-' ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,5,2),'XX'),2,'0') || '-' ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,7,2),'XX'),2,'0') || ' ' ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,9,2),'XX') -1,2,'0') || ':' ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,11,2),'XX') -1,2,'0') || ':' ||
    LPAD(TO_NUMBER(SUBSTR(c.low_value,13,2),'XX') -1,2,'0'),':- ')
    END AS low_val
    , CASE c.data_type
    WHEN 'NUMBER' THEN TO_CHAR(UTL_RAW.CAST_TO_NUMBER(c.high_value))
    WHEN 'VARCHAR2' THEN UTL_RAW.CAST_TO_VARCHAR2(c.high_value)
    WHEN 'DATE' THEN
    RTRIM(TO_NUMBER(SUBSTR(c.high_value,1,2),'XX') -100 ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,3,2),'XX') -100,2,'0') || '-' ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,5,2),'XX'),2,'0') || '-' ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,7,2),'XX'),2,'0') || ' ' ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,9,2),'XX') -1,2,'0') || ':' ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,11,2),'XX') -1,2,'0') || ':' ||
    LPAD(TO_NUMBER(SUBSTR(c.high_value,13,2),'XX') -1,2,'0'),':- ')
    END AS high_val
    , c.num_distinct
    , c.avg_col_len
    , ROUND(c.density,1) AS density
    , c.num_nulls, c.nullable
    , round(((c.num_nulls*100)/decode(nvl(d.num_rows,1),0,1))) || '%' "Null % of total Rows"
    , c.last_analyzed
    , d.num_rows "Number of rows in table"
    FROM all_tab_columns c, dba_tables d
    WHERE c.table_name = d.table_name and c.owner like 'MDB%'
    AND c.owner = d.owner
    ORDER BY c.table_name asc;
    What I cant get to work is my
    -- round(((c.num_nulls*100)/decode(nvl(d.num_rows,1),0,1))) || '%' "Null %"
    When I execute the statement I get divisor is equal to zero, so I tried to add a nvl if its null then 1, and if its 0 in number of rows then 1.
    Iv tried multiple ways to do this but I cant get it to calculate. With the current statement I dont get any results.
    I can get it to work if I create a view with this statement and add a specific table_name. But I need to get this to work in the whole schema/user without entering a specific table.
    Any ideas what I can do else?
    Thx in advance
    Cheers

  • Converting Hex string to unicode

    I am reading in a hex representation of Unicode characters as a string.(for example: 004100200042)
    I want to convert the string from hex to unicode, and write the corresponding characters to a file. The output should look like follow:
    A B (0041 = Capital A, 0020 = space, 0042 = Capital B)
    Could you please assist?

    Problem solved, no need to look into it. Thank you

  • Converting Hex to Decimal

    hi,
    I want to convert my hex value to decimal. How can I do this? help me pls.
    Suku

    actually...the hardware I'm interacting through com port will retrun data every time in different length. I'm reading that data, byte by byte only. So in that second byte I'm getting the length of the data returned by the hardware. Now for executing my loop that length is required.
    while ((ch = (byte)portInStream.read())!=-1)
    indata[i] = ch;
    String hexString = Integer.toHexString(indata);
    hexDec = Integer.parseInt(hexString);
    strData =strData + hexString;
    i++;
    if(i==15) break;
    in the above code I'm reading 15 bytes from the port. But it may vary...to know the length I want to convert the second byte to int.

  • Packages that convert hex to dec

    hi,
    i have a table posicional which has large object on it..the column grarep(graphical representation) and attr_posn contains hexadecimal value of coordinates that is used in automated mapping
    SQL>DESCRIBE POSICIONAL;
    Name          Null     Type
    class_id           NUMBER(10)
    class_memb NUMBER(10)
    codigo               NUMBER(10)
    simbolo               NUMBER(10)     
    xmin               NUMBER(10)
    ymin               NUMBER(10)
    xmax               NUMBER(10)     
    grarep               BLOB
    attr_posn          BLOB
    usuario               VARCHAR2(30)
    fecha               DATE
    texto               VARCHAR2(50)
    --Once i query grarep and attr_posn
    SQL>SELECT grarep from posicional;
    Column or attribute type cannot be displayed by SQL
    --I made a function blobtochar to be able to view the data on grarep and attr_posn
    CREATE OR REPLACE FUNCTION Blobtochar (field_name IN BLOB)
    RETURN VARCHAR2 IS
    OutputStr VARCHAR2(32767);
    -- OutputStr LONG;
    AmtToRead NUMBER:=4000;
    Position NUMBER:=1;
    LENGTH NUMBER;
    BEGIN
    LENGTH := DBMS_LOB.GETLENGTH(field_name);
    LOOP
    OutputStr := OutputStr || DBMS_LOB.SUBSTR(field_name, AmtToRead, Position);
         Position := Position + AmtToRead;
         LENGTH := LENGTH - 4000;
         EXIT WHEN LENGTH < 4000;
    END LOOP;
    RETURN OutputStr;
    END Blobtochar;
    SQL>SELECT blobtochar(grarep) from posicional
    --now i can view the data in grarep..
    --for example
    SQL>SELECT class_memb, blobtochar(grarep) FROM posicional WHERE class_memb=111025648;
    blobtochar(grarep)
    00000001000000010000000606D4E833074B69EC06D4E91F074CO18406D50C58074C031E
    HERES MY QUESTION,
    1.how can i convert this hexadecimal coordinates so that when i query, a decimal value will appear instead of hex. this hex values are the lines in the map.heres the info about the hex value above. we need to parse or cut the hex into 8..
    00000001
    00000001
    00000006 ==>number of coordinates(ranging from 1-F, this example means 6)
    06D4E833 ==> X1
    074B69EC ==> Y1
    06D4E91F ==> X2
    074CO184 ==> Y2
    06D50C58 ==> X3
    074C031E ==> Y3
    connecting 4 coordinates/2points/ will make 1 line
    connecting 6 coordinates/3points/ will make 2 lines
    connecting 8 coordinates/4points/ will make 3 lines
    connecting 10 coordinates/5points/ will make 4lines
    connecting 12 coordinates/6points/ will make 5lines
    connecting 14 coordinates/7points/ will make 6lines
    and so on..
    In the example above there are 6 coordinates
    point(X1Y1), point(X2Y2), and point(X3Y3). Connecting all 3 points will make 2 lines). computing the total length by phytagorean therorem
    LINE1 length=square root of X2-X1 squared + Y2-Y1 squared
    LINE2 length=square root of X3-X2 squared + Y3-Y2 squared
    total length = LINE1 + LINE2
    how can i implement this so that when i query specific grarep and attr_posn, a computed total length in decimal value will appear instead of hex..thanks

    You might enjoy reading the SQL Reference manual. Chapter 2 deals with datatypes and numeric format models - for 9i the reference you need is http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements4a.htm#34512

Maybe you are looking for