Funtion modules to convert hexa decimal to integer

Hi,
Every one
can any one suggest me  the function modules that can be used to convert the hexadecimal to integer.

Hi,
    Define a variable of type integer, and move the value of the hexadecimal variable into the declared variable.
Example.
DATA : var1 TYPE i,
       var2 TYPE x LENGTH 4 VALUE '00002710'.   " Hexadecimal value equal to 10000 integer
* directly move the value in hexadecimal type variable into integer type variable
MOVE var2 TO var1.
WRITE :/ var1.
Var1 = 10000   " Integer.
Regards
Bala Krishna

Similar Messages

  • Very Urgent - Converting Character value to Hexa Decimal value

    Hi
    data: lv_stsor_hex(16) type X.
    p_is_ppc_comp_conf-stsor is a char 10 field ***
    <b>write p_is_ppc_comp_conf-stsor to lv_stsor_hex.</b> "<-- Hex Conversion
    In 4.6C version this write statement is working fine but this is obsolete in ECC 6.0
    and its showing syntax error.
    Can anyone tell me how to convert a 10 char length value to a hexa decimal value
    which is of 16 characters length and of type hexadecimal
    Thanks a lot. Points will be rewarded immediately.

    Hi,
    Use the Function module CHAR_HEX_CONVERSION.
    report zeta_hex.
    data: s type string.
    data: h(1) type x.
    data: c(1) type c.
    data: byte(2) type c.
    data: length type i.
      FIELD-SYMBOLS: <DUMMY>.
    s = 'ThisIsAString'.
    length = strlen( s ).
    do length times.
      byte = ( sy-index - 1 ).
      c = s+byte(1).
    * You can do this
      ASSIGN h TO <DUMMY> TYPE 'X'.
      WRITE c TO <DUMMY>.
    * or you can do this
    *  call function 'CHAR_HEX_CONVERSION'
    *       exporting
    *            input     = c
    *       importing
    *            hexstring = h.
      write:/ h.
    enddo.
    Regards
    Sudheer

  • Convert decimal into integer

    Hello i think that's a simple question. I've to convert a decimal number (such as 0,1 ) into an integer number such as 0.
    What should i do? i tried with functions >> numeric >> conversions >> to long integers but i saw  it has only integers as input. 

    Not 100 percent sure what you wanted, so I've provided 3 alternatives.
    Mathematically rounds the number to the nearest whole value (integer)
    Divides the number by 1 (can be any constant, but for your case, 1 is used) and returns the quotient and remainder.  The quotient is the number as if it was rounded down to the nearest whole value (integer)
    Blindly converts your single precision (I assume this is your data type) to a long integer.  This will also get rid of the decimal place.
    I hope this helps.
    P.S.  Examples 1 & 2 use DBL precision values - these are interchangeable with SGL precision values, assuming you only need 1dp precision.
    Message Edited by James Mamakos on 05-11-2009 10:53 AM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    Nearest integer.JPG ‏5 KB
    Nearest multiple of 1.JPG ‏6 KB
    Blind conversion.JPG ‏7 KB

  • 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 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

  • Easier Way to convert Hex to Integer

    This problem is mainly to do with a hex string to integer conversion.  The device, connected via serial connection outputs hex in the format 0A00, when looking at it in hex.  The first two digits are the data, the last two are attached to seperate data points.  what I'm trying to do is to raster the last 2 digits off so that 2A00 becomes 2A and then convert the 2A into integer format (42).  I have come up with a method to do this, but it is very messy and occasionally results in data loss.  I have attached my vi (8.2).  The large integer being subtracted is a constant that continues to come up for reasons I am not aware of.
    another issue which I am coding through is the fact that sometimes a byte slips by, making 2A00 become 00BB or something of that format.  Is there a way to scan the string, determine whether the first two digits or the last two digits are the valid ones and then seperate the valid string?  In this code, it would be necessary to allow for the value 0000 to read 0.
    If there is confusion, here is some examples of incoming data and desired output
    0100 - 1
    0A00 - 10
    0005 -5
    000B - 11
    etc.
    Solved!
    Go to Solution.
    Attachments:
    geiger read.vi ‏28 KB

    Since you are reading 2 bytes, it looks like you should be dealing with a 16 bit number. Typecast to U16 rather than I32 like you are doing now. And all of that string manipulation make it look like you are getting a string of ASCII formatted characters like "0" "A" "1" "B" rather than a 2 byte string of ASCII characters 0A and 1B. Then you can split the U16 number and take the higher order byte.
    I can't explain why you would be having a byte slip by unless it has something to do with all that string manipulation you are trying to do.  But if it still happens, and you know one byte for the other is always zero.  Just take the high order byte and add it to the low order byte.  Since one is zero, it will have no effect on the other byte.
    Message Edited by Ravens Fan on 07-07-2009 01:54 PM
    Attachments:
    geiger%20read[1]_BD.png ‏3 KB

  • Is there any function module to convert hexadecimal format to normal decima

    Hi,
    is there any function module to convert hexadecimal format to normal decimals.
    Regards,
    Nandha.

    HI Naddy,
    simply do this..
    parameters  : num1(5) type x.
    data : dec type i.
    dec = num1.
    write : dec.
    remember to pad the input with zeros
    regards
    satesh

  • 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.");
            }

  • Problem with Time stamp function module for converting US to Japan

    Hi All,
    I need standard function module for converting US Timestamp to Japan, Can any one let me know is there any standard function modules.
    thanks in advance!
    Regards,
    Kalidas.T
    Edited by: Kalidas Thirumoorthy on May 5, 2009 5:29 PM
    Edited by: Kalidas Thirumoorthy on May 5, 2009 5:30 PM
    Edited by: Kalidas Thirumoorthy on May 5, 2009 5:30 PM

    Try this way:
    CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.
    CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.
    <tst> is of type P(8) or P(11) with 7 decimal places
    <tz> of type C(6)
    Refer to help.sap.com for more details.

  • Character to Hexa decimal

    Hi ,
    Is there any CLASS->METHOD which converts character values to Hexa decimal values?
    I am getting a syntax error in ECC 6.0.
    Please provide some example.
    Thanks
    Title was edited by:
            Alvaro Tejada Galindo

    Hi,
    (p_is_ppc_comp_conf-stsor is 10 char field.)
    data: lv_stsor_hex(16) type X.
    write p_is_ppc_comp_conf-stsor to lv_stsor_hex. "<-- Hex Conversion
    In 4.6C the write statement is working and the 10 char value is getting converted to a 16 length hexa field.
    But in Upgrade its showing error in EPC saying that cannot write 10 char value into a hexa field.

  • Function module to convert string to decimals?

    HI,
    is there any function module to convert string value in to decimals...string value contains exponent form...or any other way to convert if there is no funtion module..
    please let me know...
    Thanks
    Venkatesh

    Like this?
    data: str type string.
    data: f type f.
    data: p type p decimals 3.
    str = '1.2345678900000000E+08'.
    f = str.
    p = f.
    write:/ p.
    Regards,
    RIch Heilman

  • Function module to convert currency to USD

    Hi All,
                 I need the function module to convert the currency to USD and the mandatory fields to be passed to the function module.
    Thanks & Regards
    Suresh

    hi,
    Working With LSMW:
    Use TCODE LSMW
    Objects of LSMW:
    •Project – ID with max of 10 char to Name the data transfer project.
    • Subproject – Used as further structuring attribute.
    • Object – ID with max of 10 Characters, to name the Business object .
    • Project can have multiple sub projects and subprojects can have multiple objects.
    • Project documentation displays any documentation maintained for individual pop ups and processing steps
    User Guide: Clicking on Enter leads to interactive user guide which displays the Project name, sub project name and object to be created.
    Object type and import techniques:
    • Standard Batch / Direct input.
    • Batch Input Recording
    o If no standard programs available
    o To reduce number of target fields.
    o Only for fixed screen sequence.
    • BAPI
    • IDOC
    o Settings and preparations needed for each project
    Preparations for IDOC inbound processing:
    • Choose settings -> IDOC inbound processing in LSMW
    • Set up File port for file transfer, create port using WE21.
    • Additionally set up RFC port for submitting data packages directly to function module IDoc_Inbound_Asynchronous, without creating a file during data conversion.
    • Setup partner type (SAP recommended ‘US’) using WE44.
    • Maintain partner number using WE20.
    • Activate IDOC inbound processing.
    • Verify workflow customizing.
    Steps in creating LSMW Project:
    1) Maintain attributes – choose the import method.
    2)Maintain source structure/s with or without hierarchical relations. (Header, Detail)
    3) Maintain source fields for the source structures. Possible field types – C,N,X, date, amount and packed filed with decimal places.
    • Fields can be maintained individually or in table form or copy from other sources using upload from a text file
    4) Maintain relationship between source and target structures.
    5) Maintain Field mapping and conversion rules
    • For each Target field the following information is displayed:
    o Field description
    o Assigned source fields (if any)
    o Rule type (fixed value, translation etc.)
    o Coding.
    o Some fields are preset by the system & are marked with Default setting.
    6) Maintain Fixed values, translations, user defined routines – Here reusable rules can be processed like assigning fixed values, translation definition etc.
    6) Specify Files
    o Legacy data location on PC / application server
    o File for read data ( extension .lsm.read)
    o File for converted data (extension .lsm.conv)
    7) Assign Files – to defined source structures
    8) Read data – Can process all the data or part of data by specifying from / to transaction numbers.
    9) Display read data – To verify the input data being read
    10) Convert Data – Data conversion happens here, if data conversion program is not up to date, it gets regenerated automatically.
    11) Display converted data – To verify the converted data
    Import Data – Based on the object type selected
    • Standard Batch input or Recording
    o Generate Batch input session
    o Run Batch input session
    • Standard Direct input session
    o Direct input program or direct input transaction is called
    BAPI / IDOC Technique:
    • IDOC creation
    o Information packages from the converted data are stored on R/3 Database.
    o system assigns a number to every IDOC.
    o The file of converted data is deleted.
    • IDOC processing
    o IDOCS created are posted to the corresponding application program.
    o Application program checks data and posts in the application database.
    Finally Transport LSMW Projects:
    • R/3 Transport system
    o Extras ->Create change request
    o Change request can be exported/imported using CTS
    • Export Project
    o Select / Deselect part / entire project & export to another R/3 system
    • Import Project
    o Exported mapping / rules can be imported through PC file
    o Existing Project data gets overwritten
    o Prevent overwriting by using
    ‘Import under different name
    for more information follow this link.
    http://help.sap.com/saphelp_nw04s/helpdata/en/87/f3ae74e68111d1b3ff006094b944c8/content.htm

  • Convertion from Decimal to Hexadecimal

    Hi,
    Can you please tell me the way to covert a given decimal number into hexadecimal (for example 4 -> 04, 20 -> 14 etc) and also the vice versa.
    thank you.

    Hi
    Try this function module:
    " CRM_EI_KB_CONV_DEC_TO_HEX "
    This fm converts any decimal to hexadecimal, but not vice-versa.........
    Hope it helps....

  • Do anyone know how to convert a decimal to binary, 1 into 01

    do anyone know how to convert a decimal to binary
    i wants to convert 1 into 01, but the computer print out 1, it didn't print 0
    also 0 it also print only 0, and 3 it print11
    so decimal of 3, the computer print correct, but 0 and 1 it print wrong
    how can i print 01 if my decimal is 1
    int a=1;
    System.out.print(Integer.toBinaryString(a));
    can anyone help me solve this question
    and
    you can use java or jsp
    if you can use jsp it would be better, if not use java

    it's not printing anything 'wrong'.
    0 in binary is 0
    1 in binary is 1
    All it's doing is cutting off leading zeros since they don't change the value.
    1 is the same as 01 is the same as 00000001...no difference
    Similarly, when you print decimal 3 as 11, it could just as easily say 00000011 and be correct, since the zeros don't change anything.

Maybe you are looking for

  • Batch job

    Hi I am working on batch job . my program is printing invoice as well as downloading and I have run this program in batch, I am using the FM job_open , job_submit and job_close. but it is failing in job_submit with sy-subrc eq 1 . giving me error bad

  • Unable to call from my office desk

    Hi Team, I have got India Unlimited Subscription. I have registered 4 numbers out of 5 and on of its my office desk phone. Am unable to use/dial the "skype to go numbers" from that Cisco (Office desk) phone. Pls advice in this regard

  • Query for SO and INV Tracking

    Hi guys. I have another problem now. I was asked to help to create a query that can track SO and INV independently (which means the absence of INV will not affect the presence of SO on the query). I have tried to code it out and it seems that it work

  • Jawin mshtml read  a html page  using the MS IE

    is there some place I can find jawin codes to handle MSHTML.dll i'm new to jawin and seem to see a big library that is relatively empty

  • External CSS file?

    Do I have to write a CSS rule for every symbol and element in a presentation or can I just specify a general rule for the whole thing? For example, how can I specify that all images should have a red border, or all links should change color on hover?