cancel
Showing results for 
Search instead for 
Did you mean: 

Can an OData Service save the value of a selection?

GabrielGomezPad
Participant
0 Kudos

Hello Experts,

My current question is more like a conceptual question. SAPGateway delivers an OData service with an entity type containing the following Properties:

  • ATNAM
  • ATWRT
  • ATWTB

The values of this entityset do never change and are as follows:

ATNAM

ATWRT

ATWTB

FIORI_PRG

BA

Barcelona

FIORI_PRG

BE

Berlin

FIORI_PRG

HA

Havanna

FIORI_TYP

SE

Sessel

FIORI_TYP

ZW

Zweisitzer

FIORI_TYP

DR

Dreisitzer

FIORI_FARBE

BL

Blau

FIORI_FARBE

BR

Braun

FIORI_FARBE

GR

Grün

FIORI_FARBE

SW

Schwarz

FIORI_BEZUGSSTOFF

ST

Stoff

FIORI_BEZUGSSTOFF

KL

Kunstleder

FIORI_BEZUGSSTOFF

NL

Naturleder

In UI5-Frontend, the data is consumed in different lists that filter the values of the property ATNAM and display accordingly the values of ATWTB just like you can see it in here: JS Bin - Collaborative JavaScript Debugging

Now the question: is it possible for this OData service to “be informed” of the selected value from any of these lists?  (assuming that UI5 can send a value).

Clarification: the service has only the get and getentityset methods redefined.  Or same question formulated differently: can the OData service save the result of a selection of a filtered list?

If someone wants to take a look at the metadata, the file can be seen in:  https://goo.gl/pAE4qz

Thank you very much for your support,

Gabriel

Accepted Solutions (1)

Accepted Solutions (1)

former_member388328
Active Contributor
0 Kudos

Hi Gabriel,

I did not get you. let me explain what i understood. you have field in the UI. Which is drop down list, Let us say from example list contains ,1,2,3,4,5. Now if select 1,  Odata should be able to post this.

is this what you are looking for ? Or Can explain us what you are expecting once more.

Thanking you

Vengaiah

GabrielGomezPad
Participant
0 Kudos

Thank you very much Vengaiah for your answer. You understood right. OData should post this, but the values delivered by Odata are never supposed to change (because are options that user should choose, but not edit).

What I am looking for?

I am expecting that OData delivers some values based on a previous selection. Graphically seen: there are four drop down lists.  After selecting "Barcelona" in the first list and "Sessel" in the second one, then the OData delivers one particular value in the third list (for instance "Blau").

My question is: how can this OData obtain the selected value of user under described conditions (no create/update methods are redefined and no additional field to send the selection). Is it even possible?

Thank you and kind regards,

Gabriel

former_member388328
Active Contributor
0 Kudos

Hi Gabriel,

Can't you redefine the update method.

Thanking you

Vengaiah

GabrielGomezPad
Participant
0 Kudos

Hello Vengaiah,

I did not get you. Let me explain what i understood:  is not possible because update method is not redefined.

Correct?

Thanking your support,

Gabriel

former_member388328
Active Contributor
0 Kudos

Hi Gabriel,

You redefine the update method and write the code. and at same time extend the UI and send a update request to the odata.

I hope you got it now.

Thanking you

Vengaiah

GabrielGomezPad
Participant
0 Kudos

Hello Vengaiah now is perfecly clear. I will try it this week and get back with the results to this post. Thank you for your support,

Kind Regards,

Gabriel

GabrielGomezPad
Participant
0 Kudos

Thank you Vengaiah,

indeed to be able to modify any Value, the Update_method is need. But still the problem does not requests to modify any value, but indicate the value that has been selected.

Kind Regards,

Gabriel

former_member388328
Active Contributor
0 Kudos

Hi Gabriel,

Can you please explain your problem with a example. I did not get you..

Thanking you

Vengaiah

GabrielGomezPad
Participant
0 Kudos

Hello Vengaiah and I apologize for the delay to answer. The Odata Service delivers the values described.  Those values are used in the UI for displaying options to choose (like in this bin).

My question: how the UI can transmit the result of a selection to this Odata service? I understand is not possible because This OData has not update-method available and also because this values are not supposed to be edited (only the result of the choice is to be transmitted).

Your answer helped me to understand I was requesting something that is not possible. Thank you again and kind regards,

Gabriel

former_member185414
Active Contributor
0 Kudos

Hello Gabriel,

I think you need code dependent filters. What I understand is, suppose you have two items in a facet filter, say state and city and you want to filter the list of cities based on the currently chosen state. If its so, then it is very much possible.

You can implement a Function Import in OData and call it when the first value is selected. In the function import, you send a read request to the collection for second list passing the value of first selection as the filter parameter and you will get the results with which you should do the binding.

Alternatively, you can simply call the Get Entityset method of the second collection passing the chosen value as filter.

BR.

GabrielGomezPad
Participant
0 Kudos

Thank you Ankit, this is exactly what I meant. Is there any technical help or documentation for dependent filters?

former_member185414
Active Contributor
0 Kudos

Hello Gabriel,

As suggested, you can implement a Function Import (passing the first filter as importing parameter and returning the dependent entity's table type) and call the same on the list close event of the facet filter. In the Function Import you can write a select query where you use the importing value in the where clause of the filter and export the table with second dependent entity. Then do the binding in the UI with the result set returned by the function import.

Function Import  - https://help.sap.com/saphelp_nw74/helpdata/en/c5/dc22512c312314e10000000a44176d/content.htm

Example -

BR.

GabrielGomezPad
Participant
0 Kudos

Thank you

Answers (0)