Skip to Content
0

CDS VIEW Select statement with where clause

Aug 11, 2017 at 11:02 AM

154

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers