on 10-06-2013 6:21 PM
Hi Experts,
I'm trying to make an association/navigation to another Entity, but this for a property without being marked as a key.
Example the EPM test service from http://scn.sap.com/docs/DOC-31221
The model: http://scn.sap.com/servlet/JiveServlet/showImage/102-44073-2-246387/Relationen.png
I already builded the SalesOrder association/navigation to the SalesOrderItem.
But I cannot seem to create the association/navigation from SalesOrderItem to the Product, in SEGW I always have to define the referential constraint with the key of the Entity. In SalesOrderItem, the productId property is not a key, and I can't imagine that I have to set it as a key.
Thanks in advance
Regards,
Wouter
Hi Wouter,
Are you familiar with key relationships in database terms? This is no different to that.
Only one side of this relationship needs to refer to an entity key and that is the Product side. On the other side, the key of this product is referenced by another entity, the SalesOrderItem; that side does not have to be a key value in the context of that entity (although it could be, that tends to be the case more when the target has a composite key).
There should be no problem in making this relationship.
Regards
Ron.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ron,
I succeed in making the relationship between SalesOrder and SalesOrderItem, but making the navigation/association between SalesOrderItem and Product is not working, please provide information how to do so if you know.
I used the ES1 demo service data model (but in ES1 SAP system it's not implemented in SEGW )
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/?sap-ds-debug=true
I imported this into my Eclipse GPA, exported it and imported it in SEGW.
After implementing the read and query operations the navigation from SalesOrder to SalesOrderItem worked, but the Product did not.
I suspect that this navigation needs some extra coding. If not please provide details how to do the mapping.
Greets,
Wouter
Hi Wouter,
You need some extra coding in the Product 'get entity set' method. To determine if this is a direct collection reference or a navigation to a collection, you can check if the navigation path table parameter has an entry in it - if it does, you need to find which navigation (there could be more than one to pick from, as a caller-client) is being requested.
You can find the context for 'navigating from' in the key table parameter, i.e. that should contain the key of the sales order item.
e.g. (not necessarily correct for ES1 in terms of names)
lt_nav_path = io_tech_request_context->get_navigation_path( ).
read table lt_nav_path into ls_nav_path with key nav_prop = SalesOrderItems'.
if sy-subrc = 0.
lt_key = io_tech_request_context->get_source_keys( )..
read table lt_key with key name = 'SoID' into ls_key.
lv_orderid = ls_key-value.
" ditto for position key.....
endif.
You can then use these two pieces of information to locate the product of the item.
Regards
Ron.
You create the navigation but without referential constraints.
When you implement the read_entity, you will see in the debugger that you have the keys available in the key table, and then it's your responsibility to code and retrieve the non-key relevant to those keys.
And then just fill up the entity structure ... the downside is that you have to code everything manual ...
So if you're designing everything with function module calls ( and mapping ), this is a small downside.
Regards,
Wouter
On a sidenote, i've also created the Entity Data Model in Eclipse with all associations and navigations (by importing SAP's ES1 test service for this), imported this in SAP SEGW, implemented the read and queries.
But when I try the product navigation, it goes into error with a "Internal error occurred, contact your system administrator." - /IWBEP/CX_MGW_TECH_EXCEPTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.