‎2007 Sep 19 10:40 AM
Hi,
I should compare two fields xblnr and belnr which have lenth 16 and 10 respectively. We should not reduce lenth of first field. Both are character type. Suggest me efficient way.
Regards,
Subbu
‎2007 Sep 19 10:54 AM
‎2007 Sep 19 10:54 AM
character fields are left-justified so you can just compare with "=" the first 10 digits of XBLNR and the field BELNR
‎2007 Sep 19 10:54 AM
‎2007 Sep 19 10:57 AM
hi
try using this:
CS (Contains String):
c1 contains the character string c2.
Trailing blanks in c1 and c2 are ignored if the respective field is of type C.
An empty string c2 (i.e., only blanks with type C, or empty string with type STRING) is included in any string c1, including the empty string itself. On the other hand, there is no non-empty string c2 included in an empty string c1.
If the result of the comparison is positive, the system field SY-FDPOS contains the offset of the first character of c2 in c1.
If the result of the comparison is negative, the system field SY-FDPOS contains the length of c1.
The comparison is not case-sensitive.
Examples:
'ABCDE' CS 'CD' is true; SY-FDPOS = 2.
'ABCDE' CS 'XY' is false; SY-FDPOS = 5.
'ABAAA' CS 'AB ' is true; SY-FDPOS = 0.
' ABC' CS ' AB' is true; SY-FDPOS = 1.
'ABC DEF' CS ' ' is true; but: SY-FDPOS = 0,
since ' ' is interpreted as a trailing blank and is thus
ignored.
Regardsm
Prasant
*reward if helpful