2008 Apr 22 4:01 PM
Hi all,
Scenario: I want to loop through an xstring and get each byte.
I want to then convert each byte into a character and equivalent ascii value.
eg. for the string 'Dylan'
I want to get a hex byte representing 'D' or the ascii value 68, and so on.
Any ideas?
Thanks,
Dylan.
2008 Apr 23 9:41 AM
For coverting each character into ASCII
Use FM
URL_ASCII_CODE_GET
Do something like this...
n = STRLEN( text ).
i = 0.
do n times
call function URL_ASCII_CODE_GET
trans_char = text+i(1).
i = i + 1.
Perform ur logic with Char_code.
enddo.
For whole string (including SPACE) to be converted into ASCII use below FMs
NLS_STRING_CONVERT_FROM_SYS
SCMS_STRING_TO_XSTRING
Also have look on below link
http://www.sap-img.com/abap/how-can-i-get-ascii-value-of-any-letter.htm
Hope it will solve ur problem
Thanks & Regards
ilesh 24x7
2008 Apr 22 4:16 PM
Hi Dylan Scott-Dawkins ,
Use this function module RSS_UNIQUE_CONVERT_TO_HEX..
Hope this helps.
Thanks,
Greetson
2008 Apr 22 4:19 PM
2008 Apr 23 6:57 AM
2008 Apr 23 9:41 AM
For coverting each character into ASCII
Use FM
URL_ASCII_CODE_GET
Do something like this...
n = STRLEN( text ).
i = 0.
do n times
call function URL_ASCII_CODE_GET
trans_char = text+i(1).
i = i + 1.
Perform ur logic with Char_code.
enddo.
For whole string (including SPACE) to be converted into ASCII use below FMs
NLS_STRING_CONVERT_FROM_SYS
SCMS_STRING_TO_XSTRING
Also have look on below link
http://www.sap-img.com/abap/how-can-i-get-ascii-value-of-any-letter.htm
Hope it will solve ur problem
Thanks & Regards
ilesh 24x7