Skip to Content
1

Working with Bidirectional Associations in SAP Gateway

Nov 15, 2017 at 07:51 PM

49

avatar image

Hello fellow SAPers.

I have a question regarding to the use of bidrectional associations in SAP Gateway. We're using a Java program for Eclipse used to generate our Model, in which we have 3 entities that have a bidirectional association between them.

Once we export said model into our proyect, the association is only generated in one direction, for example:

The entities are:

- Payments

- Accounts

- Clients

The associations are generated from Clients to Accounts and then from Accounts to Payments, however we have a scenario where we have a payment ID and from there we want to get the info from the corresponding account and then the client for an expand operation, when testing the service the structure is generated correctly, however the information is not set accordingly into the Account and Payment structures in the service response.

The workaround I found was to generate the associations like this.

The imported model generated something like:

AccountPayments, where Accounts is the Principal entity and Payments is the dependant one, so I manually generated the association where Payments is the main Entity and Accounts is the dependant entity. With the relationship set in this way, the info is populated correctly for both Account and Payment entities in the response.

Question is, is this the correct approach for this issue, or is there something that I did wrong whilst designing the model or while importing it into the proyect?.

Without further ado, thank you all in advance.

10 |10000 characters needed characters left characters exceeded
Former Member

It is worth mentioning that using the MockServer from sapui5 with the original model, the bidirectional query works without problems. Any gateway expert could help us please?

Thank you very much in advance.

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers