cancel
Showing results for 
Search instead for 
Did you mean: 

Association can not be used locally with in the view..

0 Kudos

Hi experts,

I am getting the following error in cds association.can any one please explain the error

cda-error.png

Accepted Solutions (0)

Answers (1)

Answers (1)

mmcisme1
Active Contributor
0 Kudos

This was answered in a blog by Horst Keller. You can see the details in the comments.

"I’m desperately searching for a possibility, to build and fill a table mesh straight away from my CDS view incorporating the associations.

In the the whole Structure looks like:

[Workcenters]
-[Tasks Lists of Workcenters]
–[Materials of Task Lists]
—[Consumption of Materials] (Transposed from columns to rows)
—-[Workdays per Month] (Transposed form columns to rows)

With of course some additional calculation in between

As now based on this path structure, I’d like to create an ABAP report

Unfortunately (as of now) I can’t find anything?"

Horst's answer "Me too …" In other words it can't be done.

"You have a kind of recursion. You use $projection that refers to the SELECT list and use the association in the SELECT list itself. The following is error free:"

define view ...
  as select from
    spfli
    association to scarr    as _scarr  on
      spfli.carrid = _scarr.carrid
    association to scarplan as _scplan on
      spfli.carrid = _scplan.carrid
    {
      key spfli.carrid           as id,
      key spfli.connid           as flight,
          spfli.cityfrom         as departure,
          spfli.cityto           as arrival,
          _scarr.carrid,
          _scplan.planetype
    }