2014 Aug 15 12:16 PM
Hi all,
ı wanna convert char to ascii code. But it returns 41 not 65 for 'A' . Please help !!
CALL FUNCTION 'URL_ASCII_CODE_GET'
EXPORTING
trans_char = 'A'
IMPORTING
CHAR_CODE = ascii
.
2014 Aug 15 1:05 PM
Hi,
the parameter ascii is the hex-code as string:
It returns "41" which means 4 * 16^1 + 1 * 16^0 = 65
If you want an OO-approach für converting to other codepages, you can use class CL_ABAP_CONV_OUT_CE or CL_ABAP_CONV_IN_CE (there are some examples in the documentation).
Regards,
Ulrich
2014 Aug 15 1:15 PM
Hi Gulsah,
The hexadecimal for 'A' is 41.
65 is the hexa for 'e'.
Try debuging the code and you can check it out yourself.
DATA: char_code(2) TYPE c.
FIELD-SYMBOLS: <test> TYPE x.
ASSIGN 'A' TO <test> CASTING.
WRITE <test> TO char_code.
WRITE char_code.
Cheers!