Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error using CS Operator

Former Member
0 Kudos
406

Hi all,

I m generating an report in which i have to display Vendor code and vendor name, against some short description of name entered in selection screen.

For this i use cs operator , but it is showind an error

"CS" is not a valid comparison operator.

if s_lifnr is not initial .

select lifnr bukrs from lfb1

into table i_lfb1

where lifnr in s_lifnr

and ( bukrs eq p_bukrs ).

if i_lfb1[] is not initial.

select lifnr name1

from lfa1

into corresponding fields of table i_lfa1

for all entries in i_lfb1

where lifnr = i_lfb1-lifnr

and ( name1 cs s_name1 ).

endif.

Can anybody tell me where i m wrong.

Definitely rewards pts.

Best regards,

Aastha Gupta

7 REPLIES 7

Former Member
0 Kudos
235

Hi AAstha,

Is you s_name1 is an select-option?

In that case please use name1 cs s_name1-low or name1 cs s_name1-high to get it correct.

Hope this helps you.

Thanks,

Arun

0 Kudos
235

Hello Arun,

I edit it, as u said.

But it is again showing the same error.

Best Regards,

Aastha.

kesavadas_thekkillath
Active Contributor
0 Kudos
235

u cannot use cs in a query

use something like this

select lifnr name1

from lfa1

into corresponding fields of table i_lfa1

for all entries in i_lfb1

where lifnr = i_lfb1-lifnr

and ( name1 like '%s_name1%' ).

0 Kudos
235

sorry my earlier reply is not possible....better u select the data first..

the loop at itab and then use cs or cp....

0 Kudos
235

select lifnr name1

from lfa1

into corresponding fields of table i_lfa1

for all entries in i_lfb1

where lifnr = i_lfb1-lifnr.

loop at i_lfa1.

check i_lfa1-name1 cs s_name1. "some thing like this

0 Kudos
235

Thanks Keshu,

I m stuck up in b/w while generating that report.

No data is coming in my internal table i_lfb1, if i m giving input only the lifnr.

if s_name1 is not initial or s_lifnr is not initial or p_bukrs is not

initial.

Can u resolve this 1 too.

select lifnr bukrs from lfb1

into table i_lfb1

where lifnr in s_lifnr

and ( bukrs = p_bukrs ).

if i_lfb1[] is not initial.

select lifnr name1

from lfa1

into corresponding fields of table i_lfa1

for all entries in i_lfb1

where lifnr = i_lfb1-lifnr.

loop at i_lfa1.

check i_lfa1-name1 cs s_name1.

append i_lfa1.

endloop.

endif.

if i_lfa1[] is not initial.

select lifnr ekorg

from lfm1

into corresponding fields of table i_lfm1

for all entries in i_lfa1

where lifnr = i_lfa1-lifnr

and ( ekorg eq p_ekorg ) .

endif.

if i_lfa1[] is not initial.

select werks ekorg

from t024w

into corresponding fields of table i_t024w

for all entries in i_lfm1

where ekorg = i_lfm1-ekorg

and ( werks eq p_werks ).

endif.

0 Kudos
235

do remove that initial statement above....it becomes correct...mean while check the code below...this meets ur req.



tables:lfa1.

select-options:so_name1 for lfa1-name1 no intervals.

data:t_lfa1 like standard table of lfa1.
data:search_pattern type string.

loop at so_name1.
concatenate '%' so_name1-low '%' into search_pattern.
select * from lfa1 appending table t_lfa1 where name1 like
search_pattern.
clear search_pattern.
endloop.