cancel
Showing results for 
Search instead for 
Did you mean: 

Could not get data from OData with CDS

former_member267947
Participant
0 Kudos

Hi all

I created a CDS query:

@AbapCatalog.sqlViewName: 'ZAMSALESSTAT'
@AbapCatalog.compiler.compareFilter: true
@OData: {
    publish: true
}
@AccessControl.authorizationCheck: #NOT_REQUIRED 
@EndUserText.label: 'Sales statistics from payer'
define view ZAM_sales_statistics
  with parameters
    p_payer_l: kunnr,
    p_payer_u: kunnr,
    p_date_l: datum,
    p_date_u: datum
as select from vbrk {
    key kunrg as Payer,
    @Semantics.currencyCode: true
    waerk as Currency,
    @Semantics: {
        amount: {
            currencyCode: 'Currency'
        }
    }
    sum(netwr) as NetValue
}
where kunrg between :p_payer_l and :p_payer_u
and   fkdat between :p_date_l and :p_date_u
group by kunrg,
         waerk

and provide it as OData interface as you can see on the annotation.

I tried to query via SAP Gateway Client as following:

/sap/opu/odata/sap/ZAM_SALES_STATISTICS_CDS/ZAM_sales_statisticsSet?$filter=p_payer_l eq '0022100000' and p_payer_u eq '0022100005' and p_date_l eq datetime'2017-11-01T00%3A00%3A00' and p_date_u eq datetime'2017-12-31T00%3A00%3A00'

and got the exception:

I did test the CDS query and got expected result:

Payer,Currency,NetValue
0022100003,CHF,1175.80
0022100001,CHF,1000.00
0022100005,CHF,46362.00

Why do I get an exception on OData service? What am I doing wrong?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Joseph_BERTHE
Active Contributor

Hello,

Try debugging by remove all filters and see if it works. Then add filter by filter to identify which one raise the exception.

Regards

Joseph

Answers (1)

Answers (1)

Ankit_Maskara
Employee
Employee
0 Kudos

Put breakpoint in /IWBEP/FM_MGW_HANDLE_REQUEST in backend system and see if it helps.