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

select count(*) for CDS view on top of COEP and underlying table COEP table has different counts

jmalla
Contributor
0 Kudos
1,968

I'm running into a strange issue with CDS.

For the COEP physical table, I get a certain number 30 million plus as the count.

I have created a CDS with a select from COEP with all of the same fields and also I have defined the keys as the same. However, when I do a join with this table, the results are less than what I expect. When I do a select count(*) on this CDS view, it's 10 million records.

//@ClientHandling.type: #CLIENT_DEPENDENT
//@ClientHandling.algorithm: #SESSION_VARIABLE


@AbapCatalog.sqlViewName: 'ZRTR_COEP2'
//@AbapCatalog.compiler.compareFilter: true
//@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Controlling Object Lines'


// somehow selecting from coep is not giving the same as v_coep_view that is giving the same entries as table COEP
// this is giving 217 entries instead of 38908 entries that are in coep table
// same keys specified as in table coep
define view ZRTR_CONTROLLING_OBJECT_LINES2 as select from coep {


    //coep 
    key mandt,
    key kokrs, 
    key belnr, 
    key buzei, 
    perio, 
    wtgbtr, 
    wogbtr, 
    wkgbtr, 
    wkfbtr, 
    pagbtr, 
    pafbtr, 
    megbtr, 
    mefbtr, 
    mbgbtr, 
    mbfbtr, 
    lednr, 
    objnr, 
    gjahr, 
    wrttp, 
    versn, 
    kstar, 
    hrkft, 
    vrgng, 
    parob, 
    parob1, 
    uspob, 
    vbund, 
    pargb, 
    beknz, 
    twaer, 
    owaer, 
    meinh, 
    meinb, 
    mvflg, 
    sgtxt, 
    refbz, 
    zlenr, 
    bw_refbz, 
    gkont, 
    gkoar, 
    werks, 
    matnr, 
    rbest, 
    ebeln, 
    ebelp, 
    zekkn, 
    erlkz, 
    pernr, 
    btrkl, 
    objnr_n1, 
    objnr_n2, 
    objnr_n3, 
    paobjnr, 
    beltp, 
    bukrs, 
    gsber, 
    fkber, 
    scope, 
    logsyso, 
    pkstar, 
    pbukrs, 
    pfkber, 
    pscope, 
    logsysp, 
    dabrz, 
    bwstrat, 
    objnr_hk, 
    timestmp, 
    qmnum, 
    geber, 
    pgeber, 
    grant_nbr, 
    pgrant_nbr, 
    refbz_fi, 
    segment, 
    psegment, 
    posnr, 
    prctr, 
    pprct, 
    budget_pd, 
    pbudget_pd, 
    prodper, 
    awtyp, 
    awkey, 
    awsys, 
    kwaer, 
    accas, 
    accasty, 
    kostl, 
    lstar, 
    aufnr, 
    autyp, 
    pspnr, 
    pspid, 
    vbeln, 
    vbposnr, 
    ce4key, 
    erkrs, 
    paccas, 
    paccasty, 
    pkostl, 
    plstar, 
    paufnr, 
    pautyp, 
    ppspnr, 
    ppspid, 
    pvbeln, 
    pvbposnr, 
    pce4key, 
    quant1, 
    quant2, 
    quant3, 
    qunit1, 
    qunit2, 
    qunit3
    
} 
  

So I do not know why there is a discrepancy in the counts. I was able to use V_COEP_VIEW as a work around for my joins, but it is really slow and it has a lot of nested views on top of COEP and is really slow.

I tried to comment out to see if it would make a difference but it did not:

//@ClientHandling.type: #CLIENT_DEPENDENT
//@ClientHandling.algorithm: #SESSION_VARIABLE

//@AbapCatalog.compiler.compareFilter: true
//@AccessControl.authorizationCheck: #CHECK

Any ideas on why this issue is happening?

Thanks,

Jay

1 REPLY 1

maulik
Contributor
0 Kudos
805

This view is completely different from v_coep_view. This is comparing with S/4 1909.