cancel
Showing results for 
Search instead for 
Did you mean: 

SADL Model Type DDIC differ from expected type CDS

and23_julius
Participant

Dear SAP OData Experts,

I am trying to create an OData referenced from a CDS View with association

@AbapCatalog.sqlViewName: 'ZDDL_PO_DATA'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'PO Data with Association'
define view ZCDS_PO_DATA as select from ekko
association [1] to lfa1 as _ekko_lfa1
    on ekko.lifnr = _ekko_lfa1.lifnr 
association [*] to ekpo as _ekko_ekpo
    on ekko.ebeln = _ekko_ekpo.ebeln 
association [*] to eket as _ekko_eket
    on ekko.ebeln = _ekko_eket.ebeln
{
    key ekko.ebeln,
    ekko.lifnr,
    _ekko_lfa1, // Make association public
    _ekko_eket, // Make association public
    _ekko_ekpo  // Make association public
} 

Then I created an OData definition is SEGW, then right click on data model, then reference

Then I pick the CDS

What could be wrong? I searched that specific message in google but I can't find an exact match.

Best Regards

Andre Julius

Accepted Solutions (0)

Answers (2)

Answers (2)

pmhatre
Explorer

Generally, when we want to consume CDS as a reference data source in an Odata service, it expects the target association entity to be a CDS entity and not a DDIC entity. For the above issue, you can wrap the tables lfa1, ekpo and eket into a custom basic interface CDS view and then use it.

CDS View for Item Data (EKPO)

@AbapCatalog.sqlViewName: 'ZDDLPOITMDATA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'PO Item Data'
@VDM.viewType: #BASIC
define view ZCDS_PO_ITM_DATA as select from ekpo {
    //ekpo
    key mandt,
    key ebeln,
    key ebelp,
    uniqueid
}

CDS View for Supplier Data (LFA1)

@AbapCatalog.sqlViewName: 'ZDDLSUPPLMDATA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Supplier Data'
@VDM.viewType: #BASIC
define view ZCDS_SUPPL_DATA as select from lfa1 {
    //lfa1
    key mandt,
    key lifnr
}

CDS View for Scheduling Agreement Schedule Lines

@AbapCatalog.sqlViewName: 'ZDDLSCHLN'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Scheduling Agreement Schedule Lines'
@VDM.viewType: #BASIC
define view ZCDS_SCH_AGR_LN as select from eket {
    //eket
    key mandt,
    key ebeln,
    key ebelp,
    key etenr
}

ZCDS_PO_DATA:

@AbapCatalog.sqlViewName: 'ZDDL_PO_DATA'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'PO Data with Association'
define view ZCDS_PO_DATA as select from ekko
association [1] to ZCDS_SUPPL_DATA as _ekko_lfa1
    on ekko.lifnr = _ekko_lfa1.lifnr 
association [*] to ZCDS_PO_ITM_DATA as _ekko_ekpo
    on ekko.ebeln = _ekko_ekpo.ebeln 
association [*] to ZCDS_SCH_AGR_LN as _ekko_eket
    on ekko.ebeln = _ekko_eket.ebeln
{
    key ekko.ebeln,
    ekko.lifnr,
    _ekko_lfa1, // Make association public
    _ekko_eket, // Make association public
    _ekko_ekpo  // Make association public
} 

Now when you go to SEGW and add reference data source in Data Model of ODATA service, the following Entities will be displayed in the wizard.

sas3
Explorer
0 Kudos

I faced exactly the same issue and wrapped the DDIC entity i.e. sbook in my case in a CDS view. That resolved the error messages. I believe the SADL model expects CDS as all it's entities and not DDIC objects.