Skip to Content
avatar image
Former Member

CDS VIEW Select statement with where clause

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers