Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unicode Hex to Char

Former Member
0 Likes
2,270

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
908

Use the fms:

NLS_STRING_CONVERT_TO_SYS( Hex to char)

and NLS_STRING_CONVERT_FROM_SYS (char to hex)

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

5 REPLIES 5
Read only

Former Member
0 Likes
908

hi,

Check these threads out

Read only

Former Member
0 Likes
909

Use the fms:

NLS_STRING_CONVERT_TO_SYS( Hex to char)

and NLS_STRING_CONVERT_FROM_SYS (char to hex)

Read only

0 Likes
908

Thanks for that incredibly quick answer.

That is the function I was looking for

Read only

0 Likes
908

Hello,

the convertion is ok. But i have a problem.

There is after every converted place a '-symbol:

from:

003100300030004C0041004E004700480020002000200020002000200020000000000032007100350030007800300030005F005100350030005F003000300020

to:

#1#0#0#L#A#N#G#H# # # # # # # ####2#q#5#0#x#0#0#_#Q#5#0#_#0#0#

Is there any possibility, that the string '00' ca be deleted or that '0031' will be declared as a string? not only two places?

Thanx a lot

Read only

Former Member
0 Likes
908

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.