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 20 - how to replace?

Former Member
0 Likes
791

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

3 REPLIES 3
Read only

arjun_thakur
Active Contributor
0 Likes
561
Read only

Former Member
0 Likes
561

Hi,

data : hex_value type x.

data : char_value type c.

char_value = hex_value.

now char_value contain equivalent value of hex_value.

Regards,

Rohit

Read only

Former Member
0 Likes
561

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