Skip to Content

CDS view - Left outer join table field in Where condition not working.

Hi All,

I have a requirement like below:

A custom table is there:

Z_CUST_TAB with fields:

EBELN (Primary key)

EBELP (Primary key)

run_no(Primary key)

po_type


--

Created a CDS view for purpose as below -

select distinct from ekkn as ekkn

inner join ekpo as ekpo

on ekpo.ebeln = ekkn.ebeln

and ekpo.ebelp = ekkn.ebelp

and ekpo.loekz <> 'X'

and ekkn.vbeln = ''

left outer join Z_CUST_TAB

on Z_CUST_TAB.ebeln = ekpo.ebeln

and Z_CUST_TAB.ebelp = ekpo.ebelp

{

ekkn.vbeln,

ekpo.ebeln,

ekpo.ebelp,

Z_CUST_TAB.po_type

}

where

Z_CUST_TAB.run_no <> '00000'


---

Question:

There might be a scenario for that EKPO / EKKO will be filled but Z_CUST_TAB will not be filled.

In this kinds of scenario my CDS view is not working, means no line item is showing ( while executing the view from se16n) for a PO of the previous kind.

When I am removing where condition of the CDS view, my CDS view is working fine.

But as per my requirement I have to implement the where condition in the CDS view only.

Please tell me where I could be wrong.


Thanks in Advance.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 30, 2017 at 05:37 AM

    Why do you use a LEFT JOIN if you put a WHERE condition on the result set, what did you actually expect, in some case the where clause should be moved into the ON condition to get proper result?

    Add comment
    10|10000 characters needed characters exceeded