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: 

how can we relate c and x types in ABAP

former_member181959
Contributor
0 Kudos
156

hi all,

I would like to know how we could relate c type and x type in ABAP.

In terms of size specification.

Thank you all

prasad.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
76

Hi Prasad,

Consider the following code snippet -

data : char type c,
       hexa type x.

Now, both these variables are of 1 byte each. However, they store different kinds of data, so we have -

hexa = '41'.

write : hexa to char.
write: char , hexa.

hexa is going to store the hexadecimal number 41. (the decimal equivalent is 65). The first write statement does the automatic type conversion. so we get the 65th ASCII character in the character variable (which is the capital A).

Hope that helps.

Regards,

Anand MAndalika.

2 REPLIES 2

Former Member
0 Kudos
77

Hi Prasad,

Consider the following code snippet -

data : char type c,
       hexa type x.

Now, both these variables are of 1 byte each. However, they store different kinds of data, so we have -

hexa = '41'.

write : hexa to char.
write: char , hexa.

hexa is going to store the hexadecimal number 41. (the decimal equivalent is 65). The first write statement does the automatic type conversion. so we get the 65th ASCII character in the character variable (which is the capital A).

Hope that helps.

Regards,

Anand MAndalika.

Former Member
0 Kudos
76

Hi,

For character.

Data:<var> TYPE C,

<var(10) TYPE C.

For Hexa,

Data: <var> TYPE X.

Also go through this function CHAR_HEX_CONVERSION for your understanding for converting character to Hexa.

Regs,

Venkat