Skip to Content
-1

What's the common point between Filtering an OData Collection and SAP_ALL ?

Dec 04, 2017 at 03:26 PM

59

avatar image

Hey dear experts,

It could be the beginning of a bad ABAP developper's joke but no, I mean I am very serious.

Here is my landscape:

  1. SAPUI5 application hosted on SCP
  2. SAP Cloud Connector tunneling Cloud <=> Gateway
  3. NW Gateway exposing OData services
  4. SAP ECC backend

We use Principal Propagation in order to authenticate Cloud Users against our SAP ECC system.

This is the interesting part... Here is my SAPUI5 code on my XML View :

<Table items="{
		path: '/CustomerMasterSet',
		sorter: {
			path: 'CustomerName',
			descending: false
		},
		filters: [{ path: 'MyCustomerField', operator: 'EQ', value1: 'ZPAR'}]
}">

Nothing special, I just filter my collection against a constant value.

My ECC User has the SAP_ALL assigned profile. On my Gateway system, I now trace the request for my specific user, and here is what I get :

--batch_da0c-86c8-c9e8
content-type: application/http
content-transfer-encoding: binary


GET CustomerMasterSet?$skip=0&$top=20&$orderby=CustomerName%20asc&$filter=MyCustomerField%20eq%20%27ZPAR%27 HTTP/1.1
sap-contextid-accept: header
Accept: application/json
Accept-Language: fr-FR
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
sap-cancel-on-close: true




--batch_da0c-86c8-c9e8-- 

Notice how the value is passed with %27 URI encoding the single quote character. And everything goes fine on my app. The CustomerMaster Collection returns item as supposed.

Now I remove the SAP_ALL from ECC User, and here is what I get in my /IWFND/TRACES

--batch_abbb-1e52-25d7
content-type: application/http
content-transfer-encoding: binary

GET CustomerMasterSet?$skip=0&$top=20&$orderby=CustomerName%20asc&$filter=MyCustomerField%20eq%20ZPAR HTTP/1.1
sap-contextid-accept: header
Accept: application/json
Accept-Language: fr-FR
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
sap-cancel-on-close: true

--batch_abbb-1e52-25d7-- 

No more %27 / single quote around my constant value... My /IWFND/ERROR_LOG throw now the error below :

Yes, 'ZPAR' is no longer considered as a constant value but as a property of my collection because the single quotes vanished...

I am like "What the hell is going on ?"

Doesn't it sound weird to you :) ?

Thank you,

Olivier

error-log.png (3.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Olivier Souksamran Dec 05, 2017 at 12:51 PM
0

Dear Iftah,

Thank you for your reply.

Actually, I figure it out but still can't explain this behaviour.

It seems that it was an authorization issue, as SAP_ALL profile let us know... I had to assign the standard role SAP_BC_WEBSERVICE_CONSUMER to the user so the metadata of the service could be accessed by the SAPUI5 application. And then everything is fine.

Still, I can't understand how a constant value or string passed through an object Filter can either be considered as a string value or as a property of the entity... SAPUI5 engine is a complex thing...

Thanks

Share
10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Dec 05, 2017 at 08:27 AM
0

Hey,

Very weird indeed. A few questions:

  • All you did is to remove SAP_ALL? What you gave/assigned instead?
  • What happens when you double quote a single quote Like so ' ' ZPAR ' '? When you use double quotes like so "ZPAR"?
  • What happens when you take it from some var, like i18n, something like this {i18n>value1}?
  • Are you the only one coding/working on this? Did you submit (checked out) your project again after changes?
  • Did you clear the cache and browser data of that user?
  • What happens when you read for that user without a filter? What happens when you return it after you removed it?
Share
10 |10000 characters needed characters left characters exceeded