Application Development and Automation 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: 
Read only

Select query issue with NOT IN condition

former_member198680
Participant
0 Likes
5,205

Hello,

I am creating a CDS view and getting syntax error with NOT IN condition of WHERE clause.

My sample query in CDS looks like

SELECT FROM BKPF{

bukrs, belnr, gjahr, ,,, }

WHERE blart NOT IN ('KN','KR')

Please help how to fix this?

Thanks,

Prasad

1 ACCEPTED SOLUTION
Read only

maheshpalavalli
Active Contributor
0 Likes
4,357

Hi Prasad Ganta

I believe what you are trying is the ABAP opensql statement in ABAP CDS view. As both are different, what works in ABAP OpenSQL will not work in CDS view. You can check the documentation below:

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abencds_f1_conditional_expression.htm

You can use the where condition as below:

where ( blart <> 'KN' and blart <> 'KR' )

Thanks,
Mahesh

Hello,

I am creating a CDS view and getting syntax error with NOT IN condition of WHERE clause.

My sample query in CDS looks like

SELECT FROM BKPF{

bukrs, belnr, gjahr, ,,, }

WHERE blart NOT IN ('KN','KR')

Please help how to fix this?

Thanks,

Prasad

1 REPLY 1
Read only

maheshpalavalli
Active Contributor
0 Likes
4,358

Hi Prasad Ganta

I believe what you are trying is the ABAP opensql statement in ABAP CDS view. As both are different, what works in ABAP OpenSQL will not work in CDS view. You can check the documentation below:

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abencds_f1_conditional_expression.htm

You can use the where condition as below:

where ( blart <> 'KN' and blart <> 'KR' )

Thanks,
Mahesh