Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2096

CDS in NW740: How to access a calculated value in the view

$
0
0

Hello,

 

Is it possible to create a new column in the view and access ist? Here is my simple code:

 

@AbapCatalog.sqlViewName: 'zcds_bookings_nr'

@AbapCatalog.compiler.CompareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'Anzahl an BUchungen'

define view Z_Cds_Nr_Of_Bookings as select from zsbook {

    key zsbook.carrid,

    key zsbook.connid,

    key zsbook.fldate,

    key zsbook.class,

    count(*) as nr_of_bookings,

    case

    when nr_of_bookings > 0 then 'ok'    // syntax error, column nr_of_bookings is not known!

    else 'nok' end as xxx

   

}

group by carrid, connid, fldate, class

 

If I omit the case statement, I can define a new view, which accepts the case statement:.

define view Zhrw_Flight_Booking_3 as select from Z_Cds_Nr_Of_Bookings {

...

    case

    when Zhrw_Flight_Booking_2.nr_of_bookings > 0 then 'ok'

        else ' not ok' end as status

}

 

Is it possible to calculate the status in the first view?


Viewing all articles
Browse latest Browse all 2096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>