on 2022 Sep 26 10:57 PM
Hello experts,
I have the following scenario:
ZEST_PO_H has a [1..*] association to ZTEST_PO_I named _ZTEST_PO_I
and ZTEST_PO_I has a [0..*] association to ZTEST_PO_ACCT named ZTEST_PO_ACCT
Associations are made public in each CDS view.
CDS view ZTEST_PO_H has annotation @Odata.publish: true and then published via tx /iwfnd/maint_service
However, when I check the service metadata, I can see the association from ZEST_PO_H to ZTEST_PO_I, but I can't see association from ZTEST_PO_I to ZTEST_PO_ACCT
CDS ZTEST_PO_H:
@AbapCatalog.sqlViewName: 'ZTESTPO_H'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@EndUserText.label: 'Purchase orders header'
@OData.publish: true
define view ZEST_PO_H as select from ekko
association [1..*] to ZTEST_PO_I as _ZTEST_PO_I
on $projection.ebeln = _ZTEST_PO_I.ebeln {
key ebeln,
bukrs,
bstyp,
bsart,
_ZTEST_PO_I // Make association public
}
CDS ZTEST_PO_I
@AbapCatalog.sqlViewName: 'ZTESTPO_I'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purchase orders items'
define view ZTEST_PO_I
as select from ekpo
association [0..*] to ZTEST_PO_ACCT as _ZTEST_PO_ACCT on $projection.ebeln = _ZTEST_PO_ACCT.ebeln
and $projection.ebelp = _ZTEST_PO_ACCT.ebelp
{
key ebeln,
key ebelp,
matnr,
txz01,
_ZTEST_PO_ACCT // Make association public
}<br>
CDS ZTEST_PO_ACCT
@AbapCatalog.sqlViewName: 'ZTESTPO_ACCT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purchase orders account assignment'
define view ZTEST_PO_ACCT as select from ekkn {
key ebeln,
key ebelp,
key zekkn,
loekz,
aedat,
sakto,
gsber,
kostl,
menge
}<br>
Service Metadata:
<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="http://server:port/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='')/$value"><br> <edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common" />
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="http://server:port/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CAPABILITIES',Version='0001',SAP__Origin='')/$value"><br> <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities" />
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="http://server:port/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMUNICATION',Version='0001',SAP__Origin='')/$value">
<edmx:Include Namespace="com.sap.vocabularies.Communication.v1" Alias="Communication" />
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="ZEST_PO_H_CDS" xml:lang="es" sap:schema-version="1">
<EntityType Name="ZEST_PO_HType" sap:content-version="1">
<Key>
<PropertyRef Name="ebeln" />
</Key>
<Property Name="ebeln" Type="Edm.String" Nullable="false" MaxLength="10" />
<Property Name="bukrs" Type="Edm.String" MaxLength="4" />
<Property Name="bstyp" Type="Edm.String" MaxLength="1" />
<Property Name="bsart" Type="Edm.String" MaxLength="4" />
<NavigationProperty Name="to_ZTEST_PO_I" Relationship="ZEST_PO_H_CDS.assoc_A6054CEA8A7905CC6874E93D21AD8038" FromRole="FromRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" ToRole="ToRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" />
</EntityType>
<EntityType Name="ZTEST_PO_IType" sap:content-version="1">
<Key>
<PropertyRef Name="ebeln" />
<PropertyRef Name="ebelp" />
</Key>
<Property Name="ebeln" Type="Edm.String" Nullable="false" MaxLength="10" />
<Property Name="ebelp" Type="Edm.String" Nullable="false" MaxLength="5" />
<Property Name="matnr" Type="Edm.String" MaxLength="40" />
<Property Name="txz01" Type="Edm.String" MaxLength="40" />
</EntityType>
<Association Name="assoc_A6054CEA8A7905CC6874E93D21AD8038" sap:content-version="1">
<End Type="ZEST_PO_H_CDS.ZEST_PO_HType" Multiplicity="1" Role="FromRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" />
<End Type="ZEST_PO_H_CDS.ZTEST_PO_IType" Multiplicity="*" Role="ToRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" />
</Association>
<EntityContainer Name="ZEST_PO_H_CDS_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
<EntitySet Name="ZEST_PO_H" EntityType="ZEST_PO_H_CDS.ZEST_PO_HType" />
<EntitySet Name="ZTEST_PO_I" EntityType="ZEST_PO_H_CDS.ZTEST_PO_IType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1" />
<AssociationSet Name="assoc_A6054CEA8A7905CC6874E93D21AD8038" Association="ZEST_PO_H_CDS.assoc_A6054CEA8A7905CC6874E93D21AD8038" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="ZEST_PO_H" Role="FromRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" />
<End EntitySet="ZTEST_PO_I" Role="ToRole_assoc_A6054CEA8A7905CC6874E93D21AD8038" />
</AssociationSet>
</EntityContainer>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="self" href="http://server:port/sap/opu/odata/sap/ZEST_PO_H_CDS/$metadata" /><br> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="latest-version" href="http://server:port/sap/opu/odata/sap/ZEST_PO_H_CDS/$metadata" /><br> </Schema>
</edmx:DataServices>
</edmx:Edmx><br>
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm guessing what you "made public" is just _ZTEST_PO_I, not everything that's included in it. If we have "nested associations", it doesn't mean that creating OData service automatically exposes the whole "association tree".
Try Google -> CDS view nested associations OData
I'm pretty sure this is also covered in documentation, probably not as easy to find though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
52 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.