App running on multiple languages has different descriptions to be shown based on the user language. We use common key which will be same in all languages but description may differ based on user language. As shown in below example key are same in both the language but description differs.
There is a smartfilter with controlType as dropdownList and dispalyBehaviour as descriptionOnly for field “PO Type” in smartfilter bar.
To Show the value in dropdown we are having an entityset called “ POTypeSet” having two properties “POTypeKey” and “POTypeDesc”
We have used Common.ValueList in annotation for POType field of POHeader (main entity) to show entries for PO Type smartfilter dropdown. POTypeKey is used for Common.ValueListParameterInOut, and POTypeDesc for Common.ValueListParameterDisplayOnly. Since POTypeKey is Common.ValueListParameterInOut, it will be considered for all operations. It will show POTypeKey in drop-down when we select any value from drop-down and will show all the keys in drop-down instead of descriptions.
But we want to show POTypeDesc in drop-down. For showing description in drop-down we have to define text annotation (sap:text) for property POTypeKey in MPC_EXT class program of OData service.
After regenerating run time object, we can see sap:text=”POTypeDesc” for property POTypeKey of Entity “POType” in the metadata.
Now we can see description showing in smartfilter instead of key and when we select any POType description and press enter. It will send POTypeKey for the filter POType in payload.
In this way, we are able to show descriptions in smartfilter drop-down which would be language dependent and using key for filter operation which is common for all language.