‎2008 Nov 17 7:53 AM
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
‎2008 Nov 17 8:00 AM
‎2008 Nov 17 8:10 AM
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
‎2008 Nov 17 8:19 AM
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