cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when using association in SADL-based mapping project in SEGW

0 Kudos

i SAP experts,

I am currently developing a project in SAP gateway (SEGW) where entities are mapped directly from DDIC structures (namely, tables VTBFHA and VTBFHAPO). Therefore direct mapping of these entities in SEGW projects allows the usage of SADL-based CRUDQ operations. Mapping from both entities work isolately but when using SEGW-created associations, (when debugging I think that) it cannot find the corresponding association and hence exception CX_SADL_CONTRACT_VIOLATION is thrown. This is the first time I map DDIC structures directly to SAP SEGW projects so i'm a little confused on what's happening.

Entities are mapped from such structures as shown below:

The relationship between "Contrato" and "MovimentoFinContrato" (highlighted in yellow) is defined as below.

And referential constraints are as follows:

where both "empresa" and "contrato" are properties belonging to both entities (both also being keys for these entities). I have mapped the "get entityset" methods from both entities and they work like a charm separatedely.

The problem is when using $expand to retrieve data from the dependent entitiy for each row in the entity set retrieved in the main entity's "get entityset" method:

''/ContratoSet?$filter=produto eq 'A01' and dataCriacao ge datetime'2019-01-18T00:00:00' and dataCriacao le datetime'2019-02-18T00:00:00'&$expand=MovimentoFinContratoSet'' is then the executed query which triggers the following error message:

Where "MovimentoFinContratoSet" si the navigation property created along with the association for the entity "Contrato" as follows:

By debugging, i discovered that the "get entityset" for the main entity (as if the query was not executed with "$expand=MovimentoFinContratoSet" works fine, the problem happens right after it, more exactly when reaching class "CL_SADL_COND_PROV_NAVIGATION" in method "get_cross_sadl_nav_elem_map" as below:

The table denoted by "ir_source_entity_load->sadl_entity-associations" is empty, which triggers the exception being thrown. I am a little bit lost as i don't know what is quite wrong with the asociation. I do however noticed that SADL-based services can make use of already existing relationships from SAP DDIC objects as it can be seen in SE11 transaction. There is a proper place in SADL mapping which enables such usage.


which lets one to see relationships considering columns from VTBFHA (the primary mapped entity "contrato") to other SAP DDIC tables. I don't know whether the error is being caused because this is empty. Does SADL services not enable the usage of SEGW defined associations?

Any pointers are greatly apreciated.

Thanks in advance,

Erick.

Accepted Solutions (0)

Answers (2)

Answers (2)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

On which SAP NetWeaver release is your backend running?

740, 750 or higher?

I have not seen that you have created CDS views. This you should do and depending on your release you should use the following approaches that are described here:

https://help.sap.com/doc/saphelp_nw751abap/7.51.0/en-US/ed/2ed4e2cbc54ffdba3aead4f3a73640/frameset.h...

740 : Mapped Datasource Approach

750 or higher: Referenced Data Source Approach

Regards,

Andre

0 Kudos

Hi Andre,

It is running on 750.

Regards,

Erick.

edit. just saw the link you posted. Seems that this approach will solve the problem. Thanks! I'll report back as soon as I implement it this way

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
0 Kudos

Hi Andre,

Once again, thanks for your response.

By means of CDS views, this works. Does it mean that associations, as defined in gateway SEGW transaction, will no longer be supported when mapping ABAP structures (such as DDIC tables, where its services are defined by means of SADL) as entities? Although such associations still work when mapping RFC interfaces.

Regards,

Erick.