Unicode Hex to Char

Hi there,
I have an hex variable that I want to move to a Char variable.
DATA: x_var(255) type X,
      c_var(255).
MOVE x_var to c_var.
I normally used the command MOVE, but my application needs to be unicode compliant and I receive a warning saying that those "variables are not mutually convertible in a Unicode program".
I have tried the STPU1_HEX_TO_CHAR but it expects a C type variable as input so it does not work
Actually, my c_var variable is the header of a table I have declared as RAW, in case it may give some additional hints
Thanks for your support

Hi,
It depends on how you use the type X variable in your Program.
The FM mentioned by RAVI are perfect.
But before using them you need to take two variables of type STRING and XSTRING and proceed because the specifed FM do not accept field types of X and C as parameters.
Example: DATA: x_var1 type xstring,
                         c_var1 type string.
x_var1 = x_var.
call function module pass x_var1 and store result in c_var1.
c_var = c_var1.
Thanks.
Hope this helps you.

Similar Messages

  • HEX to CHAR conversion in ECC 6.0

    Hi All,
    We have upgraded the client system from 4.6C to ECC 6.0. In one of the program the code was as below:
    c_code1(1) TYPE x VALUE '23',
    c_code2(1) TYPE x VALUE 'E1'.
    i_uml-uml = c_code1.
      APPEND i_uml.
      i_uml-uml = c_code2.
      APPEND i_uml.
    LOOP AT i_uml INTO w_char.
        SEARCH  i_rab_tab FOR w_char.
        IF sy-subrc = 0.                         
          MOVE 'X' TO w_found.
          EXIT.
        ENDIF.
      ENDLOOP.
    Here c_code1 and c_code2 are declared as hex and assigned 23 and E1. These codes are moved to itab i_umi. These valuse are assigned to w_char.
    When assigned to w_char, the hex value of 23 is converted to '#' and E1 is converted to 'ä'.
    Above logic is working in 4.6 but not working in ECC 6.0. The conversion of HEX to char is not working in 6.0. In ECC 6.0, when hex number 23 is assigned to w_char, it takes value as '2'.
    Please suggest me how can I make it work in ECC.
    Thanks in advance.
    regards,
    Gaurav

    Hi,
         Try with the below Z report by Changing the values for VALUE in  the below report and execute it you can get the hexadecimal conversion,
    data :  i1 type xstring,
            i2 type string,
            i3 type x.
    parameters: value like i3.
    i1 = value.
    CALL FUNCTION 'NLS_STRING_CONVERT_TO_SYS'
      EXPORTING
        lang_used                   = sy-langu
        source                      = i1
      FROM_FE                     = 'MS '
    IMPORTING
       RESULT                      = i2
      SUBSTED                     =
    EXCEPTIONS
       ILLEGAL_SYST_CODEPAGE       = 1
       NO_FE_CODEPAGE_FOUND        = 2
       COULD_NOT_CONVERT           = 3
       OTHERS                      = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write: i2.
    Thank U,
    Jay....

  • Unicode Hex Keyboard

    I have purchased an iPhone app that requires a 'Unicode Hex Keyboard' on my iMac. I have a 'Unicode Keyboard' in the 'International' preferance pane but there is no 'Unicode Hex Keyboard'. The supplier of the app advises that I must install this hex keyboard. My installation CD informs me that all keyboards are loaded at install time however.
    How might I go about installIng this keyboard?
    Thanks in advance for your help.

    I have a 'Unicode Keyboard' in the 'International' preferance pane but there is no 'Unicode Hex Keyboard'.
    That must be the right one. It's really not possible for this to be missing from system prefs/international/input menu. The icon has a little U+ on it I think.
    It is certainly most unusual for anything to require it. Do they tell you what you are supposed to do with it?

  • Setting Unicode Hex Input as default

    Hey. I know most of the unicode character codes I use a lot by heart, such as U+2325 (⌥) and U+2318 (⌘). However, It's a pain to click on the input menu, and switch the input method to Unicode Hex Input overtime I open an application. Or worse, forgetting to, then ending up typing some bull like '™£¡•' instead of what I intended. How can I make my SYSTEM-WIDE 'default' or basic input method STAY at Unicode Hex Input? Or for that matter, anything other than U.S. Extended.

    It seems to have suddenly fixed itself, after wondering about this for years, after that post. I'm starting to wonder if my Mac reads Apple Discussions...

  • Conver from hex to char

    hi guys,
               i am trying  to convert an hex to an char using the folloing code but its giving me short dumb with the message "When converting the base entry of the field symbol "<FS>" (number in base table: 13), it was found that the target type requests a memory
    alignment of 2."
               but the same code is working in some other system i am suing BI 7.0 can anyone tell me what is the reason....
    data : v_hex(4) type x,
           v_char(10) type c value 'ABCDA0A0',
           V_CHAR(10) TYPE C VALUE 'A0A0A0A0'.
    v_hex = 'A0A0A0A0'.
    FIELD-SYMBOLS <FS> TYPE ANY.
    v_hex = '20202020'.
    ASSIGN V_HEX TO <FS> CASTING TYPE C.
    CONCATENATE <FS> V_CHAR INTO V_CHAR.
    pls reply me
    ravi

    Hello Ravi,
    Check the below program:
    data : v_hex(4) type x,
    v_char(10) type c value 'ABCDA0A0',
    V_CHAR1 TYPE string.
    v_hex = 'A0A0A0A0'.
    FIELD-SYMBOLS <FS> TYPE ANY.
    v_hex = '20202020'.
    ASSIGN V_HEX TO <FS> ."CASTING TYPE C.
    move <FS> to v_char1.
    CONCATENATE v_char1 V_CHAR INTO V_CHAR.
    write:/ v_char.
    In Unicode env ,do not use casting after assign statement
    I don't have idea about your functionality.
    Check the below program :
    field-symbols <fs> type any .
    data : w_hex(1) type x value 31.
    assign w_hex to <fs> ."casting.
    write <fs>.
    hex value is 31 ,when you convert into ASCII character then it becomes 1F.
    Thanks
    Seshu

  • Convert UTF-8 (Unicode) Hex to Hex Byte Sequence while reading file

    Hi all,
    When java reads a utf-8 character, it does so in hex e.g \x12AB format. How can we read the utf-8 chaacter as a corresponding byte stream (e.g \x0905 is hex for some hindi character (an Indic language) and it's corresponding byte sequence is \xE0\x45\x96).
    can the method to read UTF-8 character byte sequence be used to read any other (other than Utf 8, say some proprietary font) character set's byte sequence?

    First, there's no such thing as a "UTF-8 character". UTF-8 is a character encoding that can be used to encode any character in the Unicode database.
    If you want to read the raw bytes, use an InputStream. If you want to read text that's encoded as UTF-8, wrap the InputStream in an InputStreamReader and specify UTF-8 as the encoding. If the text is in some other encoding, specify that instead of UTF-8 when you construct the InputStreamReader. import java.io.*;
    public class Test
      // DEVANAGARI LETTER A (&#x0905;) in UTF-8 encoding (U+0905)
      static final byte[] source = { (byte)0xE0, (byte)0xA4, (byte)0x85 };
      public static void main(String[] args) throws Exception
        // print raw bytes
        InputStream is = new ByteArrayInputStream(source);
        int read = -1;
        while ((read = is.read()) != -1)
          System.out.printf("0x%02X ", read);
        System.out.println();
        is.reset();
        // print character as Unicode escape
        Reader r = new InputStreamReader(is, "UTF-8");
        while ((read = r.read()) != -1)
          System.out.printf("\\u%04X ", read);
        System.out.println();
        r.close();
    } Does that answer your question?

  • Unicode: HEX 20 - how to replace?

    Hi there,
    in an old coding I found the variable that contains a value of type X. The value is '20'. Now I have to converto to unicode and I have to use a CHAR-like variable.
    How can I change the coding so that I have the same value like Hex20 in the string/char?
    Thanks a lot.
    Kind regards
    Markus

    Take V_HEX = '20' in the below code for u r requirement
    REPORT  ZSRK_064 MESSAGE-ID ZMSG.
    DATA: V_HEX(1) TYPE X,
    V_CHAR(1) TYPE C.
    V_HEX = '41'. "Hex41 = Ascii 65 ie, 4*16+1 = 65
    PERFORM HEX_TO_CHAR_CONV USING V_HEX
    CHANGING V_CHAR.
    WRITE : / V_CHAR.
    *& Form CHAR_TO_HEX_CONV
    text
    -->P_V_CHAR text
    <--P_V_HEX text
    FORM HEX_TO_CHAR_CONV USING CH TYPE X
    CHANGING CH1 TYPE C.
      FIELD-SYMBOLS : <FS_TR> TYPE X,
                      <FS_TR1> TYPE C.
      ASSIGN CH TO <FS_TR>.
      ASSIGN <FS_TR> TO <FS_TR1> CASTING.
      CH1 = <FS_TR1>.
    ENDFORM. " HEX_TO_CHAR_CONV

  • Hexa to char conversion

    Hi Experts,
    I am trying to convert hexa decimal value 1D to char value GS. I tried using the FMs <b>NLS_STRING_CONVERT_TO_SYS</b> and <b>stpu1_hex_to_char</b> but I did not get GS as output instead it was ##.Please suggest me the solution for this.
    Points will be rewarded.
    Thanks,
    Nagesh

    Hi Nagesh,
    You can use the following code to get the char value of the hex value.
    TRY.
    CALL METHOD CL_ABAP_CODEPAGE=>CONVERT_FROM
      EXPORTING
        SOURCE      = xstr
        CODEPAGE    = `UTF-8`
       ENDIAN      =
       REPLACEMENT = '#'
       IGNORE_CERR = ABAP_FALSE
      RECEIVING
        RESULT      = char
    CATCH CX_PARAMETER_INVALID_RANGE .
    CATCH CX_SY_CODEPAGE_CONVERTER_INIT .
    CATCH CX_SY_CONVERSION_CODEPAGE .
    CATCH CX_PARAMETER_INVALID_TYPE .
    ENDTRY.
    This will work for normal characters. But GS (Group Separator) is a special character, it will return "#" only..
    We were also facing this issue. So we decided to take a decision depending on the Hex value itself.
    If you find any mechanism to solve this problem, do let me know.
    ~ ramanath.

  • Unicode hex input problem

    I have a MBP running Yosemite.  My partner has a MBAir running OSX 10.8.5 (M-Lion?)
    He needs to use some medieval characters in his writing as a grad student in ENglish.
    On both machines, we installed the Unicde Hex Input source and selected it.
    On my machine, I can use the OPTION-KEY + 4-digit-hex-code to produce the characters as desired.
    On his machine, with the OPTION-KEY held down, as you type each digit of the hex code, you get a different character, instead of one character after typing the 4-digit code.
    Any suggestions?
    Thanks,
    Dave

    Thanks, Tom -- I'll check it again as soon as I have access to the MBAir, but I'm pretty sure I checked that the U+ input source was selected.
    Also, regarding character viewer, even on my own machine (where U+ input works fine) I don't see any of the medieval charcaters in the character viewer, no matter which font (?) I pick from the left-hand list.
    For instance, here's a medieval character, produced through the OPTION+ method:  ꝑ (blown up to 18 pts to make it easier to see).  But I can't find it using the character viewer in Latin or character-like symbols. I think I may not understand how to use the character viewer correctly(?)  What is the relationship between the list of symbol-sets (if that's the right word) in the character viewer and the font that's selected in the editor I'm using?
    Thanks again,
    - dave

  • Unicode - Garbled Japanese char on EN logon

    Hi Everyone,
    We recently upgraded our system, from a non-unicode to a unicode system. Whenever i view a SAPscript report using english logon that contains both japanese & english characters in one field, the print preview is ok, displaying correct data in both languages. The problem arises when i try to print the report. All japanese characters are garbled, while all english characters are still ok.
    I tried logging in using japanese language, and printed a japanese report that uses both characters, and everything was ok, in both print preview & hardcopy printout.
    BTW, we're using version 640 for our SAP GUI, with patch level 19. I've also tried OSS numbers 734790, 839959, & 1027088, but they all didn't do the trick.
    Hoping for your inputs. Thanks in advance!

    Hi,
    If your system is unicode enabled, you should use true type fonts in the paragraph format to display the multi language characters. In the japanese language form did you use any special type of font types you use? Normally all the special font types will support english and not all the english fonts will support the local language characters.
    Since the output is printing fine with the Janpanese language there should not be any problem with the printer drivers, otherwise we need to check the drivers also.
    Hope this helps you

  • Unicode hex conversion

    Hello, can anyone please tell me how to achieve the same effect on this website, http://mylanguages.org/converter.php , in pl sql or oracle sql? They have taken an arabic string and returned a (to my knowledge) hex value.
    Many Thanks

    Handle:  igwe   
    Status Level:  Newbie (15) 
    Registered:  Mar 11, 2008 
    Total Posts:  384 
    Total Questions:  148 (83 unresolved)  Do you ask so many difficult questions or don't you mark questions as answerd when they are?
    with inp as
    ( select 'سليم' str from dual
    union all select 'anton' from dual
    select ( select listagg( '&#' || to_number( utl_raw.substr( utl_i18n.string_to_raw( str, 'AL16UTF16' ), level * 2 - 1, 2 ), 'XXXX' ) || ';' ) within group ( order by level )
             from dual
             connect by level <= length( str )
    from inpEdited by: ascheffer on Mar 5, 2013 11:33 PM

  • Unicode related issue

    Hi,
    This is relating to UNICODE HEX to CHAR conversion.
    Here , i need to convert the HEX value to char format.
    'DATA: BEGIN OF HV,
          FILLER(10) TYPE X VALUE 'FFFFFFFFFFFFFFFFFFFF',
          END OF HV.
    I know the value of FILLER(10) TYPE X VALUE 'FFFFFFFFFFFFFFFFFFFF' is  '..........' Means 10 dots.
    But I need the Function module or any statement which translate the 'FFF...' values to 'Dots'.
    Please suggest...
    Thanks,
    Pradeep.

    Hi Pradeep,
    Please check the below link,
    Function Module to convert Hexa to Char
    Best Regards.

  • Decoding HEX  in URIs

    Anyone would like to use/comment on the code below? This method intends to translate the hex based "illegal" characters in an URI into normal fileSys characters (useful in thin client fileSharing server apps). It also helps those who need help translating String into hex & hex into String. I'd appreciate some testing or someone to make it leaner. Nx.
    // URI hex decoder
    public String FixIllegalCharacters(String realRequest){
    int idxOfPcent = 0;
    while((idxOfPcent = realRequest.indexOf("%", idxOfPcent)) != -1){
    realRequest = realRequest.substring(0, idxOfPcent) + new String(new byte[]{(byte) Integer.parseInt(realRequest.substring(idxOfPcent+1, idxOfPcent+3), 16)}) + realRequest.substring(idxOfPcent+3);
    idxOfPcent++;
    return realRequest;
    }

    I have code to do a similar thing, but iteratively until there are no escape sequences left, and watching for attempts to use .. - generally attempted exploits against IIS. Code follows:     /**
         * Process the %nn symbols in the URL, and check for ..
         * @param url The URL requested
         * @return A String representing the same URL, but properly parsed
         * @throws SecurityException if the URL appears to be an attempted exploit
         * @author Peter Taylor
        public static String processURL(String url) throws SecurityException
            char[] characters = url.toCharArray();
            StringBuffer output = new StringBuffer(url.length());
            char[] buffer = new char[10];
            int charsInBuffer = 0;
            boolean readDot = false; // if we read a dot when this is true, throw exception
            for (int i = 0; i < characters.length; i++)
                char ch = characters;
    if (charsInBuffer == 0 &&
    ch != '%' &&
    ch != '.')
    readDot = false;
    output.append(ch);
    else if (ch == '.' && !readDot)
    readDot = true;
    output.append(ch);
    else if (ch == '.' && readDot)
    throw new SecurityException("Attempted to subvert directory hierarchy");
    else if (ch == '%')
    buffer[charsInBuffer++] = ch;
    else // there are characters in the buffer
    buffer[charsInBuffer++] = ch;
    // Check whether this character proves that we don't have a sequence representing a
    // character. If not, check whether it completes such a sequence.
    if (!isHexDigit(ch) &&
    !(charsInBuffer == 1 &&
    (ch == 'u' || ch == 'U')))
    // We don't have a special sequence, so flush the buffer
    for (int j = 0; j < charsInBuffer; j++)
    output.append(buffer[j]);
    charsInBuffer = 0;
    else if ((buffer[1] != 'u' && buffer[1] != 'U') &&
    charsInBuffer == 3)
    // The two last characters represent the special character in ASCII hex
    ch = (char)((getHexValue(buffer[1]) << 4) + getHexValue(buffer[2]));
    // Reinsert into the stream to be processed - a bit hacky
    characters[i--] = ch;
    charsInBuffer = 0;
    else if ((buffer[1] == 'u' || buffer[1] == 'U') &&
    charsInBuffer == 6)
    // The last four characters represent the special character in Unicode hex
    ch = (char)((getHexValue(buffer[2]) << 12) +
    (getHexValue(buffer[3]) << 8) +
    (getHexValue(buffer[4]) << 4) +
    getHexValue(buffer[5]));
    // Reinsert into the stream to be processed - a bit hacky
    characters[i--] = ch;
    charsInBuffer = 0;
    // Flush buffer
    for (int j = 0; j < charsInBuffer; j++)
    output.append(buffer[j]);
    return output.toString();
    * A simple method to check whether a character, interpreted as an ASCII character,
    * is a hexadecimal digit.
    * @author Peter Taylor
    public static boolean isHexDigit(char ch)
    String hexDigits = "0123456789abcdefABCDEF";
    return (hexDigits.indexOf(ch) > -1);
    * A simple method to convert an ASCII character which represents a hexadecimal
    * digit into the value it represents.
    * @return The value represented by this digit, if it represents a hex digit.
    * -1 otherwise.
    * @author Peter Taylor
    public static char getHexValue(char ch)
    int i;
    if (ch >= '0' && ch <= '9')
    i = (ch - '0');
    else if (ch >= 'a' && ch <= 'f')
    i = (ch - 'a' + 10);
    else if (ch >= 'A' && ch <= 'F')
    i = (ch - 'F' + 10);
    else i = -1; // Can't be bothered with an exception
    return (char)i;

  • Unicode, assignment  char to hex

    Hi Experts,
        I have a question related to assignment of char to hex in
    uni-code system.
    Here is piece of code:
    In non-uncode system:
    data:
    begin of struct,
    x1(1) type x,
    end of struct.
    data:
    c1 type c value 'C'.
    struct1 = c1.
    In unicode system
    *struct1 = c1 is not allowed.
    If i assign struct1-x1 = c1, intenally the values value are getting changed that can be seen in debug mode .
    for example: internal value for 'C' is 43,similarlly for 'L' it is 4C.
    so how can i assign this in unicode system with out the values to be changed ...
    please reply
    Sorry iam posting this twice because the first post thread got closed .....
    Regards
    Syed Abdul Adil.

    There are function modules in the system to convert hex values to char values.
    These function modules are:
    NLS_STRING_CONVERT_TO_SYS (hex to char)
    NLS_SRING_CONVERT_FROM_SYS (char to hex)
    If it's the tab character then it can be done with (example):
    data: x1 type char1 value c1_abap_char_utilities=>horizontal_tab.

  • Unicode error, Split Variable at HEX 00 into ITAB

    Hello all,
    We will be changing our system to a Unicode system next year.  As we are modifying existing programs, we are setting the Unicode flag and correcting any errors.  In this one particular program I have run across a situation  for which I have not been able to find a solution.  Any thoughts would be greatly appreciated.
    This error occurs when the following code is checked.
    HEX must be a character-type data object
    data hex type x.    "Binary zeros
    data: begin of i_apqd occurs 0.
            include structure apqd.
    data: end of i_apqd.
    data: begin of itab occurs 0,
            field(150),
          end of itab.
    split i_apqd-vardata+20 at hex into table itab.
    This is what i_apqd-vardata+20 looks like in the debugger.
    ##SAPMF05A0100##BKPF-BLDAT#11072006#BKPF-BLART#KR#BKPF-BUKRS#100#BKPF-budat#11072006
    This program is a custom developed utility program to display the contents of a BDC session.
    Thanks
    Bruce

    try this:
    data hex type x value '00'.                
    field-symbols: <hex> type x,<char> type c. 
    data: begin of i_apqd occurs 0.            
    include structure apqd.                    
    data: end of i_apqd.                       
    data: begin of itab occurs 0,              
    field(150),                                
    end of itab.                               
    assign hex to <hex>.
    assign <hex> to <char> casting.
    split i_apqd-vardata+20 at <char> into table itab.

Maybe you are looking for

  • Trying to Define a New Application Server Connection in JDev 10.1.3.0.3

    I am getting the following error stack when I try to test the connection in JDev 10.1.3.0.3 . The application server is standalone oc4j 10.1.3 DP4. Any help is much appreciated. Thanks, Mustafa Error while getting remote MBeanServer for url: ormi://l

  • Creating SOAP Receiver comm.channel for axis web service

    Hi, I created Soap Receiver comm. channel fro Axis web service like below: *Target URL* : http://<IP>:<Port>/<x>/service *User:* <user> *Password :* <password> *SOAP Action:* <target namespace>/method when i drive PI Message that use Soap Receiver it

  • DB13 jobs failling

    Hi Gurus, DB13 jobs are failling below are the details. Can you please let me know the reason behind job failing. Thanks Sambi DBA:CHECK_DB DBA:ANALYZE_TSP DBA:NEXT_EXTENT Job Log: DBA:CHECK_DB Job started Step 001 started (program RSDBAJOB, variant

  • How do I restore my pictures to iPhoto after my hard drive crashed?

    My 2010 MacBook Pro crashed in Summer of 2012, but I have some Time Machine backups from right before the crash. Once my computer was repaired, I brought it home and did a restore from the TM backup, but my iPhoto pictures didn't come with it. I have

  • Move row up

    hi, I have a small doubt in moving a row. I want the selected row in jTable to be moved one row up., but it is not working out for me,,, the code i have written is: ((DefaultTableModel)jTable1.getModel()).moveRow(jTable1.getSelectedRow(),jTable1.getS