2006 Aug 03 12:07 PM
hi,
I'm beginner.
I have a stupid question :-). Paste my Example:
DATA: lowletters(28) TYPE c VALUE 'abcdefghijklmnñopqrstuvwxyz',
string(100) TYPE c VALUE 'WORDINUPPERCASE'.
IF string CA lowletters.
WRITE 'string is lower-case'.
ELSE.
WRITE 'string is upper-case'.
ENDIF.
Result of report:
string is lower-case
Why??? I don't understand. I read help a lot of time about CA (Contains Any) and it say: "c1 contains at least one character from the string c2. ". In my Example c1 (string) NOT CONTAINS at least one character from the string lowletters. Maybe Im crazy.
Can you help me?
A lot of thanks in advance.
Best regards.
djlu
2006 Aug 03 12:15 PM
declare lowletters of length 27(exact length) , its working
REPORT ABC line-size 255.
DATA: lowletters(27) TYPE c VALUE 'abcdefghijklmnñopqrstuvwxyz',
string(100) TYPE c VALUE 'WORDINUPPERCASE'.
IF string CA lowletters.
WRITE 'string is lower-case'.
ELSE.
WRITE 'string is upper-case'.
ENDIF.
2006 Aug 03 12:12 PM
hi Juan,
CA is case sensitive...
If SAP ca ABAP/4.
Write:/ True.
Else.
Write:/ False.
Endif.
Truethis code of yours is working in this way ..
DATA: lowletters(28) TYPE c VALUE 'abcdefghijklmnnopqrstuvwxyz',
string(100) TYPE c VALUE 'WORDINUPPERCASE'.
IF string CA 'abcdefghijklmnnopqrstuvwxyz'.
WRITE 'string is lower-case'.
ELSE.
WRITE 'string is upper-case'.
ENDIF.Regards,
Santosh
2006 Aug 03 12:12 PM
try this
REPORT ABC line-size 255.
DATA: lowletters(28) TYPE c VALUE 'abcdefghijklmnñopqrstuvwxyz',
string(100) TYPE c VALUE 'WORDINUPPERCASE'.
IF string CA 'abcdefghijklmnñopqrstuvwxyz'.
WRITE 'string is lower-case'.
ELSE.
WRITE 'string is upper-case'.
ENDIF.
2006 Aug 03 12:15 PM
declare lowletters of length 27(exact length) , its working
REPORT ABC line-size 255.
DATA: lowletters(27) TYPE c VALUE 'abcdefghijklmnñopqrstuvwxyz',
string(100) TYPE c VALUE 'WORDINUPPERCASE'.
IF string CA lowletters.
WRITE 'string is lower-case'.
ELSE.
WRITE 'string is upper-case'.
ENDIF.
2006 Aug 03 12:20 PM
WOW!
a lot of thanks!!!
exact length problem! Now it's works.
But i think that i'll never understand why.
regards.
djlu2003
2006 Aug 03 12:24 PM
May be because if you dont give the exact length , the extra character will be taken as space ,
so both the variables will contain space
so the SY_SUBRC will be 0 as both contain spaces
2006 Aug 03 12:26 PM
The reason is due trailing SPACE at the end. Also, you can use CONDENSE statmenet with NO-GAP to delete the trailing spaces in the string.
Regards
Anurag
2009 Apr 28 9:41 AM
Hi,
But it doesn't work if we have a variable which is the type c, and we want to get only the num data:
for example, I have :
parameters: pa(10) type c.
if pa CA 'abcdefghijklmnopqrstuvwxyz'.
WRITE / 'pa is the type num'.
endif.
even if the parameters pa has type c, I want to verify the input data in this field and get only the numeric value.
Mll Mat
Edited by: mll mat on Apr 28, 2009 10:50 AM
2006 Aug 03 12:16 PM
may be in string comparision the checking is case INsensitive.
regards
srikanth
Message was edited by: Srikanth Kidambi