Skip to Content
0

Could not get data from OData with CDS

Jan 11 at 01:41 PM

60

avatar image

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

capture.png (81.9 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Joseph BERTHE Jan 15 at 09:21 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Ankit Maskara
Jan 13 at 06:49 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded