Dependent Search Help With OData Annotation for Fiori
Sometimes, there are requirements in which user has to gives input in one smart field and depending on the value provided on the first field, we have to restrict the search help of another filed. It is a scenario where there is need of dependent search help. One such requirement comes to me also, i have created a dependent search help with the help of vocabulary based annotation in OData.
Here, In this article first part show what is achieved as a dependent search help and second part will show what have done in OData part.
Let take an example in which based on input of MODEL, values should appear on the search help of UNIT field. MODEL and UNIT are just two input filed for example here.
Now,value help will appear for model and i have searched any value:
Based on the input of model , values of the unit should come:
Prerequisite: Here, i am considering that you already know how to create value help with OData. However, if you don’t have any knowledge regarding value help with annotations you can go through this link:
Annotation to create value list for any property in entity type is:
In my entity set, I have these two values for which i have created value list:
Now, go to the common.v1 annotation for MATNR_LO. Here while providing parameters for the value help, do such addition also:
That’s only addition you have to do while creating value list in OData, just only gave the path of the dependent field.
After this, just create value list for dependent field, in our case which is SERNR_LO(UNIT). Just provide path of respective field . No need to provide path of main header field in our case which is MATNR_LO(MODEL).It automatically take value for that.
Just by doing some simple addition in value list annotation of the fields. we can easily create dependent value help or search help in our fields of FIORI application.There can be many other method to obtain this results ,but this is one of the method i have applied and found worth to share .