on 01-17-2023 12:30 PM
I want to create a Fiori Elements Analytical List Page, displaying hours for employees. I would like to use some associations for displaying additional information. The key of the main entity does not contain any relevant info for the end-user (it is a counter), so I want to hide this field in my frontend. However, if I don't display this field, it is not contained in the OData call to the backend, and the associations don't work anymore. The application is showing the error: "The navigation information is not valid; the source key 'COUNTER' of association 'TO_PERSNAME' is not provided'.
The OData service is based on a CDS view on table CATSDB. This is the table where working-hours are stored for a given personnel number. The key of this table is <COUNTER>. I want to have an association to the username (table PA0001) using the personnel number in my association. The OData service is created by using the CDS as reference, as I want to add actions later (the version of my ECC system prevents me doing this directly in my CDS).
I am working on an on-premise ECC system with embedded UI5. ECC is on 7.50 SP 0023; SAP_UI is 754 SP 009, Fiori version 1.71.46.
Simplified CDS view:
define view zc_catsdb_tst01 as select from catsdb
association [1..1] to PA0001 as _persname on _persname.pernr = $projection.PersNr
{ key counter as Counter,
pernr as PersNr,
workdate as Workdate,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasurement'
catsquantity as WorkingHours,
@Semantics.unitOfMeasure: true
unit as UnitOfMeasurement,
_persname }
If I use this CDS as a source for my Fiori Elements app, I can get results very quickly. I chose an analytical app, with any of the table types ResponsiveTable, GridTable or TreeTable. I added some fields for display and voilá:
This is (part of) my annotations file:
<Annotations Target="SAP.zc_catsdb_tst01Type">
<Annotation Term="UI.LineItem">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Workdate"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="WorkingHours"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="to_persname/ename"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Counter"/>
</Record>
</Collection>
</Annotation>
</Annotations>
I want to display hours for an employee, using his name, leading to this OData call:
/sap/opu/odata/sap/ZCATSDB_TST01_SRV/zc_catsdb_tst01?$top=5&$select=Counter,WorkingHours,Workdate,_persname/ename&$expand=_persname
This call works, but it explicitly contains the field <COUNTER>.
As soon as I do not show the counter in my Fiori Elemenst app, the app shows an error:
If I test the OData call I get the same error. First the OData call:
/sap/opu/odata/sap/ZCATSDB_TST01_SRV/zc_catsdb_tst01?$top=5&$select=WorkingHours,Workdate,_persname/ename&$expand=_persnameThe error:
<code>CX_SADL_GW_CONTRACT_VIOLATION</code>
<message>The navigation information is not valid; the source key 'COUNTER' of association 'TO_PERSNAME' is not provided</message>I've tr
What I want is to force the selection of my key-field in the OData-call, without displaying it in my app.
I've tried several methods to hide the counter field, but as soon as I hide the field, the association doesn't work anymore. I tried annotations in my CDS, in the define method of my MPC_EXT-class and in my Fiori Annotations file, but this does not solve the problem. I also searched the documentation, but I could not find a solution there.
I also checked a number of blogs, questions & answers here:
https://answers.sap.com/questions/12662196/hide-datafield-in-fiori-elements-using.html
https://answers.sap.com/questions/12946624/hiding-inner-filters-in-smart-filter-fiori-element.html
https://answers.sap.com/questions/13102263/field-hidden-in-smart-table.html
https://blogs.sap.com/2017/09/21/remove-unwanted-columns-from-personalizationp13n-dialog-popup./
https://answers.sap.com/questions/13412687/hide-fields-in-column-personalization-button-of-fi.html
https://answers.sap.com/questions/13643103/annotations-to-hide-columns-in-ui5-using-the-mpc-e.html
Does anyone have some tips how to solve this?
Thanks in advance!
https://sapui5.hana.ondemand.com/sdk/#/topic/65731e6b823240398e33133908efdaa1.html
check if requestAtLeast annotation will help.
if you use that annotation, COUNTER will be available but not showing in the table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.