Initial Configuration within Our Manifest.json
Manifest.json: Multi-select Settings
sap.ui.controller("demo.sap.contractreviewdemo.ext.controllers.ListReportExtension", {
onInit: function() {},
onExit: function() {},
onBeforeRendering: function() {},
onAfterRendering: function() {},
onApproveContract: function(oEvent) {
var aContexts = this.extensionAPI.getSelectedContexts();
if (aContexts && aContexts.length > 0) {
//Perform Action
} else {
sap.m.MessageBox.error("You must first select a row!", {});
}
}
});
An Overview of the ListReportExtension Controller
We now have multi-select capabilities enabled for our Responsive Table
For reference: single select Responsive Table
Please note that we have other setting options at our disposal including the control of variant management for our List Report. Variant management allows for storing snapshots of a user’s setting when using your application such as filters within the Smart Filter Bar or visible columns within the Smart Table.
By default, the Smart Filter Bar and Smart Table each have their own variant (See above where both are set to “Standard”). If we use the setting "smartVariantManagement": true we will now have a unified variant management area for our List Report where variants for both the Smart Filter Bar and Smart Table are saved together.
Instead of the default Responsive Table, we could make a small change to our manifest.json file (below) to set the Smart Table within our List Report floorplan to render as a Grid Table. In this example, we are also configuring our Smart Table for multi-select and our List Report to leverage unified variant management:
Manifest.json: Changes Required for a Multi-select Grid Table Setup
The expected result is a Grid Table with the option to select multiple rows. You should also notice the new “Show Details” button at the top-right of the table. With a single row (checkbox) selected, we can use this action to navigate to the Object Page (Details). For more information on the Grid Table’s anatomy and when and how to use it, please refer to the Fiori Design Guidelines.
We now have the Smart Table rendered as a Grid Table
If we wanted to now transform this Grid Table into an Analytical Table, we’d have to do some work on the OData service’s metadata model within Gateway (SEGW) as this is what governs the sort of change we require. First and foremost, we would need to set the SAP annotation of “semantics” to “aggregate” (sap:semantics=”aggregate”) for the entity being represented in our Smart Table (in this case, the Contract entity type). On top of that, the analytical table naturally requires data that has been classified into aggregation-roles (dimension, measure or empty) to consume and manipulate properly. Without at least one measure defined, you will encounter an issue with duplicates groups and rows in the Analytical Table when grouping.
An Analytical Table with no Defined Measures (Duplicate Rows/Groups when Grouping Example)
In this demonstration, I am using mock data and not connecting to a live service that could supply the necessary data for a fully functional Analytical Table. Behind the scenes SAPUI5 is bundling several OData service calls in a batch request to retrieve the necessary entities and their associated properties along with aggregate query results. These aggregate query results supply the Analytical Table with the required totals and subtotals that are missing in the screenshot below.
Our Analytical Table with Missing Totals and Subtotals
If we wanted to create our own analytical OData backend, it would require a bit of work outside of setting specific SAP-specific annotations within the Define method of our Model Provider Extension c.... If you are leveraging SADL and mapping your entities to a CDS View data source, you would need to specify an Aggregation Method for your measures using the query options API provided by the framework. On 7.50+ systems you have the options of integrating your annotations into your CDS Views and may specify the aggregation behavior in a different manner.
METHOD IF_SADL_GW_QUERY_CONTROL~SET_QUERY_OPTIONS.
CASE iv_entity_set.
WHEN 'ContractSet'.
"Set aggregation method for analytical measures:
io_query_options->set_aggregation( VALUE #( (
element = 'NET_VALUE' alias = 'NET_VALUE'
type = if_sadl_gw_query_options=>co_aggregation_type-sum ) ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
Specifying the Aggregation Method for our Measure via the SADL API
An Example Metadata (EDMX) Document Required for an Analytical 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 |
---|---|
50 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |