cancel
Showing results for 
Search instead for 
Did you mean: 

$expand on Entityset fails

Former Member
0 Kudos

I have created a Gateway service with a number of links, associations and navigations.

There are three entities which are interconnected:

  • Companies
  • Brands
  • Products

This is hierarchical: Companies can have sub-companies, companies have brands, brands have products.

I have implemented the associations and navigations between these things.

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

So what is the error/ problem?

Former Member
0 Kudos

SCN posted this before I was finished (dam Ctrl+S posting messages!) and now won't let me edit the message.

I have set up one lot of expands which work fine, but Brands to Products will not let me $expand... but the navigation works fine!

Is there something I need to set up which will make the $expand work?

kammaje_cis
Active Contributor
0 Kudos

If the target cardinality is '1', then you need get_entity of 'Products' implemented. 

If the target cardinality is 'N', then you need get_entityset of 'Products' implemented.

Former Member
0 Kudos

Yes, I have set up the target as N, and implemented all methods.

When I make the call .../Brands('<key>')/Products for all the brand keys it works fine.

But then if I change this to read .../Brands?$expand=Products the call never reached any of my DPC_EXT methods, or even the high level GET_ENTITYSET, GET_EXPANDED_ENTITYSET, GET_ENTITY, GET_EXPENDED_ENTITY..

It is failing before it reaches the method calls which implied to me that it is an issue in the metadata somehow... I have used the service builder, is there a tick-box I'm missing?

kammaje_cis
Active Contributor
0 Kudos

Hope 'Products' is the name of your navigation as well. This navigation should have target as 'Product' entity.

What is the error message you get in browser?

Former Member
0 Kudos

Yes the navigation is called Products, hence why the navigation .../Brands('<key>')/Products is working fine. just the expand is not - which should use all the same methods as the navigation.

The error message is "In the context of data services and unknown internal server error has occurred", which I've seen on a number of occasions for various different things.

kammaje_cis
Active Contributor
0 Kudos

may be you need to look into error log transactions to get specific messages.

Try at /iwfnd/error_log and /iwbep/error_log

Former Member
0 Kudos

Thank you, this looks like a more helpful error message - I am investigating this now

Thanks!

Former Member
0 Kudos

Thank you, this gave me a better error which I have managed to use to resolve the issue, however I am slightly confused why it was an error.

For interest the error I was getting was: Multiple Specifications of the Name 'PRODUCTS' as a Component Name (Component 10)

kammaje_cis
Active Contributor
0 Kudos

Never heard this error before. How did you resolve this?

Former Member
0 Kudos

It turns out there is a property of my Brands entity which is called "PRODUCTS" and it was confused about which "Products" I was refering too. Which is still odd, because you can't do an expand on the property of an entity, but at least it was fixed by changing the navigation name

Much appreciate your help, thank you!

Former Member
0 Kudos

Hi Lindsay,

If you had directly modelled such a hierarchy in SEGW, e.g. entity name is 'Object' and a property in that entity is called 'Object', the design time checks won't allow it.

I’m pretty sure that when you expand something, the same rules apply, as a temporary metamodel for the data has to be assembled. However, this is a runtime exception caused by you invoking an $expand, so the conflict cannot be anticipated at design time. Hence you get the runtime error.


I'll admit I would not have looked for this as a runtime error, but once the message ' Multiple Specifications of the Name 'PRODUCTS' as a Component Name (Component 10)' appeared it does indicate the naming conflict.

Similar rules apply to other development areas, like Web Dynpro contexts.


One to remember, as it probably won't occur often and the only way you can protect against this as a runtime error is to desk-check all the model property names.


Cheers


Ron.

Former Member
0 Kudos

Hi Ron,

Yeah I had modeled my service in SEGW, and my object BRANDS had a property PRODUCTS. But there was also another object PRODUCTS. Which I assume was why it was having difficulties. By changeingthe BRANDS entity attribute from PRODUCTS to BPRODUCTS it fixed it.

I don't think there are checks in SEGW to see if you have named an attribute of an entity the same a another entity name, but it does look like this is only an issue if you then try to expand on that second entity - so I guess it can't be raised as a design-time issue.

Glad it's resolved, and certainly one to remember for next time

Thanks for your input, I didn't know there were similar issue with web dynpro so I will keep this info for later

Answers (0)