‎2014 Aug 26 10:31 AM
Hi i am getting error when i write the below select statement, could any one please let me know, how to use CP operator in select statement
my code was
SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
FIELDS OF TABLE lt_lfa1
WHERE lifnr CP lv_lifnr AND
name1 CP lv_name1.
Thanks
Srini
Message was edited by: Manish Kumar <spoonfeeding, thread locked by moderator>
Message was edited by: Manish Kumar
‎2014 Aug 26 10:34 AM
You need to use WHERE lifnr LIKE lv_lifnr and in lv_lifnr you should have concatenated the existing value (lets say it is 10003) so it will be %10003%.
Check the help function on LIKE.
‎2014 Aug 26 10:36 AM
You can't use the operator in select query, instead declare as range and fill the range with option = CP
‎2014 Aug 26 10:37 AM
CP is not allowed as select operator.
You shoul declare select-options/ranges and fill them with I - CP -low_value
‎2014 Aug 26 10:48 AM
either you have select-options with lifnr and name and use them in the below query as
SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
FIELDS OF TABLE lt_lfa1
WHERE lifnr in s_lifnr AND
name1 in s_name1.
else you need to declare internal tables with structure as below..
DATA: begin of ls_user1,
sign type c,
option(2) type c,
low(90) type c,
high(90) type c,
end of ls_user1.
data: lt_lifnr like ls_user1 occurs 0,
lt_name1 like ls_user1 occurs 0.
and then populate these as
ls_user1-sign = 'I'.
ls_user1-option = 'CP'.
ls_user1-low = '*'. populate with whatever pattern you want
APPEND ls_user1 TO lt_lifnr
similarly do it for NAME1 and use them in the query.
‎2014 Aug 26 11:05 AM
Hi friends
i am sorry my actual requirement is
if user enters 'su*'. in NAME FIELD
it should fetch all the records with 'su' in case insesitive
could any one please let me know how to solve this
Thanks
Srini
‎2014 Aug 26 11:08 AM
See my answer. You need to concatenate % in front and after the user input and then use LIKE in your where statement.
‎2014 Aug 26 11:14 AM
hi peter
i used like operator
but when i enter 'su'.
i am not getting name 'Suresh'
when users enters 'su*'
it should fetch Suresh also
‎2014 Aug 26 11:25 AM
hi peter
if we user LIKE operator its case sensitive
but want to fetch records with case insensitive
is there any other option , pls let me know
‎2014 Aug 26 11:31 AM
Since it's LFA1-NAME1 is case sensitive, you have to manage all the options possible
It's already been debated long time (a little search on SDN)
Here previous posts
Here a smart solution even if performances can be a problem
select the text from lower case data element - ABAP Development - SCN Wiki