0
votes

I'm having trouble creating a value list for a field in the smart filter bar of a smart table.

I have an entity set ApplicationsOverviewItemSet with the following entity type definition in SEGW: Definition of entity ApplicationsOverviewItemSEt The smart table has to display this entity set's data. In its smart filter bar I'd like there to be a value list for the statute property. I defined another entity set called ApplicationStatuteSet with this SEGW entity type definition: Definition of entity ApplicationStatute This entity set should be a list of possible statute values and their descriptions. I implemented its GET method in the extended data provider class, making sure to support all pagination query options ($top, $skip and $inlinecount). A basic GET query of the entity set now returns the following data in JSON format:

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://WEBWSD.<my company>:443/sap/opu/odata/sap/ZC_AD_SCHOLAR_SRV/ApplicationStatuteSet('007')",
                    "uri": "https://WEBWSD.<my company>:443/sap/opu/odata/sap/ZC_AD_SCHOLAR_SRV/ApplicationStatuteSet('007')",
                    "type": "ZC_AD_SCHOLAR_SRV.ApplicationStatute"
                },
                "STATUTE": "007",
                "DESCR": "Visiting scholar"
            },
            {
                "__metadata": {
                    "id": "https://WEBWSD.<my company>:443/sap/opu/odata/sap/ZC_AD_SCHOLAR_SRV/ApplicationStatuteSet('014')",
                    "uri": "https://WEBWSD.<my company>:443/sap/opu/odata/sap/ZC_AD_SCHOLAR_SRV/ApplicationStatuteSet('014')",
                    "type": "ZC_AD_SCHOLAR_SRV.ApplicationStatute"
                },
                "STATUTE": "014",
                "DESCR": "International scholar"
            }
        ]
    }
}

I adjusted the extended model provider class to generate the following annotation in the service metadata document designating the ApplicationStatute entity as a value list provider for statute fields:

<Annotations Target="ZC_AD_SCHOLAR_SRV.ApplicationStatute" xmlns="http://docs.oasis-open.org/odata/ns/edm">
    <Annotation Term="com.sap.vocabularies.Common.v1.ValueList">
        <Record>
            <PropertyValue Property="Label" String="Statutes"/>
            <PropertyValue Property="CollectionPath" String="ApplicationStatuteSet"/>
            <PropertyValue Property="SearchSupported" Bool="true"/>
            <PropertyValue Property="Parameters">
                <Collection>
                    <Record Type="com.sap.vocabularies.Common.v1.ValueListParameterInOut">
                        <PropertyValue Property="LocalDataProperty" PropertyPath="statute"/>
                        <PropertyValue Property="ValueListProperty" String="STATUTE"/>
                    </Record>
                    <Record Type="com.sap.vocabularies.Common.v1.ValueListParameterDisplayOnly">
                        <PropertyValue Property="ValueListProperty" String="DESCR"/>
                    </Record>
                </Collection>
            </PropertyValue>
        </Record>
    </Annotation>
</Annotations>

I regenerated and reactivated all runtime service artifacts.

In the UI5 front-end view declaration, I explicitly set the preventInitialDataFetchInValueHelpDialog attribute of the statute field's ControlConfiguration element to false.

AFAIK, this is all one has to do to create a value list for a field. Howver, if I press F4 in the Statute field of the smart filter bar I only get the following pop-up:

Missing 'Select from list' tab

The select from list tab is missing and there is no value list to be seen …

An example of what I'd like to achieve is the value list that pops up when you press F4 in the Company Code field of the first SAPUI5 smart table sample app: 'Select from list' tab available

Does anyone know what I'm doing wrong or overlooking in creating the value list for the field?

Thanks in advance for all the help,

Joshua

1

1 Answers

0
votes

We found the problem. The annotation target has to refer to the field in the entity to which you want to couple a value list. In my case it had to be "ApplicationsOverviewItem/statute".