cancel
Showing results for 
Search instead for 
Did you mean: 

OData entity association from CDS view : CX_SADL_CONTRACT_VIOLATION

Louis-Arnaud
Participant
0 Kudos

Hello,

I created an OData service using SEGW and CDS view thanks to this excellent blog :

Everything works fine and I really apreciate building OData service with all the sorting and filtering options automatically generated.

Although I face a problem when I am using CDS and associations. It doesn't work and I get this error :

CX_SADL_CONTRACT_VIOLATION

Entity ' BSA_CARACTERISTICSSET_MATERIALSSet ' was not found

I created a MATERIALS entity, with entityset MATERIALSSet and mapped to a CDS view ZV_MATERIALS_ASSO which have an association to CDS view ZV_MAT_CARAC.

I created a CARACTERISTICS entity, with entityset CARACTERISTICSSet and mapped to CDS view ZV_MAT_CARAC.

I created an association in segw from materials to caracteristics.

Everything works fine until I mapped the segw association to CDS association like explain in this thread . Then I get this error CX_SADL_CONTRACT_VIOLATION when I request MATERIALSet or CARACTERISTICSSet.

I have the feeling that it is a bug from standard SAP, but maybe there is a special way to build these associations using SEGW and CDS ? Why is it looking for BSA_CARACTERISTICSSet_MATERIALSSet ? What is this entityset ?

If there is no solution, I am open for another way to build oData service easily because coding all filters and sorting properties are very time consuming...

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

arshad_ansary2
Active Participant
0 Kudos

Hi

The cx_sadl_contract_violation normally occurs when your CDS views has some parameters and you are not setting the parameters in SET_QUERY_OPTIONS method of SADL interface.

But can you elaborate on the query that you are firing ..?

Moreoover you can put a break point in CL_SADL_SQL_STATEMENT=>EXECUTE_CLIENT_SPECIFIED method which actually runs the native SQL query and see where its getting wrong

BR

Arshad

Louis-Arnaud
Participant
0 Kudos

I think that this problem was due to CDS parameter (I add language parameter to the view). What I don't understand is that for some CDS view it works but not for all.

I corrected this problem by removing the parameter and hard code the language...

Answers (0)