on 2024 Mar 01 11:21 AM
EXT_SERVICE.edmx (scrubbed):
Request clarification before answering.
List report can show parameterized views. The annotations required are described in SAP UI5 documentation for Configuring Filter Bars. I have not found a way to annotate the view parameter correctly with the annotation Common.ResultContext in CAP. So I used an additional annotation file in the ui5 application to add this annotation as follows:
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
</edmx:Reference>
<edmx:Reference Uri="/browse/$metadata">
<edmx:Include Namespace="BrowseService"/>
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="parameterize">
<Annotations Target="BrowseService.BooksParameters">
<Annotation Term="Common.ResultContext" />
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
All the other restrictions you want can be added using CAP annotations. You need to prefix references to fields with "Set." like in the following snippet.
//Capabilities do reflect in metadata; it has to be for Set/
@Capabilities : {
FilterRestrictions : {
NonFilterableProperties : [Set.currency_code],
FilterExpressionRestrictions : [
{
$Type : 'Capabilities.FilterExpressionRestrictionType',
AllowedExpressions : 'MultiValue',
Property : Set.genre_ID,
},
],
},
SortRestrictions : {NonSortableProperties : [Set.author_ID, Set.currency_code]},
NavigationRestrictions.RestrictedProperties : [
{NavigationProperty : Parameters, FilterRestrictions : {Filterable : false} },
{
$Type : 'Capabilities.NavigationPropertyRestriction',
NavigationProperty : Set,
FilterRestrictions : {
$Type : 'Capabilities.FilterRestrictionsType',
FilterExpressionRestrictions : [{
$Type : 'Capabilities.FilterExpressionRestrictionType',
Property : Set.genre_ID,
AllowedExpressions : 'MultiValue'
},
{
$Type : 'Capabilities.FilterExpressionRestrictionType',
Property : Set.currency_code,
AllowedExpressions : 'SingleValue'
}]
}
}
]
}
Update:
Changed external term "external annotation" to "additional annotation file" with reference to UI5 documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you find any annotation in the imported file is not convenient, you can manually edit the imported file and change it or override these in your projection. I did not directly map the external service to the provided service. Instead I defined a new entitiy with parameters without persistence and took full control of the definition.
You need to define an entity with parameters in CAP. You can use the types from the import in this definition. But declaring the parameters and results as independent entities did not work in my experiments; there are subtle metadata aspects/relations that are generated on the fly for entities with parameters.
Unfortunately, the entity in imported service is not imported as an entity with parameters. It is imported as 2 entities one for the parameter and another for the result associated by association Set. So, when you delegate the call to the remote service you have to transform the query. You have listed in your question an example of doing this this. It is just like you see in the oData URL.
Incoming URL: /Books(in_AuthorID=150,DisplayCurrency='USD')/Set
Incoming CQN: Books(in_AuthorID:150,DisplayCurrency:'USD') as Books is an entity with parameters.
Expected Outgoing URL: /Books(in_AuthorID=150,DisplayCurrency='USD')/Set
Expected CQN for the above: Books[in_AuthorID=150 and DisplayCurrency='USD'].Set as Books on the remote service is not an entity with parameters
You have to transform from the incoming CQN to either the expected URL and use REST API or to the corresponding CQN.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check documentation Configuring Filter Bars If some annotation is not documented there, it is probably yet to be implemented. Note that term Search is different from the term Filter.
I configured another application for details navigation. So I did not build an object page using parameterized view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You wrote in one of your posts that you receive the error "TypeError: s.storeInnerAppStateAsync is not a function" in the console.
I get this error too and can not find any solution.
Have you fixed this? appstate for filtering is not working in my app.
My App is deployed on BTP Cloud Foundry not in FLP. Is saving AppState / InnerAppstate possible without FLP?
User | Count |
---|---|
85 | |
12 | |
9 | |
8 | |
8 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.