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

CDS with conditional union in order to transpose monthly keyfigures

lucdealethea
Participant
0 Kudos
784

Dear Community,

I am trying ( without success ) to push down a parameter inside an ABAP CDS view in order to minimize the usage of inside projections;

I took the table COSB as an example since we find 16 monthly key figures that we want to transpose.

Lint doesn't like the usage of the parameter in this manner, which I can understand but Is it doable ? Any suggestion is really welcome.

@AbapCatalog.sqlViewName: 'ZTESTUNION'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Attempt to execute conditional Union with Params'
define view ZCDS_UNION_PARAM
    with parameters p_period : CO_PERIO
as select from cosb as C {
   c.mandt,
   c.lednr,
   c.objnr,
   c.gjahr,
   c.kstar,
   c.twaer as WAERS,
    @Semantics.amount.currencyCode:'WAERS' 
   c.wog001
   
}
where :p_period = '001' 
union
select from cosb as C {
   c.mandt,
   c.lednr,
   c.objnr,
   c.gjahr,
   c.kstar,
   c.twaer as WAERS,
    @Semantics.amount.currencyCode:'WAERS' 
   c.wog002
}
where :p_period = '002' 

0 REPLIES 0