2008 Sep 01 9:56 AM
Is there a standard function to find alphabet in string?
For example, a variable define as char (10),
I need a function to find out if this variable contains alphabet.
Any standard function there?
2008 Sep 01 9:58 AM
hi,
you don't need a function:
IF char CA sy-abcde.
==> it contains at least one letter
ELSE.
==> it does not contain any letter
ENDIF.
hope this helps
ec
2008 Sep 01 10:00 AM
use-
DATA str(10).
if str CA sy-abcde.
"--> contains alphabet
else.
"--> does not contain alphabet
endif.
Regards,
Aparna Gaikwad
2008 Sep 01 10:04 AM
2008 Sep 01 10:04 AM
2008 Sep 01 10:02 AM
hiii
try using FM
DX_SEARCH_STRING
you can use logic like
len = strlen( wa_str ).
do.
if ofset = len.
exit.
endif.
if wa_string+ofset(1) co sy-abcde .
concatenate wa_string+ofset(1) into wa_final.
regards
twinkal
2008 Sep 01 10:09 AM
Hi Lin,
Try the following:
parameters: p_char type c.
search sy-abcde for p_char.
if sy-subrc eq 0.
write: 'Found'.
else.
write: 'Not Found'.
endif.
Regards,
Chandra Sekhar
2008 Sep 01 10:28 AM
I tried use sy-abcde,but still can not get right result.
I think it only recognize Capital letter.
Edited by: lin tao on Sep 1, 2008 11:33 AM
2008 Sep 01 10:34 AM
just copy your code here, and explain what happens and what do you expect to happen...
2008 Sep 01 10:45 AM
Try this
take a variable and make its value as shown
v_abcde type char60 value 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi...xyz'.
Now compare your variable suppose v_str as
If v_str CA v_abcde.
..
else.
..
Endif.
This will help!
Regards,
Prashant
2008 Sep 01 10:49 AM
I think it only recognize Capital letter.
post your code here.
Amit.
2008 Sep 01 10:58 AM
My code:
data: p_char(10) type c value'3001d0001'.
search sy-abcde for p_char.
if sy-subrc eq 0.
write: 'Found'.
else.
write: 'Not Found'.
endif.
if p_char CA sy-abcde.
write: 'Found'.
else.
write: 'Not Found'.
endif.
-
the output is Not found, Not found.
If I change value'3001D0001'
the output is Not found, found.
2008 Sep 01 10:59 AM
hii
use following code
data: wa_str(100) type c.
data: wa_str1 type string.
data: wa_str2 type string.
data: wa_str3 type string.
data: len type i.
data: ofset type i.
wa_str = 'ABCD7788HJK.
len = strlen( wa_str ).
do.
if ofset = len.
exit.
endif.
if wa_str+ofset(1) co sy-abcde .
concatenate wa_str2 wa_str+ofset(1) into wa_str2.
else.
concatenate wa_str3 wa_str+ofset(1) into wa_str3.
endif.
ofset = ofset + 1.
enddo.
write:/ wa_str.
write:/ 'alphabate ::', wa_str2.
regards
twinkal
2008 Sep 01 11:01 AM
I expect the program to recongnize both upper case and lower case letter. as long as the string contains any alph, it should ouput found.
2008 Sep 01 11:04 AM
data: p_char(10) type c value'3001d0001'.
TRANSLATE p_char TO UPPER CASE.
if p_char CA sy-abcde.
if sy-subrc eq 0.
write: 'Found'.
else.
write: 'Not Found'.
endif.
endif.
in both case of D and d i got the output found.
Amit.
2008 Sep 01 10:36 AM
Hi lin,
You can use this code to check a variable.
IF VAR1 CA SY-ABCDE.
DO YOUR CALCULATION.
ENDIF.
<removed_by_moderator>
Edited by: Julius Bussche on Sep 1, 2008 10:06 AM
2008 Sep 01 10:59 AM
Hi, maby it's not the full alfabeth but just some of it.
Then the CS 'ABCDE' (contain string) can be usefull.
/Tom
2008 Sep 01 11:12 AM
hiii
use following code
data: wa_str(100) type c.
data: wa_str1 type string.
data: wa_str2 type string.
data: wa_str3 type string.
data: len type i.
data: ofset type i.
wa_str = 'ABCD435hjK'.
len = strlen( wa_str ).
TRANSLATE wa_str TO UPPER CASE.
do.
if ofset = len.
exit.
endif.
if wa_str+ofset(1) co sy-abcde .
concatenate wa_str2 wa_str+ofset(1) into wa_str2.
else.
concatenate wa_str3 wa_str+ofset(1) into wa_str3.
endif.
ofset = ofset + 1.
enddo.
write:/ wa_str.
write:/ 'alphabatic char', 20 wa_str2.
here TRANSLATE wa_str TO UPPER CASE.
statement have added .i hope this will solve your problem.
regards
twinkal
2008 Sep 01 11:13 AM
Hi,
Please ignore this.
Edited by: Syed Abdul Adil on Sep 1, 2008 12:31 PM
2008 Sep 01 2:08 PM