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

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

  • How to Change the data type of infoobject from NUMC to CHAR

    Hi Experts,
    I have created an infoobject with data type as NUMC, i used in DSO as a key figure and i have loaded data up to PSA.
    Now i want to change the data type of this Info Object from NUMC to CHAR.
    Can anyone suggest me the solution for this issue.
    Regards,
    Venu Gopal.K

    Hi pavan/binu,
    I have not loaded data into DSO i just added IO in Key fields and i started editing this IO then im facing error like
    1.Master Data Table /BIC/PZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated     
    2.SID Table /BIC/SZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated
    Im also unable to edit the P & S tables in SE14.
    NOTE:I have data only in PSA and when im trying to load data to DSO Im facing these issues.

  • Convert from jchar to char

    Does any one know how to convert from jchar to char?
    Thank you,

    does it have to be a jchar or can you get a jstring? is it possible to convert your jchar into a jstring before you pick it up in jni? if you can get a jstring you can use the function
    const char* GetStringUTFChars(jstring str, jboolean *isCopy)
    you would get back a character pointer that points to a single char plus the null terminator

  • Dw Change table background colour from hex to rgb impossible

    If you want to change the background colour (properties) in a table from HEX to RGB, it is impossible, because the buttons are without function.
    Is this a bug? Or is this intended?

    Don't forget the A for alpha-transparency
    .your_table_rule { background-color: rgba(255,255,195,0.5); }
    Nancy O.

  • NLS_LENGTH_SEMENTICS from BYTE TO CHAR

    Hi,
    For supporting multibyte character, we need to change NLS_LENGTH_SEMENTICS parameter from BYTE to CHAR. But this parameter setting will effect for new database tables created thereafter. To change the storage characteristics for existing database tables we explicitly executed Alter statements for database tables for columns having datatype as “Varchar2” and “Char”.
    Problem:
    ======
    Since the number of database tables in PRODUCTION are very high and contains approx. 600 million of records spread over 400 database tables, we are not in a position to afford the time which will be spent in altering these database tables in PRODUCTION.
    We ran the test by alter script in System Test environment and alteration of database tables covering 150 tables and 200 million of records was carried out in almost 16-20 hrs.
    APPROACHES WE HAVE IN MIND
    ==========================
    1. Alter all the table columns (We tried the same and taking too much time)
    2. Export /Import with NLS_LENGTH_SEMENTICS set as CHAR(We discuss with our DBA about this approach and found that it will also take too much time and there is RISK of data inconsistency)
    3. Drop the index of the table, run alter script for changing storage type BYTE to CHAR , and rebuild the index (this is also taking too much time).
    All above approaches are very costly in terms of time, that we cannot afford.
    If any one having better solution then please suggest.
    thanks in advance
    Syed

    Hi
    We are also facing a similar problem
    We ran alter table scripts and now compiling the objects
    and that is taking lot of time.
    we have around 4000 invalids that by parallel recomp came down to 2000 but still these 2000 which are mostly packages .. are giving a hard time.
    if anyone has faced/found a similar issue/solution pls post. or maildirectly to me.
    Sunil Choudhary

  • Retrieve the character from hex code

    I want to write the hex code / ASCII code of the English alphabets ( A - Z and a - z ) in a file and again want to read those codes (either ASCII or Hex code) from the file to retrieve the characters from them. How it is possible?
    For example, ASCII code of 'A' is 65 and hex code is 41.
    ASCII code of 'z' is 122 and hex code is 7A.
    Avijit

    Forgot that you need to convert them back:
            Character c = new Character('A');
            System.out.println("char : "+c);
            int ascii = (int) c.charValue();
            System.out.println("ascii: "+ascii+" => "+(char) ascii);
            String hex = Integer.toHexString(ascii);
            System.out.println("hex  : "+hex +" => "+(char) Integer.parseInt(hex, 16));

  • How to Write a file from hex format to another format

    hi I am trying to create a file (IBM AFP-printer format) from the hex file which i have created after reading that IBM afp file. Now i have to do some changes in that hex file data and store it back to the same format.
    I have tryed storing it using:
    Writer out = new OutputStreamWriter(outputStream,"Cp1252");
    but it is taking hex format only.
    I have checked encoding of afp file by this code
    File inputFile = new File( "C:\\ACode\\new2.afp" ) ;
              FileInputStream inputStream = new FileInputStream(inputFile );
         InputStreamReader in = new InputStreamReader(inputStream);
    System.out.println(in.getEncoding());
    it is showing Cp1252 only.
    But i am unable to store it back to same format
    Thanks

    I don't really know what the IBM APF stream format is, but I suspect that your approach is not right. If you really want to read and write raw hex bytes, then do not use readers and writers; instead use pure streams. The reason is that readers and writers are designed to deal with character-oriented data, and will automatically perform translations on input and output.
    On the other hand, if you could find the correct encoding/decoding software for the IBM format in question, well then readers/writers would be fine, and you could do all of your "internal" work in unicode.

  • How could I choose some bytes from HEX string and then convert it to a decimal value?

    Hi I am working with an OMRON E5EN temperature controller using VISA serial to get data, I send the Read from Variable Area command and get this string  in hexa 0230 3130 3030 3030 3130 3130 3030 3030 3030 3030 3041 3203 71 or .01000001010000000000A2.q in ASCII this string means:
    02 STX
    3031 3030 Node and subadress
    3030 End Code Normal Completion
    3031 3031 Command Read from Variable Area
    3030 3030 respt code Normal completion
    3030 3030 3030 4132 Hexadecimal A2 = 162  (this is the temperature data that I want to show in decimal)
    03 ETX
    71 Block Check Character
    I want to choose the eight bytes for the temperature data and convert it to a decimal number. I have seen the examples to convert a Hexa string to decimal but I do not know how to choose the specifics bytes that I need.
    I have look for a driver but i didn´t find any. I am a beginner so please include especific topics for me to study in your answer.
    Thanks
    Carlos Fuentes Silva Queretaro Mexico 

    If the response always has the temperature starting with byte 15 and is always 8 bytes in length, you can use the String Subset function to get those bytes out of the string.  Then use Hex String to Number to convert to a decimal number.
    Well someone already beat me to the solution:
    Message Edited by tbob on 01-04-2008 04:42 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    HexStr2Decimal.png ‏7 KB

  • Converting RPAD output from VARCHAR2 to CHAR

    I am trying to create a 1000-character fixed-width file using SQL*Plus. The query consists of 3 fields with a pad of 25 characters each, with the remaining 925 characters as filler using spaces. Using RPAD I can insert spaces between the three field values, but because the RPAD function uses VARCHAR2 to return the result it is not recognizing the ~945 filler spaces I need at the end of each row.
    Is there a way to convert the output of RPAD to a CHAR data type in the query itself? Maybe something equivalent to the CONVERT function in t-SQL?
    Query I'm using:
    Select RPAD(Col1, 25, ' ') || RPAD(Col2, 25, ' ') || RPAD(Col3, 950, ' ') From Table1;
    Thanks,
    Matt

    Hi,
    Welcome to the forum!
    You can ihave trailing spaces (950 of them if you want, no problem) in a VARCHAR2 column. I suspect your font-end tool is not displaying them.
    The SQL*Plus commands
    SET  TRIM        OFF
    SET  TRIMSPOOOL  OFFshould guarantee that trailing spaces are displayed in screen- and SPOOL file output, respectively.
    Also, make sure your lines are long enough:
    SET  LINESIZE    1000If you still have a problem, post a complete test script (including all the SQL*PLus formatting commands you use) as well as a query. (Something using dual or scottt.dept should illustrate the problem adequately).

  • Converting a SQL Command Parameter from Date to Char

    Hi,
    I'm using CR XI version 11.0.0.1282.  I've created a report using a SQL Command and have a parameter defined as Date.  I need to convert this Date parameter to a CHAR and have created my WHERE clause as:
    WHERE  "CC_PAYH"."PPOST"= CHAR ('{?From Date}') AND
    "CC_PAYH"."PPTYPE"<>13
    I get a message saying 2008 is not a valid token which in AS400 means it doesn't like the year.  Go figure. 
    I've tried running a similar query in AS400 and I get the desired affect.  I've tried removing the parameter from the Where clause and putting it into the Select like:
    CHAR ('{?From Date}') as MyTestDate
    just to see the representation I would get and I get the same error. 
    The question I have like everyone else is; is this possible with this version of Crystal?  I assume so since the same query will work in the database itself. 
    Thanks,
    Brian

    Hi Brain,
        Can you please try the query similar to the following syntax and verify whether it helps you!
    Select * from Orders where ([Order Date]) =
    CStr({?Date})
    Regards,
    Vinay

  • Convert from int to char

    Hi,
    How can I convert from an int to char?

    The challange is to convert from int to String without using any API or automatic conversionWoah, what a challenge ! Why ?
    Anyway, what about a recursive call and switch statement. Something likepublic String intToString(int n) {
        if(n<0) {
            return "-"+intToString(-n);
        if(n<10) {
            return getStringDigit(n);
        else {
            return intToString(n/10) + getStringDigit(n%10);
    private String getStringDigit(int n) {
        switch(n) {
            case 0:
                return "0";
            // etc.
    }

  • Two Doubt abt Area Menu and Conv from C to I

    Hello Guys,
    I have two doubt can some one help me on the same.
    1. I have created one area menu , added all T code in that and it is successfully move to prod. server. problem I am facing is that when user click on the t code
    it give message <b>Transaction does not exist.</b>. Although T code available and user have right to access the same.
    2. I have created one ALV in which I have shown AUSP-ATWRT value, which of type character but in our case we have numeric value over there. I am taking that value . But when End user want to take the Graph from ALV it's show nothing. Because value is character. Now I have change the type of Internal table variable as I. But it creating problem and giving Dump.
    Please provide me valuable suggestion.
    Regards
    Swati..

    Hi,
    Field mentioned by you is char type in DD so it will not be displaye as number in graph.
    So you can convert that field using function like CK_AND_CONVERT_NUMERICS to numeric.
    Hope this will help you.
    Reward all help ful answers.
    Jogdand M B

  • Change NLS_LENGTH_SEMANTICS from BYTE to CHAR on Oracle 9i2 problem!

    Hi,
    I have created a new database on Oracle 9i 2, I did not find the correct pfile parameter for the NLS_LENGTH_SEMANTICS setting.
    So have created a standart UTF8 database and now I am trying to change the standard NLS_LENGTH_SEMANTICS=BYTE to CHAR. When I execute the following command in SQL PLUS "ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR SCOPE=BOTH"
    The system is tells me that command is successfully executed.
    But when I look at the NLS_DATABASE_PARAMETERS table I do not see any change for the NLS_LENGTH_SEMANTICS parameter.
    I have also restarted the instance but still everything is the same as it was before.
    Do you know what I am doing wrong?
    Regards
    RobH

    Hi,
    Yeah you are right, the nls_session_parameters "NLS_LENGTH_SEMANTICS" for the app user is set to CHAR.
    This means that NLS_DATABASE_PARAMETERS is from the SYS or SYSTEM user view?
    Thanks a lot
    Regards
    RobH

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

Maybe you are looking for

  • New Macbook Air won't wake properly.

    My brand new MBA 13 frequently does not wake up.  I have to hold the button down long enough to allow it to shut down and then push it again to restart it.  This seems to happen most predictably when I try to wake it after being plugged in all night.

  • CreateSchemaBasedXML using multiple schemas

    I am trying to perform XSD validation against an XML document within PLSQL and I'm having an issue with getting it working.  I have created an XMLTYPE object, which when I call isSchemaBased() against it returns 0 (false). Now obviously the XMLTYPE n

  • Application Error   General Exception

    Everytime I leave a pogo game it say Application Error General Exception Jave.lang.Null Pointer Exception: null pData. How do I fix this?

  • Cannot open HFM application via Workspace

    Hi At times users cannot open HFM application via WorkSpace.When they open an application they can see the progress bar and the application does not come back(HUNG). Looking into the logs at the time of incidents we find the following from the logs A

  • How can i Make sys's java classes valid?

    I use Oracle 8.1.8. All the java classes in sys are invalid. How can I make it valid? thanks!