anjaneylu
anjaneylu

Reputation: 1

Smart Table field added by Local annotations not shown "no columns selected"

I am trying to create Fiori local annotations in my project, I have added the annotations like below:

  </edmx:Reference>
  <edmx:DataServices>
    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="local1">
      <Annotations Target="SAP.PO_Self_Service_HomePage">
        <Annotation Term="UI.LineItem">
          <Collection>
            <Record Type="UI.DataField">
              <PropertyValue Property="Value" Path="Compcode"/>
              <PropertyValue Property="Label" String="Compcode"/>
            </Record>
          </Collection>
        </Annotation> 
      </Annotations>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>

And updated this code in annotations folder. Also, I have modified the manifest file to call this annotations file:

    "type": "OData", 
    "settings": {
        "annotations": [ 
            "annotation0"
        ],
        "localUri": "localService/mainService/metadata.xml",
        "odataVersion": "2.0"
    }
},
"annotation0": {
    "type": "ODataAnnotation",
    "uri": "annotations/annotation0.xml",
    "settings": { 
        "localUri": "annotations/annotation0.xml"
    }
}

I am not getting any error and even in network tab the file loaded without any issue, but fields are not coming in the smart table:

Error There are no columns selected for your table. Before you perform the search, please make sure that at least one column is made visible...

I also added the initialvisiblefields property in smart table but still no luck.

Can someone please throw some light on this?

Upvotes: 0

Views: 42

Answers (2)

York Chen
York Chen

Reputation: 742

<Annotation Term="UI.SelectionFields">
<Collection>
<PropertyPath>Compcode</PropertyPath>
</Collection>
</Annotation>

Upvotes: -1

Anna-Grace
Anna-Grace

Reputation: 1

It looks like everything is set up correctly, but your Smart Table still isn’t showing the expected fields. Here are a few things to check:

Is the annotation file actually being applied? Just because it loads in the network tab doesn’t mean it’s being used. Double-check if your annotations are being picked up in the OData metadata.

Is the manifest file set up correctly? Make sure your annotations are properly linked in the manifest.json file. If the Smart Table doesn’t know where to find them, they won’t be applied.

Do your annotations match your OData fields? Even a small difference in field names (capitalization, spacing, etc.) can cause issues. Make sure everything is spelled exactly the same.

Is initialVisibleFields set correctly? If you’re specifying visible fields in the Smart Table, they need to match the ones defined in your OData model.

Have you tried refreshing the table? Sometimes, changes don’t reflect immediately. Try forcing a table refresh or clearing your browser cache to reload everything properly.

Could OData service annotations be overriding your local ones? If your service already has annotations, they might take precedence over your local ones. Temporarily disable them and see if it makes a difference.

Have you checked for hidden errors?

Open the SAP UI5 Diagnostic Tool (Ctrl + Alt + Shift + S in Chrome) to see if there’s an issue that isn’t showing up as an error. You can also add a debugger in your controller to check what’s happening.

Try these steps and see if anything changes. Let me know what works or if you’re still stuck!

Upvotes: 0

Related Questions