cancel
Showing results for 
Search instead for 
Did you mean: 

Can`t create an OData service for CDS view with @Analytics.query: true

0 Kudos
5,414

Hello, dear colleges.

I`m wondering if you could help me with one disturbing issue. I`m trying to make consumption CDS view available for the consumption via BW-live or S/4HANA-live direct connection in SAP Analytics Cloud. Everytime I try to expose my CDS view with "@Analytics.query: true"(further 'query annotation') annotation as an OData service I face the error:

"Metadata not loaded - See /IWBEP/ERROR_LOG in backend <system alias> - Query <SQL name> is unknown..."

My Consumption CDS view code:

Under the cross I have errors:

  • Wrong DPC class CL_SADL_GTK_EXPOSURE_DPC [OData Exposure]
  • View has generated Objects

I have created an OData service for my Consumption CDS view, added query annotation and activated CDS.

My Base CDS view code:

I tried to create various combinations and versions of CDS views: single consumption CDS views, base and consumption CDS views, I used CDS views pre-defined by S/4HANA, tried to give them different prefixes (Z_, C_, ZC_). But when I try to add query annotation to my CDS I get the metadata error shown above. I`m not strong in the area of CDS so I kindly ask you to help me understand how to get rid of such an error and expose CDS view with query annotation as an OData service.

My systems:

Eclipse version: 2020.09 (4.17.0) with ADT

S/4HANA version: 2.00.048.00.1591276203

Accepted Solutions (0)

Answers (3)

Answers (3)

DebjitSingha
Active Contributor

Hello 18gramsofmadness,

Not sure if you activated OData service (TCode - /IWFND/MAINT_SERVICE). If you alrady did verify if service is available in TCode - /iwfnd/gw_client.

Activate OData Service in the SAP Gateway Hub

Also refer below notes:

2512407 - Common Issues when using ODATA Queries

2387550 - Unable to activate the OData service for a Fiori Analytic App on S4HANA

Viewers/ readers - If you find above information helpful, feel free to up-vote (arrows on left side).

Debjit

0 Kudos

Hello, Debjit.

Thanks for your quick response and comprehensive answer. I will try using your links and advice in the near future and then will up-vote and assume the solution if it helps.

Best regards,

Mikhail

magadi
Discoverer
0 Kudos

Hi 18gramsofmadness,

I followed he steps and was able to successfully created oData service.. But i am unable to clearly understand the reap problem for this. Can you please take some time in explaining me what is actual problem.

Thanks,

Magadi

former_member778258
Discoverer
0 Kudos

Hi,

Did you find a solution?

Kind regards

0 Kudos

Hi,

Yes, I did. In the end I had 4 CDS-views. Here is the code for each of them.

At first, I selected some columns from VBAK table. Pay attention that the transactional data is taken from these columns.

@AbapCatalog.sqlViewName: 'ZCDS_ORDER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Orders'
@Analytics.dataCategory: #FACT
define view ZNAN_TEST_VBAK as select from vbak {
    key vbeln as Vbeln,
    kunnr as Kunnr,
    netwr as Netwr,
    waerk as Waerk
}
Then I made a selection from KNA1 table. It is made to provide the future data cube with dimensions.
@AbapCatalog.sqlViewName: 'ZCDS_KNA1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Client dimension view'
@Analytics.dataCategory:#DIMENSION
define view ZNAN_TEST_KNA1
  as select from kna1
{
      @ObjectModel.text.element:  [ 'name1' ]
      @EndUserText.label: 'Client code'
  key kunnr as Kunnr,
      @Semantics.text: true
      @EndUserText.label: 'Client Name'
      name1 as Name1,
      //    name2 as Name2,
      @EndUserText.label: 'Country'
      land1 as Land1,
      @EndUserText.label: 'City'
      ort01 as Ort01
}
At third, I united the data from both tables into one data cube via KUNNR colomn.
@AbapCatalog.sqlViewName: 'ZNAN_CLIENT_SUM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Order amount by client'
@Analytics.dataCategory: #CUBE
define view ZNAN_TEST_CLIENT_SUM
  as select from ZNAN_TEST_VBAK
  association [0..1] to ZNAN_TEST_KNA1 as Clients on $projection.Kunnr = Clients.Kunnr
{
  key Vbeln,
      //    key Kunnr,
      Kunnr,
      Clients, // Make association public
      @DefaultAggregation: #SUM
      @EndUserText.label: 'Amount'
      @Semantics.amount.currencyCode : 'ZNAN_TEST_CLIENT_SUM.Waerk'
      Netwr,
      Waerk,
      Clients.Land1,
      Clients.Ort01
}

At the end, I created analytical ... to make SAP AC be able to consume data from the cube.

@AbapCatalog.sqlViewName: 'ZNAN_TEST_CLNTAN'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Sales Analytic'
@Analytics.query: true
@VDM.viewType: #CONSUMPTION
@OData.publish: true
define view ZNAN_TEST_CLIENT_AN
  as select from ZNAN_TEST_CLIENT_SUM
{
  @AnalyticsDetails.query.axis: #ROWS
  @AnalyticsDetails.query.totals: #HIDE
  @AnalyticsDetails.query.display: #KEY_TEXT
  Vbeln,
  Kunnr,
  Netwr,
  Waerk,
  Land1,
  Ort01
}

NB! Please, pay attention that the line "@AccessControl.authorizationCheck" has "#NOT_REQUIRED" value. The value should be necessarily changed so that it will meet the security needs of the company which data from SAP tables is used in SAP AC. "#NOT_REQUIRED" is used by me only in educational purpouses.