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,266

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

Accepted Solutions (1)

Accepted Solutions (1)

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

Answers (2)

Answers (2)

SeSo_1
Explorer

Hi Amit,

yes i solved it.

you have to make a 1..N composition in the root entity like this:

and make an annotation with value like this:

the result in the ADT:

Best regards

Sebastian Sobierajski

MattDion
Participant
0 Likes

This worked for me as well. One additional hint to add is that if additional UI annotations are required (such as textArrangement: #TEXT_ONLY), these annotations need to be applied to the composition entity's field and not the composition itself in the parent entity.

JeremyCoppey
Explorer
0 Likes

Hi Sebastian,

Can you clarify your answer?

Maybe share the code of the CDS we have the same requirement and I'm stuck (UIversion: 1.96.6 S4/hana 2021)

Kind regards

Jérémy


SeSo_1
Explorer

Hello Ekansh,

currently I also have the requirement to map a Multi Select Combobox. I am trying to implement the 1-N association in a RAP based service. So my question. Have you been able to finish your implementation? If so, can you publish the complete annotation here? I would like to compare this with mine 🙂

Best wishes Sebastian

EkanshCapgemini
Active Contributor
0 Likes

Hi Sebastian,

In fact, I had to abandon the idea of using fiori element as the requirement went too complex and it had some limitation with my FES UI5 version. So I currently don't have access to the codebase for this but the all the annotations are added in my question and answer.

Hope it helps you in some way.

BR, Ekansh

amitg1275
Explorer
0 Likes

Hello Sebastian

I am also using RAP . Did you find way to make a Multi input field using RAP ?

Thanks

Amit Gupta