Application Development 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: 

Hexadecimal to char

Former Member
0 Kudos

Hi All,

I am facing a problem of converting a field of type x to type c.

data : a(20) type x value'D14E' . this needs to be conveerted to char.

Please reply..

Regards

2 REPLIES 2

Former Member
0 Kudos

Hi Aman,

u can use the FM scms_bin_to_text to covert the Hexadecimal to char.

Hope this will be helpful to u.

Regards

Karan Arya

umashankar_sahu
Active Participant
0 Kudos

hi

if you are using byte processing data type (x or Xstring) just check in which context in program it used

and if you want to convet the data object to (C, N , D , T or String) type data type then

use

DATA : a(2) TYPE X value 'D14E'.

DATA : b(4) TYPE c.

b = a.

WRITE : / a,

/ b.

this will give the same output in a and b like D14E

but if specify in value in alphabet apart from A,B,C,D or E it will not give the output because of hexadecimal proceesing.

and if you want "D14E' corresponding value in char (means binary to char representaion then use)

DATA : a(2) TYPE X value 'D14E'.

DATA : b(4) TYPE c.

CALL FUNCTION 'SCMS_BIN_TO_TEXT'

EXPORTING

bin_line = a

IMPORTING

TEXT_LINE = b

EXCEPTIONS

FAILED = 1

OTHERS = 2

.

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 : / a,

/ b.

it will give you output a D14E and b corresponding character representation ÑN

hope this will help you