Skip to Content
0

Table name $projection unknown or shadowed by an alias

Nov 01, 2016 at 08:04 PM

529

avatar image
Former Member

Hi,

@AbapCatalog.sqlViewName: 'ZAJ_ASSO'
@ClientDependent: true
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'AJ Test Association'
define view Ztest_Aj_Asso
with parameters
p_calday : sydatum
as select from vbak as vb inner join vbap as VP
on vb.vbeln = VP.vbeln
{ key vb.vbeln,
vb.kunnr,
vb.erdat,
left(vb.erdat,6) as calyearmonth,
sum(case when vb.erdat between concat( $projection.calyearmonth ,'01') and $parameters.p_calday then vb.netwr else 0 end) as MTD
} where vb.erdat = $parameters.p_calday
group by vb.vbeln,vb.kunnr,vb.erdat

I want to calculate MTD, on using calculated "calyearmonth" i m getting this error, Kindly help to resolve, also is there any other way to calculate MTD QTD YTD

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Aug 18, 2017 at 11:42 AM
0

Hi Abhinandan,

Please try the below code.

@AbapCatalog.sqlViewName: 'ZAJ_ASSO'
@ClientDependent: true
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'AJ Test Association'
define view Ztest_Aj_Asso
with parameters
p_calday : sydatum
as select from vbak as vb

association[1] to vbap as VP on $projection.vbeln = VP.vbeln

{ key vb.vbeln,
vb.kunnr,
vb.erdat,
left(vb.erdat,6) as calyearmonth,
sum(case when vb.erdat between concat( $projection.calyearmonth ,'01') and $parameters.p_calday then vb.netwr else 0 end) as MTD
} where vb.erdat = $parameters.p_calday
group by vb.vbeln,vb.kunnr,vb.erdat

Regards

Biswajit Nag

Share
10 |10000 characters needed characters left characters exceeded