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

How add list of app navigations to column field.

TahirLeonenko
Explorer
0 Likes
686

For example, the Manage Sales Contracts app has:

TahirLeonenko_0-1741629993962.png

I'm currently using this in my app for navigation:

<Record Type="UI.DataFieldWithIntentBasedNavigation">
    <PropertyValue Property="Label" String="Sales Document"/>
    <PropertyValue Property="Value" Path="SalesDocument"/>
    <PropertyValue Property="SemanticObject" String="AccountingDocument"/>
    <PropertyValue Property="Action" String="flowDisplay"/>
</Record>
But this only allows for one link, and everything I've found in the documentation for "Navigation from an App (Outbound Navigation)" , does not seem to work (or at least I did not implement it properly). Could anyone give an example of how I would do this with for example this field, the semantic object/action above and this semantic object and action pair: SalesContract, change. Please let me know if you need any more details. Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

FabioPagoti
Active Contributor

I recommend removing the action in your snippet but most likely you are still missing something..

Check the $metadata of your service you mention (App ID F5987)

<Annotations Target="SAP__self.SalesContractManageType/SalesContract">
  <Annotation Term="SAP__core.Computed"/> 
  <Annotation Term="SAP__common.IsUpperCase"/>
  <Annotation Term="SAP__common.SemanticObject" String="SalesContract"/>
  <Annotation Term="SAP__common.Label" String="Sales Contract"/>
  <Annotation Term="SAP__common.Heading" String="SC"/>
</Annotations>

See this annotation has a property as its target not an entity type. From your snippet, you are annotating something which is unknown with a single record.  The Common.SemanticObject term it not part of a collection so you are probably annotating the wrong part of your metadata.

You should have more apps with SemanticObject "AccountingDocument"? Does your user have access to such apps? The popup you mention only shows apps sharing the same semantic object.

TahirLeonenko
Explorer
0 Likes
I tried removing the object as suggested, and as you said, that did not solve the problem, now clicking on the link redirects me to the main page.
TahirLeonenko
Explorer
0 Likes
The annotation I am using is a variation of a table field annotation: <Record Type="UI.DataField"> <PropertyValue Property="Label" String="Sales Document 4"/> <PropertyValue Property="Value" Path="SalesDocument"/> </Record> So I’m not sure what you mean by making it a target instead of an entity. The annotations for my table field (as well as everything else), are inside of: <Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType"> So I tried adding this above to see if it would replace the value in a normal DataField annotation: <Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType/SalesDocument"> <Annotation Term="Common.SemanticObject" Path="SalesContract"/> </Annotations> But there’s an error on the path, and the field remains normal (and SAP__common gives me an Unsupported Vocabulary error, so I did not try it). Also if I want both apps connected to the semantic object of AccountingDocument and SalesContract, would I have to have two data fields? Or could I create two annotations and both would be applied to the field? I only need one app from AccountingDocument, but I need multiple from SalesContract. Please let me know if you have any extra advice!
TahirLeonenko
Explorer
0 Likes
Also for some reason commenting does not allow me to separate lines, so sorry for the unreadability.
FabioPagoti
Active Contributor

Regarding question "So I’m not sure what you mean by making it a target instead of an entity."

I wrote: "See this annotation has a property as its target not an entity type."

Background knowledge: OData vocabularies (such as UI, Common, Core) are a collection of Terms (such as Common.SemanticObject, UI.DataField) . Each Term can target different OData 'things' like entity types, entity set, properties, actions, etc. Each Term is designed by a Type. Annotations are the usage of such terms. For a Term which is linked with a Structure Type, you have <Records> inside the <Annotation> tag. For a Terms which is linked with a Collection Type, you have a <Collection> tag inside the <Annotation> tag and a bunch of <Records> inside this <Collection>

It's unclear how you are annotating your metadata so I am assuming you are changing the local 'annotation' file inside your UI5 app. Doing that requires that:

  1. Check the Vocabularies documentation
    1. OASIS vocabularies - https://oasis-tcs.github.io/odata-vocabularies/
    2. SAP vocabularies - https://sap.github.io/odata-vocabularies/
  2. You import the vocabularies you want to use
  3. Add annotations on the right target
  4. Respect the Term type - which in the end is how your <Annotation> tag is structured

On your question, you provided a <Record> tag - which makes it hard to understand what you are annotating.

 

<Record Type="UI.DataFieldWithIntentBasedNavigation">
    <PropertyValue Property="Label" String="Sales Document"/>
    <PropertyValue Property="Value" Path="SalesDocument"/>
    <PropertyValue Property="SemanticObject" String="AccountingDocument"/>
    <PropertyValue Property="Action" String="flowDisplay"/>
</Record>

 

 From here I can conclude:

  1. You are using Vocabulary "UI".
  2. DataFieldWithIntentBasedNavigation is a Type of the UI Vocabulary
  3. DataFieldWithIntentBasedNavigation is a Type derived from the "DataField" which in turn is derived from "DataFieldAbstract"

FabioPagoti_1-1742235984044.png

Now, which Term are you using?  There are 4 Terms in this single vocabulary which are based on the "DataFieldAbstract" type:

FabioPagoti_4-1742236091852.png

FabioPagoti_6-1742236120703.png

Of course, most likely you are using the "LineItem" term as we are talking about columns of a table: OK.

Let's check what are the possible "Targets" for a `UI.lineItem` - https://github.com/SAP/odata-vocabularies/blob/main/vocabularies/UI.xml#L147

FabioPagoti_7-1742236298962.png

So, in case you want to use the LineItem, you must annotate an entity type only. In other words, the "LineItem" cannot be used to annotate properties.

Now you are saying that the <Record> you have is inside a 

 

 

<Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType">

<!-- you have still not provided the Term you are using which should be here -->

