‎2011 Jun 27 6:30 AM
Dear Experts,
I want to compare my input string with the pattern as:
Input String = 'ABCD-100'.
I want to compare before -(dash) entered string should only contains character(s) (e.g; A, b, D, C etc.); not the numbers.
how should I do it.
Regards,
Sohail
‎2011 Jun 27 6:38 AM
hi,
PARAMETERS p_date(20)."
DATA : lv_po TYPE sy-fdpos,
l_date(10).
IF p_date CA '-'. "check the - sybol is there or not
lv_po = sy-fdpos. "get the position
l_date = p_date(lv_po).
IF l_date CA '123456789'. " any numbers is there or not
MESSAGE 'error' TYPE 'E'.
else.
MESSAGE 'Sucess' TYPE 'S'.
ENDIF.
ENDIF.
Regards,
Dhina..
‎2011 Jun 27 6:38 AM
Hi,
Split the string at '-' into two variables and then check the first variable if it contains any alphabets.
Thanks,
Sri.
‎2011 Jun 27 6:38 AM
hi,
PARAMETERS p_date(20)."
DATA : lv_po TYPE sy-fdpos,
l_date(10).
IF p_date CA '-'. "check the - sybol is there or not
lv_po = sy-fdpos. "get the position
l_date = p_date(lv_po).
IF l_date CA '123456789'. " any numbers is there or not
MESSAGE 'error' TYPE 'E'.
else.
MESSAGE 'Sucess' TYPE 'S'.
ENDIF.
ENDIF.
Regards,
Dhina..
‎2011 Jun 27 6:49 AM
Try this...
data str type string value 'AB2D-100'.
data: str1 type string,
str2 type string.
split str at '-' into str1 str2.
if str1 na '0123456789'.
write: 'Not containing Numbers'.
else.
write: 'Contain Numbers'.
endif.