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

Find char in text string by hex value

mikeb
Contributor
0 Likes
2,879

Hi,

I want to check if text string contains some specific hexadecimal code.

The built-in ABAP FIND() function allows to use only plain text type (C, N etc.) variables as search parameter, but I want to use hex type variable (type X).

Is there any string search function that can receive as search parameter the variable of type X (hex type)?

Thanks.

1 ACCEPTED SOLUTION
Read only

alex_campbell
Contributor
0 Likes
1,737

You should be able to use the 'IN BYTE MODE' addition. For example:

FIND hex2 IN hex1 IN BYTE MODE.

This is in the documentation for the FIND keyword, as well as a number of ther string manipulation keywords. Use F1 help for details.

3 REPLIES 3
Read only

alex_campbell
Contributor
0 Likes
1,738

You should be able to use the 'IN BYTE MODE' addition. For example:

FIND hex2 IN hex1 IN BYTE MODE.

This is in the documentation for the FIND keyword, as well as a number of ther string manipulation keywords. Use F1 help for details.

Read only

0 Likes
1,737

Do I understand right, that «hex2» may be type of string and if I use keyword «IN BYTE MODE», then FIND() will still search by hex code value and not by plain text?

And one more general question, what service do you use to paste a code here in forum? http://pastebin.com or something else?

Read only

0 Likes
1,737

If you use IN BYTE MODE, both fields must be byte-type (as opposed to charactor-type) fields. This means that both hex1 and hex2 must be type x or type xstring. I don't know of a way to find a byte stored as hex in a character string. But I imagine it shouldn't be too hard to convert the character string to a hex string. This sounds like the kind of topic that would have many of posts on these forums.

(to format your code as code: go to the advanced editor. Paste your code and select it. Click the '>>' Insert button. Select Syntax Highlighting->Plain).