Skip to Content
0
Jun 01, 2018 at 02:43 PM

CDS views: how to select orders by status to get an ODATA service

2450 Views

Hello developers,

I'm rather new to CDS (core data services) view technology. So I'm trying to develop a first SAPUI5 app which should shows specific data of "released" and running productions orders.

For this I'm trying to create a CDS view to select orders from table AUFK joined by status of table JEST.

I did a lot of fails, to get a select which gives me only a list of orders (with no double entries) where system status is e.g. not like the following:

define view ZPP_RUNNING_ORDERS_V 
as select from aufk as A
inner join jest as J
    on J.objnr = A.objnr 
  
{   A.aufnr,
    J.stat    }
where A.autyp = '10' and
      J.inact = ''  and
      J.stat <> 'I0076' and // DLFL = deletion flag
      J.stat <> 'I0045' and // TECO = technically completed
      J.stat <> 'I0046' and // CLSD = closed
    ( J.stat = 'I0002' or   //REL  = released
      J.stat = 'I0009' or   //CNF  = confirmed
      J.stat = 'I0010' )    //PCNF = partially confirmed

but because of the join I get of course a lot of double entries. Trials with no JOIN failed, too. And if you spend lots of hours it is always good to ask specialists :-)

So please help me !

How to create a view which gives a flat list of "released" orders.

Maybe the solution is to create more than one CDS view ...

If there is no view solution possible: what is the best technology to do this ?

Thank you very much !

Best regards,

Markus

P.S.1 I'm focusing on CDS view to get an ODATA service. So please no ABAP solutions, no function models or classes ! A solution by ABAP is easy ...

P.S.2 I'm on a 7.40 SAP ERP ... so please no HANA solutions :-)