cancel
Showing results for 
Search instead for 
Did you mean: 

Emd.DateTime used as key in URI problem

Former Member
0 Kudos

Hello Experts,

we have a problem while using a Edm.DateTime as key in URI while sending GetEntity request to the GW Server.

We've defined a Edm.DateTime field in the Service builder as a key for an entity. While calling GetEntitySet operation, we can get the data correctly. The GW server generates also URI for it.

- <entry>

d

<id>http://myserver:8000/sap/opu/odata/CONET/IMMOBILIENVERTRAG_SRV/RealEstateContractConditionSet(CONDIT...')</id>

<title type="text">RealEstateContractConditionSet(CONDITION_TYPE='0010',VALID_FROM=datetime'2012-01-01T00%3A00%3A00',IDENT_KEY='1000%2F1000000',OBJECT_TYPE='IS')</title>

<updated>2014-09-12T11:21:43Z</updated>

<category term="IMMOBILIENVERTRAG_SRV.RealEstateContractCondition" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

<link href="RealEstateContractConditionSet(CONDITION_TYPE='0010',VALID_FROM=datetime'2012-01-01T00%3A00%3A00',IDENT_KEY='1000%2F1000000',OBJECT_TYPE='IS')" rel="self" title="RealEstateContractCondition" />

- <content type="application/xml">

- <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">

<d:CONDITION_TYPE>0010</d:CONDITION_TYPE>

<d:EXTERNAL_PURPOSE>A</d:EXTERNAL_PURPOSE>

<d:CALC_RULE>D</d:CALC_RULE>

<d:UNIT_PRICE>6</d:UNIT_PRICE>

<d:VALID_FROM>2012-01-01T00:00:00</d:VALID_FROM>

<d:VALID_TO>9999-12-31T00:00:00</d:VALID_TO>

<d:IDENT_KEY>1000/1000000</d:IDENT_KEY>

<d:Status />

<d:XCONDTYPEM>Basic rent</d:XCONDTYPEM>

<d:XMCONDPURPOSEEXT>Actual Rent</d:XMCONDPURPOSEEXT>

<d:XMCALCRULE>Object Measurement</d:XMCALCRULE>

<d:OBJECT_TYPE>IS</d:OBJECT_TYPE>

</m:properties>

</content>

</entry>

- <entry>

The problem is, when we use this URL  http://myserver:8000/sap/opu/odata/CONET/IMMOBILIENVERTRAG_SRV/RealEstateContractConditionSet(CONDIT...')

in the GW client, we got always a error:

Invalid format (return structure): Property Name 'VALID_FROM',  Property Value '00000000'.

Meanwhile, in another project, we use an Edm.DateTime field as a filter parameter to select a range of values. It works very well.Here is the URL:

/sap/opu/odata/CONET/IMMOBILIENGEBUILDING_SRV/RealEstateBuildingSet?$filter=Responsible eq 'Kugelberg' and Stichtag eq datetime'2013-01-01T00:00:00'

We are really confused with the behavior of the GW runtime.

BTW: in the error log, we found out that the error occurs in the /IWCOR/CL_DS_EP_WRITER_XML Class, method: WRITE_ENTITY_PROPERTIES, row: 55.

Appreciate a lot for any tips in advance.

best regards

Xiang

Accepted Solutions (1)

Accepted Solutions (1)

former_member192050
Participant
0 Kudos

Hi Xiang,

Invalid format (return structure): Property Name 'VALID_FROM',  Property Value '00000000'.


as u mentioned above is the error and the problem would be the returning structure getting data as '00000000'.i.e the parameter has no value in it and the solution would be make 'VALID_FROM' as 'Nullable'.entity type's parametrs.


Regards,

Sathish

Former Member
0 Kudos

Hi Sathish,

As mentioned in my reply, this is not an option as key properties cannot be null. However I agree that this sounds more like a feed issue than a predicate parsing issue on the request.

Xiang, does the request actually reach the GET method for this entity? If it does, it's not the request handling, it's the response writer.

Is the GET logic identical to the logic you use to fill the collection members?  Since the collection part works, it doesn't make a lot of sense for the single entity to fail unless there is an error in how the response is built.

Obviously not having full access to the problem  I can only guess based on experience, but that's what I'd be checking first.

Regards

Ron.

former_member192050
Participant
0 Kudos

Hi Ron,

I am Not saying that the key property could be NULL,may be the other parameter of the structure is NULL because it may have Valid from,valid throw and created on so on

and in this case may be Valid from is not a key property

That was my point

Regards

Sathish

Former Member
0 Kudos

Sathish,

If you actually read Xiang's post, it clearly shows in the URI and correct response that 'VALID_FROM' is a key field and that the value in 'VALID_FROM' according to the GET_ENTITY error response is '00000000'. It's usually best to focus on known data than jump straight into speculation

Regards

Ron.

Former Member
0 Kudos

Thanks a lot, Ron.

We were wrong. We have supposed that the problem occurred before calling our GET-ENTITY method in the backend system. It occurs actually when the hub system transforms the response of backend into XML document. Just like you described.

The problem is an internal table contains a dummy line of data at the first row.

We also appreciate a lot for the help of Sathish.

best regards

Xiang

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Xiang,

This is an odd one, I agree.

The only scenario that fits in my mind is that for some reason the call to the GW client is not actually referring to the same data source. Do you by any chance have different clients in the instance? You may be reading the wrong client?

What seems to be happening is that the URI is pointing to what should be a valid resource. However, the GET logic is getting nothing for the date value. You can't define the date as not-null as it's a key as well, so if it was returned as null you'd get a property value range error - which you are.

You should consider debugging the GET method when called from GW client to ensure that data is returned in the entity feed.

GW client is a useful tool but it doesn't operate in a typical real-world fashion, so if you can test using an external REST client without issues I'd not worry too much.

Regards

Ron.

Former Member
0 Kudos

Hi Ron,

thanks a lot for your help. Actually, we've tested this problem in REST client in Firefox, Postman in Chrome and SAP Fiori framework and get the same error message.

From our point of view, the problem occurs while GW framework parses the URI keys on the hub system. We have activated debug mode on the hub system and watched the processing of all key predicates in this ABAP class /IWCOR/CL_DS_EP_WRITER_XML Class.

best regards

Xiang