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

Using the Smart MultiInput Control on the Fiori Elements Object Page

EkanshCapgemini
Active Contributor
0 Likes
6,272

Hi,

I am new to Fiori Elements and sadly our backend ABAP version doesn't support CDS views. So I am using SEGW based OData service with additional annotation file in UI project. I have a requirement to show smart multi input control for 'plant' field to capture multiple plants in an Object Page.

I checked the documentation for this but it seems uncomplete to me as it doesn't has any annotation or metadata sample code. Could some one please provide an example for this case or guide me a little further? https://ui5.sap.com/1.65.0/#/topic/04ff5b1a81344a8e8169ea99630ff4e5

So I have two entities 'Variant' and 'Plant'. Here Variant is the main entity which has a 'Plant' property and 'ToPlant' navigation property based on following association

<Association Name="VariantToPlant" sap:content-version="1">
    <End Type="ZTEST_EKANSH_SRV.Variant" Multiplicity="1" Role="FromRole_VariantToPlant" />
    <End Type="ZTEST_EKANSH_SRV.Plant" Multiplicity="*" Role="ToRole_VariantToPlant" />
    <ReferentialConstraint>
        <Principal Role="FromRole_VariantToPlant">
            <PropertyRef Name="VariantId" />
        </Principal>
        <Dependent Role="ToRole_VariantToPlant">
            <PropertyRef Name="VariantId" />
        </Dependent>
    </ReferentialConstraint>
</Association>

'Plant' entity just has two properties 'PlantKey' and 'VariantId'.

The annotation for Plant field which I want to be as smart multi input field is as below (removed some extra fields):

<Annotation Term="UI.FieldGroup" Qualifier="GeneralData">
    <Record Type="UI.FieldGroupType">
        <PropertyValue Property="Data">
            <Collection>
                <Record Type="UI.DataField">
                    <PropertyValue Property="Value" Path="Vendor" />
                </Record>
                <Record Type="UI.DataField">
                    <PropertyValue Property="Value" Path="Plant" />
                </Record>
            </Collection>
        </PropertyValue>
    </Record>
</Annotation>

Based on this, currently it shows a normal smart field with only single select.

BR, Ekansh

View Entire Topic
EkanshCapgemini
Active Contributor

Alright. I got it working with following changes:

  • changed the data field annotation path to navigation_property/key i.e. ''
<Record Type="UI.DataField">
    <PropertyValue Property="Label" String="{@i18n>plant}"/>
    <PropertyValue Property="Value" Path="ToPlant/PlantKey" />
</Record>
  • added value list annotation to PlantKey property to enable value help