cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fetching text from API_PRODUCT_SRV - Filter/key not working in Abap cloud call

LaurensSteffers
Participant
0 Likes
1,601

Hi all,

I hope you can help. We are currently calling an API from our s4hana public cloud stack (s4pc), uhm, within the same system. Reason is simple: not all cds views provide the correct functionality and with longtext.....well, you have to go to the api side.

We are able to determine the api path and actually call the api to fetch data, but somehow the filtering does not work correctly, in fact, the provisioning of a key doesn't work. 

To give you an idea of the code which actually works when we use the api.sap.com and tryout option:

/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductBasicText?$filter=Product eq '3'

this results in:

sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductBasicText?$filter=Product%20eq%20%273%27

and that results in:

LaurensSteffers_0-1718377453616.png

Now, when we actually call this in abap cloud, the filter is not taken into account. The result is this no matter which filter we pass in the query (random examples of things I tried):

lo_request->set_query( query = '?$filter=(Product eq ''3'')&$format=json' ) (3 has like 4 single quotes)

?$filter=Product eq '3'

DATA(query) = |(Product='3',Language='EN')&$format=json|.

LaurensSteffers_1-1718377640583.png

So, we tried the different things we could find on tryout, documentation etc, but no application of the filter. 

It always returns the full set of available text without the filter being applied. I tried everything to copy the filter but no results.

The service url it determines based on the comm system/arrangement etc, is this. It does work otherwise we would not get any result.

LaurensSteffers_2-1718377843345.png

But the problem is that no matter what, the filter is not taken into account. 

In all honesty, I would rather pass the full key so it would look like this, but can't get it to work with the set_query. Any help in that area would be great! 

 

sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductBasicText(Product='3',Language='EN')

We tried to contact (Product='3', Languate='EN') and pass this to the set_query, but that doesn't work. Replacing it using 'eq', doen't work.

Hope you have some ideas!

All the best

Laurens

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

LaurensSteffers
Participant
0 Likes

Hello Enda,

thanks for the reply. Well, in fact we are calling it through an application (eclipse in this case), but the filter just does not work. Would you be able to provide a contact who has done something like this before?

Kind regards and all the best

Laurens