09-17-2008 1:42 PM
Hi...
I have one char string, If that string contains any space then I want to display a message.
how to check that string contains 'space'.
Regards,
Rohit
09-17-2008 1:47 PM
09-17-2008 1:49 PM
09-17-2008 1:52 PM
data str type string.
str = 'test test'.
if str ca ''.
write 'blank is there'.
else.
write 'No blank'.
endif.
it will work...
Regards
Muthu
09-17-2008 1:48 PM
Hi, you can do a small work.
you can split the char string into substrings at spaces.
if there is space then it will be splitted and then you can check the sy-subrc.
if sy-subrc = 0,
then the char string had some space in it.
regards
jayati
09-17-2008 1:55 PM
Hi ,
You can use condense also on that string and sy-subrc will be set to 0 if any space is there.
now check sy-subrc to know if any space is there or not.
let me know if this is helpful?
09-17-2008 1:57 PM
Hi
Do like this.
DATA: gv_str TYPE STRING VALUE 'HELLO THERE'.
IF gv_str CA SPACE.
MESSAGE 'ERROR' TYPE 'I'.
ENDIF.
09-17-2008 1:58 PM
hi,
try to do like this
data: str type string.
define same way str1 and str2.
split string at space into str1 str2.
if sy-surc = 0.
string contains space.
else.
process ur string for ur desired operation.
endif.
09-17-2008 2:09 PM
Hi,
First of all try to SHIFT the string. Suppose your variable is named VAR:
SHIFT var LEFT DELETING LEADING SPACE.
IF var CA ' '.
WRITE:/ 'FIND SPACE'.
ENDIF.
Good luck and kind regards,
MMP.