Skip to Content
avatar image
Former Member

Table name $projection unknown or shadowed by an alias

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

    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

    Add comment
    10|10000 characters needed characters exceeded