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

Convert Hex to Char Problem

Former Member
0 Likes
1,643

Hi Everybody,

i user the FM 'STPU1_HEX_TO_CHAR'.

When i have the input for example 1B is the output = #. But it must be something like u2190.

What do i wrong?

I Hope anybody can help me.

Regards,

Markus

9 REPLIES 9
Read only

former_member998879
Participant
0 Likes
1,103

Hi Markus,

try this:



data:    hex_numb type X,
            string_numb type char100  "or string.

hex_numb = '1B'.

move hex_numb to string_numb.

or try to use FM 'CONVERSION_EXIT_ALPHA_INPUT'.

Regards

Davide

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,103

Hi

Check the Function Modile : AIN_EPC_HEX_TO_CHAR

Regards,

Sreeram

Read only

MarcinPciak
Active Contributor
0 Likes
1,103

Hi,

This is because '1B' is a special character ( escape ). When you do conversion it is stored as char (internally sequence of bits is equal to that char) but it can't be output on the screen.

You can use such special character i.e. when you concatenate data to string including this char (i.e new line, tab mark, carret return etc). Then when you download these data (string) it will "do its work" in local file (i.e. will set newline, tab mark etc in particular place).

Regards

Marcin

Read only

0 Likes
1,103

Hi,

1B must be this u2190.

Have you an example coding?

The first two ideas doesn´t work.

Regards,

Markus

Read only

Former Member
0 Likes
1,103

Hi,

check this [;

hope u'll get some idea.

Read only

0 Likes
1,103

Thanks,

but this is not what i need. my # is not a return it is in this case a u2190.

Have anyone another idea to solve this problem.

Regards,

Markus

Read only

0 Likes
1,103

Markus,

You will not see char u2190 netiher in debugger, nor in the screen output. All special characters (including this one) will be shown as # . This is so called a replacement which system inserts when character can't be displayed. As I said above, these characters are not to be displayed . You use special characters only for special purpose i.e. placing newline, separating columns in file etc.

You will always get this #, but value really stored behind variable has correct byte format, so when you write this character to a file , then it will be applied (its purpose, not character represantion!)

Regards

Marcin

Read only

0 Likes
1,103

Thanks,

but this is not what i need. my # is not a return it is in this case a u2190.

Have anyone another idea to solve this problem.

Regards,

Markus

Read only

Former Member
0 Likes
1,103

Hi,



You can use attributes of class cl_abap_char_utilities like,


data: v_horz_tab(1) type c,
v_cr(1) type c.

for Horizontal tab : use v_horz_tab = cl_abap_char_utilities->horizontal_tab.
for Carriage Return : use v_cr = cl_abap_char_utilities->cr_lf..

Below are the other options also to be used,

BYTE_ORDER_MARK_LITTLE
BYTE_ORDER_MARK_BIG
BYTE_ORDER_MARK_UTF8
CHARSIZE
ENDIAN
MINCHAR
MAXCHAR
HORIZONTAL_TAB
VERTICAL_TAB
NEWLINE
CR_LF
FORM_FEED
BACKSPACE
SPACE_STR
SPACE_STR_LANGU


Hope it helps

Regards

Mansi