cancel
Showing results for 
Search instead for 
Did you mean: 

GET_ENTITY with several key fields

Former Member
0 Kudos

Hi,

in my entity model, the entity (e.g. MyEntity) consists of two key fields instead of one.

How do I have to call the URI for a entity set with 2 key values in order to receive one entity (MyEntity is the entity and MyEntityCollection is the set of MyEntity) using the service sap/opu/odata/sap/Ztest_srv/MyEntityCollection but without using an additional filter?

E.g. something like sap/opu/odata/sap/Ztest_srv/MyEntityCollection('..<key1>..', '..<key2>..')?

The idea is to get the corresponding internal array it_key_tab filled automatically.


Yours

Stephan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

I have found the issue. I'm currently using NW 7.02 Trial version with SAP Gateway. There is an internal errror in the generation of model classes which will be created automatically.

In my case, ZCL_XXX_MPC->DEFINE_<my entity> has not defined correctly all key properties with the statement lo_property->set_is_key( ). I have fixed this error in SE80 and now I can use several key fields of the entity set like the following:

sap/opu/odata/sap/Ztest_srv/MyEntityCollection(key1='<value of key1>',key2='<value of key2>')

Additionally, I have reset the model caches (/IWFND/CACHE_CLEANUP and /IWBEP/CACHE_CLEANUP) and used the Gateway client (/IWFND/GW_CLIENT) in order to chec the metadata. The metadata is now displaying the <key> properties within <EntityType> segment.

This bug fixing has to be repeated each time the model will be re-generated within SEGW.

Answers (0)