<Record Type="UI.DataFieldWithIntentBasedNavigation">
    <PropertyValue Property="Label" String="Sales Document"/>
    <PropertyValue Property="Value" Path="SalesDocument"/>
    <PropertyValue Property="SemanticObject" String="AccountingDocument"/>
    <PropertyValue Property="Action" String="flowDisplay"/>
</Record>

 

So, I image it's something like

 

<Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType">

<Annotation Term="SAP__UI.LineItem">

<Record Type="UI.DataFieldWithIntentBasedNavigation">
    <PropertyValue Property="Label" String="Sales Document"/>
    <PropertyValue Property="Value" Path="SalesDocument"/>
    <PropertyValue Property="SemanticObject" String="AccountingDocument"/>
    <PropertyValue Property="Action" String="flowDisplay"/>
</Record>

 

The "SAP__UI" is just an alias which can be different for you - check the vocabularies references at the top of the file and you should have something like

 

<edmx:Reference Uri="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_UI',Version='0001',SAP__Origin='LOCAL')/$value">
<edmx:Include Namespace="com.sap.vocabularies.UI.v1" Alias="SAP__UI"/>
</edmx:Reference>

 

If you get it until here, great.  What you are trying to achieve here is basically having a single column which is a link pointing to an app based on its intent (#AccountingDocument-flowDisplay) but what you are asking is to have a popup with a list of apps. From my research based on app F5987 this is achieved by another term from a diffent vocabulary:  `SAP__common.SemanticObject`

- SAP__common is just an alias for the Common vocabulary - https://sap.github.io/odata-vocabularies/vocabularies/Common.html
- 'SemanticObject' is the Term

FabioPagoti_0-1742237238756.png

Now this other term can be applied to different OData things such as: Entity sets, entity types, properties and navigation properties.

FabioPagoti_1-1742237258964.png

However from the same app you provided, F5987, this annotation is being used on a property as its target - not on an entity type (like the LineItem)

<Annotations Target="SAP__self.SalesContractManageType/SalesContract">
  <Annotation Term="SAP__core.Computed"/> 
  <Annotation Term="SAP__common.IsUpperCase"/>
  <Annotation Term="SAP__common.SemanticObject" String="SalesContract"/>
  <Annotation Term="SAP__common.Label" String="Sales Contract"/>
  <Annotation Term="SAP__common.Heading" String="SC"/>
</Annotations>

Target = SAP__self.SalesContractManageType/SalesContract 
where,
SAP__Self = Schema namespace from the metadata
SalesContractManageType = Entity Type
SalesContract = Property

Now you said in the comments

So I tried adding this above to see if it would replace the value in a normal DataField annotation: <Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType/SalesDocument"> <Annotation Term="Common.SemanticObject" Path="SalesContract"/> </Annotations> But there’s an error on the path, and the field remains normal (and SAP__common gives me an Unsupported Vocabulary error, so I did not try it)so you have...

<Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType/SalesDocument"> 
<Annotation Term="Common.SemanticObject" Path="SalesContract"/> 
</Annotations>

I personally have never seen "SAP" being the schema namespace but imagining it's correct
+
Assuming 'ZZ1_C_SLCNTRINFOQRYType' is an entity type which contains property 'SalesDocument'
+
Imagining that you are not using the UI.DataFieldWithIntentBasedNavigation anymore on such column

Then still is different

<Annotation Term="SAP__common.SemanticObject" String="SalesContract"/>
<-- is different than -->
<Annotation Term="Common.SemanticObject" Path="SalesContract"/> 

Despite the alias which can be different from time to time, you are using a Path instead of a hard coded value. That means your entity type has another property called "SalesContract" which the values are valid SemanticObjects. That might imply you have a table/CDS view where you store semantic object names. I don't think this is what you have or want based on your question. Please use String="YourHardCodedSemanticObject" instead such as 

<Annotation Term="SAP__common.SemanticObject" String="SalesContract"/>


Also if I want both apps connected to the semantic object of AccountingDocument and SalesContract, would I have to have two data fields? Or could I create two annotations and both would be applied to the field? I only need one app from AccountingDocument, but I need multiple from SalesContract. Please let me know if you have any extra advice!

If I got it right, you want different apps apps using different semantic objects on the same popup. I suspect this is not possible. The popup most likely is generated by fetching all apps for a single semantic object. That is why the Term was designed to be a single string. You can create 2 columns with links using the Common.SemanticObject if that is ok. Maybe it makes more sense to create your own tiles/target mappings with the semantic object you want and avoid having this mix.

 

Sorry for the long reply. Hopefully this explanation helps you and others in the future how to better understand OData vocabularies, terms and annotations are those are the foundation for Fiori Elements.

 

 

 

 

TahirLeonenko
Explorer
0 Likes
Wow super helpful!.
TahirLeonenko
Explorer
0 Likes
This ended up being the correct combination of xml annotations: <Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SAP.ZZ1_C_SLCNTRINFOQRYType/SalesDocument"> <Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SalesContract"/> </Annotations> <Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType"> <Annotation Term="UI.LineItem" Qualifier="tab0"> <Collection> <Record Type="UI.DataField"> <PropertyValue Property="Label" String="Sales Document"/> <PropertyValue Property="Value" Path="SalesDocument"/> </Record> </Collection … </Annotation> … </Annotations> I found reference to something called SmartLinks in the documentation that says it allows the use of multiple semantic objects, but I’m not sure how I would use it, as the xml does not seem like anything in my Fiori Elements project. Thank you for the help!
FabioPagoti
Active Contributor

Great! Do not forget to leave some Kudos! 🙂 I see you posted another question about SmartLink and it's an interesting one.

How to use Smart Link in Fiori Elements - SAP Community

Answers (0)