Skip to Content
avatar image
Former Member

Problem to make a CDS view. ( Max keyword is not working )

Hello Experts.

I want to make a CDS VIEW about system status ( From  TJ02T, JEST )

But. CDS view doesn't work Max aggregation comparing STAT field.  I want to get only one  max line but the result It has two line.

STAT field is CHAR5 . But MAX aggregation it works characteristc domain. isn't it?

Here is my source.

CDS Define Source

@AbapCatalog.sqlViewName: 'ZVP3PSB90041CDS'
@EndUserText.label:       'Project Status (System)'

define view ZVP3PSB90041CDSI as

select from proj as proj
                    inner join tcj41 as tcj41
                            on proj.stspd = tcj41.stspd
                    inner join  jsto as jsto
                       on proj.objnr = jsto.objnr 
                      and proj.stspd = jsto.stsma
                    inner join jest as jest
                       on proj.objnr = jest.objnr
                    inner join tj02 as tj02
                       on jest.stat = tj02.istat
//                    inner join tj02t as tj02t
                       //on tj02.istat = tj02t.istat

{ key  proj.pspid as pspid,
      max ( jest.stat )  as istat
where ( tcj41.stspd <> '' or tcj41.stspr <> '' )
and tcj41.grpgs = 'PS'
and jest.inact = ' '
group by proj.pspid, jsto.objnr, jest.stat

But the result has two line like this

tes1.png (3.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 07, 2015 at 05:34 AM

    Sorrry. I was idiot.

    I have to use only key fields on GROUP BY statement,   Like this

    GROUP BY proj.pspid, jsto.objnr

    Add comment
    10|10000 characters needed characters exceeded