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 to find the ASCII value for an alphabet.

Former Member
0 Kudos
625

How to find the ASCII value for an alphabet.

5 REPLIES 5

former_member223537
Active Contributor
0 Kudos
84

How can I get Ascii value of any letter

How can I get Ascii value of any letter. Is there any function?

This is how you do it :

report demtest.

data : c.

field-symbols : <n> type x.

data : rn type i.

c = 'A'.

assign c to <n> casting.

move <n> to rn.

write rn.

This will convert 'A' to 65.

Tom Demuyt

How to convert ascii value to character.

If I give input as 65 (ascill value) I want display 'A'.

Below logic is for convert from character to ascii value , now I want to know how to convert ascii value to character.

Naveen

report demtest.

*going from A to 65

data : c value 'A'.

field-symbols : <n> type x.

data : rn type i.

assign c to <n> casting.

move <n> to rn.

write rn.

*going from 66 to B

data : i type i value 66.

data : x type x.

field-symbols : <fc> type c.

move i to x.

assign x to <fc> casting type c.

move <fc> to c.

write c.

0 Kudos
84

Hi ,

I have converted from A to 65.

While converting from 66 to B , i am getting an error like ' The length of 'X' in bytes must be a multiple of the size of a unicode character, regardless of the size of the unicode character '

Here is the code that i have written.

In this part i am sending the chr value as A

DATA : chr TYPE c.

FIELD-SYMBOLS : <n> TYPE x.

DATA : rn TYPE i,

v_set2 TYPE i.

v_set2 = STRLEN( p_matwa ) - 2.

chr = p_matwa+v_set2(1).

ASSIGN chr TO <n> CASTING.

MOVE <n> TO rn.

Now i am incrementing rn. ( It has the value as 65 )

rn = rn + 1.

DATA : hx TYPE x.

FIELD-SYMBOLS : <fc> TYPE c.

ASSIGN hx TO <fc> CASTING TYPE c.

MOVE <fc> TO chr.

WRITE chr.

Here i am facing the above mentioned error

Former Member
0 Kudos
84

hi,

Use the function module LIST_TO_ASCII

Former Member
0 Kudos
84

Hi,

go through the following links....

http://www.robelle.com/library/smugbook/ascii.html

***do reward if usefull

vijay

Former Member
0 Kudos
84