‎2006 Nov 02 5:42 AM
Is this one of the correct syntax for CP ?.What would this do ?
kschl cp 'ZAD' or kschl cp 'ZDP'
‎2006 Nov 02 5:52 AM
Just check whether this can help you.
CP (Contains Pattern)
The logical expression
<f1> CP <f2>
is true if <f1> matches the pattern <f2>. If <f2> is of type C, you can use the following wildcards in <f2>:
for any character string: *
for any single character: +
Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
If you want to perform a comparison on a particular character in <f2>, place the escape character # in front of it. You can use the escape character # to specify
characters in upper and lower case
the wildcard character "" (enter:#)
the wildcard character "" (enter: # )
the escape symbol itself (enter: ## )
blanks at the end of a string (enter: #___ )
'ABcde' CP 'b' true
'ABcde' CP '#b' false
‎2006 Nov 02 6:06 AM
Hi Sarika,
Check this.
<i>CP (Contains Pattern):
The complete string c1 matches the pattern c2 (c1 "matches" c2).
The pattern c2 can contain ordinary characters and wildcards.
'*' stands for any character string and '+' denotes any character.
If the result of the comparison is positive, the system field SY-FDPOS contains the offset of the first character of c2 in c1. The wildcard character '*' at the beginning of the pattern c2 is ignored when determining the value of SY-FDPOS.
If the result of the comparison is negative, the system field SY-FDPOS contains the length of c1.
Examples:
'ABCDE' CP 'CD' is true; SY-FDPOS = 2.
'ABCDE' CP '*CD' is false; SY-FDPOS = 5.
'ABCDE' CP '+CD' is true; SY-FDPOS = 0.
'ABCDE' CP '+CD*' is false; SY-FDPOS = 5.
'ABCDE' CP 'BD*' is true; SY-FDPOS = 1.
The character '#' has a special meaning. It serves as an escape symbol and indicates that the very next character should be compared "exactly".
This allows you to search for:
- characters in upper or lower case
e.g.: c1 CP '#A#b'
- the wildcard characters '*', '+' themselves
e.g.: c1 CP '#' or c1 CP '#+*'
- the escape symbol itself
e.g.: c1 CP '##'
- blanks at the end of c1
e.g.: c1 CP '*# '
If c2 does not contain the wildcard character '*', the shorter field is padded with "soft blanks" to bring it up to the length of the longer field.
Examples:
'ABC' CP 'ABC ' is true,
'ABC ' CP 'ABC' is true,
but
'ABC' CP 'ABC+' is false,
'ABC' CP 'ABC# ' is false,
because a "soft blank" is neither any character ('+') nor a "real" blank ('# ').
The escape symbol does not affect the length of f2 ('A#a#B' still has the length 3).
The comparison is not case-sensitive.
</i>
Regards,
Raghav