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

CDS VIEW Select statement with where clause

Former Member
0 Kudos
4,287

Dear Expert,

I want to achieve the below in the CDS view.

AS ABAP

SELECT * FROM edidc INTO CORRESPONDING FIELDS OF table it_data
WHERE ( ( mestyp = 'ORDERS' AND direct = '2' ) OR
( mestyp = 'ORDCHG' AND direct = '2' ) OR
( mestyp = 'INVOIC' AND direct = '1' ) OR
( mestyp = 'WMMBXY' AND direct = '2' ) OR
( mestyp = 'PORDCH' AND direct = '2' ) OR
( mestyp = 'DESADV' AND direct = '1' ) OR
( mestyp = 'DESADV' AND direct = '2' ) OR
( mestyp = 'INVOIC' AND direct = '2' ) OR
( mestyp = 'ORDERS' AND direct = '1' ) OR
( mestyp = 'ORDCHG' AND direct = '1' ) OR
( mestyp = 'Z_INV_STAT' AND direct = '1' ) ).

CDS VIew

define view Ztest_assotiation

as select from edidc as a

association [1] to edid4 as b on $projection.docnum = b.docnum

{ a.docnum, a.mestyp, a.sndprn, a.direct, a.credat, b.counter, b.segnum, b.segnam, b.dtint2 , b.sdata }

I want to achieve multiple where conditions for same field ex. ( mestyp = 'ORDERS' AND direct = '2' ) OR

( mestyp = 'ORDCHG' AND direct = '2' ) OR
( mestyp = 'INVOIC' AND direct = '1' ) OR
( mestyp = 'WMMBXY' AND direct = '2' ) OR
( mestyp = 'PORDCH' AND direct = '2' ) OR

Kindly help.

1 REPLY 1
Read only

Former Member
0 Kudos
1,310

Dear

Please do let me know, if you have succeeded in getting the value in the CDS view from the EDID4 table.

Regards

Praveen G