abapsap-fiorisap-gateway

SAP Fiori Elements - Object Page Table Items XML Annotation


Please, what are the XML annotations needed in a Fiori Elements Object Page in order to display a table in it? This app is not a RAP one, this is OData service with gateway (SEGW).

Example: Main Entity Purchase Orders and in Object Page display all PO Items.


Solution

  • You need to add ReferenceFacet annotations that point to the LineItem annotation.

    ReferenceFacet annotations will create a new section in the Object Page. The LineItem annotation will add a table to it.

    More details you can find in the documentation.

    Facet annotation:

    <Annotation Term="UI.Facets">
        <Record Type="UI.ReferenceFacet">
            <PropertyValue Property="ID" String="to_Children"/>
            <PropertyValue Property="Target" AnnotationPath="children/@UI.LineItem"/>
            <PropertyValue Property="Label" String="{@i18n>CHILDREN_LABEL}"/>
        </Record>
    </Annotation>
    

    LineItem annotation

    <Annotations Target="MyService.Children" xmlns="http://docs.oasis-open.org/odata/ns/edm">
        <Annotation Term="UI.LineItem">
            <Collection>
                <Record Type="UI.DataField">
                    <PropertyValue Property="Value" Path="FullName"/>
                </Record>
                <Record Type="UI.DataField">
                    <PropertyValue Property="Value" Path="Age"/>
                </Record>
                <Record Type="UI.DataField">
                    <PropertyValue Property="Value" Path="EyeColor"/>
                </Record>
            </Collection>
        </Annotation>
    </Annotations>