‎2006 Oct 04 9:54 PM
HI All,
I have a requirement to compare strings.
Like this:
parameters: belnr like bkpf-belnr.
Select * from swwwihead into table t_swwwihead
where ( WI_TYPE EQ 'F' or
WI_TYPE EQ 'W' ) AND
WI_CD GE l_budat.
X2 = belnr.
Loop at t_swwwihead.
X1 = t_swwwihead-TEXT.
IF X1 byte-cs X2.
write :/ t_swwwihead-TEXT.
Endif.
Endloop.
I tried to use 'CP' but i could not compare using fields. I mean i have to compare the values in the fields.
I tried byte-cs but that i can only compare in terms of bytes and my text doesnot have zeros at the begining. and xstring pads zeros to the string to make it a full byte it seems.
how can i compare this ?
‎2006 Oct 04 10:11 PM
Hi,
Try to concatenate * in the beginning and in the end of the to be compared string before using CP..
Example
-
data: X1 type string.
X1 = 'Approve Parked document 100638133 initiated by USER123'.
data: X2 type string.
X2 = '100638133'.
CONCATENATE '' X2 '' INTO X2.
IF X1 CP X2.
write: / 'True'.
ELSE.
write: / 'False'.
ENDIF.
Thanks,
Naren
Message was edited by: Narendran Muthukumaran
‎2006 Oct 04 10:03 PM
‎2006 Oct 04 10:06 PM
Thanks Narendran...!
X1 = Approve Parked document 100638133 initiated by USER123
and
X2 = 100638133
‎2006 Oct 04 10:11 PM
Hi,
Try to concatenate * in the beginning and in the end of the to be compared string before using CP..
Example
-
data: X1 type string.
X1 = 'Approve Parked document 100638133 initiated by USER123'.
data: X2 type string.
X2 = '100638133'.
CONCATENATE '' X2 '' INTO X2.
IF X1 CP X2.
write: / 'True'.
ELSE.
write: / 'False'.
ENDIF.
Thanks,
Naren
Message was edited by: Narendran Muthukumaran
‎2006 Oct 04 10:16 PM
‎2006 Oct 04 10:17 PM
Why not just use CS?
DATA: x1 TYPE string,
x2 TYPE string.
x1 = 'Approve Parked document 100638133 initiated by USER123'.
x2 = '100638133'.
IF x1 CS x2.
* process
ENDIF.Rob
Message was edited by: Rob Burbank