Skip to Content
avatar image
Former Member

odata service in SEGW with CDS service

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')

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 02, 2017 at 10:41 AM

    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

    Add comment
    10|10000 characters needed characters exceeded