cancel
Showing results for 
Search instead for 
Did you mean: 

odata service in SEGW with CDS service

Former Member
0 Kudos

I am trying to create simple odata service which contains two entities:

1) MAIN - CDS from table CRMD_ORDERADM_H



@AbapCatalog.sqlViewName: 'Z_MAIN'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Z_MAIN'
define view Z_MAIN_CDS as select from crmd_orderadm_h as MAIN
association [0..1] to z_link as LINK on MAIN.guid = LINK.guid_hi {
    key MAIN.guid,
    MAIN.object_id,
    @ObjectModel.association.type: #TO_COMPOSITION_CHILD LINK[inner]
}

2) LINK - CDS from table CRMD_LINK

@AbapCatalog.sqlViewName:'Z_LINK'
@AbapCatalog.compiler.compareFilter:true
@AccessControl.authorizationCheck:#CHECK
@EndUserText.label:'LINK'
define view Z_LINK_CDS as select from crmd_link {
    key crmd_link.guid_set,
    crmd_link.guid_hi,
    crmd_link.objtype_set
}

Than I go to SEGW transaction and create simple service, import this two this CDS services and map all fields of them. I register this service and test it. This worls perfectly.

But whe I add association and map it in the MAINSet and try to create runtime object, i get this error. please help me deal with it!

Mismatch of target 'LINKSet' and binding of association 'MAINSet1', since the target and binding does not result in same core-BO node (fragment 'Z_MAIN_LINK')

Accepted Solutions (0)

Answers (1)

Answers (1)

Sean_Zhang
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

If you want to create OData based one well defined CDS, you could use another way by reference CDS.

once you create your OData model, you could use the reference data source of the model, then you could select the CDS you created.

follow the screenshot.

you could just import the root CDS, then the association could also be imported.

Best Regards,

Sean