Application Development 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: 

ABAP SQL with CDS Path Exprssion Attributes(n|*)

bohong_liu
Explorer

Dear Experts:

I am studying Path Exprssion Attributes with below example.

I have got a very big confusion when I change the cardinality in the example. I got some different results with different cardinalities. Are there any experts can explain the REASONs?

My scar, spfli, sflight, sairport are below.

My doubtful SQL case1:

WITH
+pathexpresson AS ( SELECT scarr~carrname,

\_spfli[ (1) ]-connid AS connid,
\_spfli[ (*) ]\_sflight[ (*) ]-fldate AS fldate,
\_spfli[ (*) ]\_sairport[ (1) ]-name AS name
FROM demo_cds_assoc_scarr AS scarr
WHERE scarr~carrid = 'AA'
ORDER BY carrname, connid, fldate
)"
SELECT carrname,connid,fldate,name FROM +pathexpresson INTO TABLE @DATA(lt_c01).

The result is

I think the LFDATE=2021-05-08 is a wrong data. Why can it be output?

My doubtful SQL case2:

WITH
+pathexpresson AS ( SELECT scarr~carrname,

\_spfli[ (1) ]-connid AS connid,
\_spfli[ (1) ]\_sflight[ (*) ]-fldate AS fldate,
\_spfli[ (*) ]\_sairport[ (1) ]-name AS name
FROM demo_cds_assoc_scarr AS scarr
WHERE scarr~carrid = 'AA'
ORDER BY carrname, connid, fldate
)"
SELECT carrname,connid,fldate,name FROM +pathexpresson INTO TABLE @DATA(lt_c01).

The result is

I think the NAME= San Francisco Int Apt,USA is a wrong data. Why can it be output?

Waiting for your answers. Thank you very much!

1 REPLY 1