‎2005 Jul 05 8:11 AM
Dear Friends,
Please help me to resolve the below issue.
Let us assume the following
DATA: source TYPE string,
source = 'This is a /entlittle /ent* sentence.'.
I just wanted to find /ent* in the above string
The function "search" is used for the purpose.
But the problem here is, "the * in the above string is
considered as a wildcard character & not a character".
So the result of sy-subrc after search is 4.
Could anyone resolve this issue.
Regards,
Usha
‎2005 Jul 05 9:33 AM
You can try this
DATA : source(50).
source = 'This is a /entlittle /ent* sentence.'.
IF source CS '/ent*'.
WRITE: sy-fdpos.
ENDIF.
sy-fdpos = sy-fdpos + 1.
WRITE:/ source+sy-fdpos(4).
Regards,
Prabhu Rajesh.
‎2005 Jul 05 8:20 AM
Hi,
If that is the case,then try this.
DATA: source TYPE string,
s_one type string,
s_two type string.
source = 'This is a /entlittle /ent* sentence.'.
SPLIT source AT '/ent*' INTO s_ONE s_TWO.
if sy-subrc eq 0.
Here you can understand that the string is containing '/ent' without using search
write s_two.
endif.
‎2005 Jul 05 8:25 AM
hi usha,
try that:
IF source CS '/ent*'.
found = 'X'.
ENDIF.regards Andreas
‎2005 Jul 05 8:33 AM
Don't forget the SY-FDPOS to know the offset when the CS had result.
‎2005 Jul 05 8:27 AM
Jayanthi,
I am using the position of search string in the other part of the code, so split doesn't help in this case.
Regards,
Usha
‎2005 Jul 05 8:31 AM
Hi Usha,
If you need the position, you can use the solution provided by Jayanthi and then something like this :
w_position = strlen( s_ONE ).
Hope this helps,
erwan.
‎2005 Jul 05 9:02 AM
Hi,
As Erwan told you can use strlen .
DATA: source TYPE string,
s_one type string,
s_two type string,
n type i.
source = 'This is a /entlittle /ent* sentence.'.
SPLIT source AT '/ent*' INTO s_ONE s_TWO.
if sy-subrc eq 0.
<b>n = strlen( s_one ).
write n.</b>
endif.
If it doesn't suit your requirement,tell the exact thing you want to achieve from search.
Give your coding part also.
‎2005 Jul 05 9:33 AM
You can try this
DATA : source(50).
source = 'This is a /entlittle /ent* sentence.'.
IF source CS '/ent*'.
WRITE: sy-fdpos.
ENDIF.
sy-fdpos = sy-fdpos + 1.
WRITE:/ source+sy-fdpos(4).
Regards,
Prabhu Rajesh.
‎2005 Jul 05 9:47 AM
Prabhu / Andreas,
Thanks. The problem is resolved.
Regards,
Usha