Application Development and Automation 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: 
Read only

Xstring help please.

Former Member
0 Likes
797

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
709

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

4 REPLIES 4
Read only

Former Member
0 Likes
709

Hi Dylan Scott-Dawkins ,

Use this function module RSS_UNIQUE_CONVERT_TO_HEX..

Hope this helps.

Thanks,

Greetson

Read only

former_member194669
Active Contributor
0 Likes
709

May be try with fm

NLS_STRING_CONVERT_FROM_SYS

Read only

0 Likes
709

I used this FM in the end SCMS_STRING_TO_XSTRING

thanks.

Read only

Former Member
0 Likes
710

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