Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member348219
Discoverer
I have Identified a way where CDS with parameters can be easily carried out with the Fiori  List Report.

 

A typical List Report generation use the following steps:

  1. Consumption CDS Exposed as OData service

  2. Template Based List report generation using OData


This works fine when we have CDS with all relevant annotations. In cases where we have Parametrised CDS, Standard List Report generation will not support.  Many Times, we have parametrised CDS for narrowing down the search criteria.

“List Report is generated with Parametrised CDS with Mandatory Fields, but the data will not have fetched “

For the CDS view with parameters, a separate Parameter Entity Set on the OData Service gets created along with Columns Entity Set and the data is fetched based on the parameter entry, which will create a query as “zpart_param(p_rldnr=’0L’)/Set”.

CDS Source code:
@AbapCatalog.sqlViewName: ‘paramtest’
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: ‘test’
@OData.publish: true
define view zpart_param

with parameters
p_rldnr: rldnr
as select from acdoca as a{

key a.rldnr as Ledger,

a.rbukrs as CompanyCode,
a.kunnr as CustomerNo,
a.racct as GLAccount,
a.belnr as DocumentNo
}
where a.rldnr= $parameters.p_rldnr

 

 Metadata for above CDS :



Solution Overview

As mentioned above, Standard List Report generated code won’t support the Parametrised CDS.

List Report is generated with the Mandatory Fields (as part of the CDS Parameter) but hitting the go Button will not bring the data.

In this scenario, we need to extend the List Report code and can achieve the relevant functionality

  1. List Report Extension to support Parameterized CDS


Select Project -> Extend-> List Report Extension-> Action



2. We need to add the Following code inside the EXT-> controller.js file

On Go event of filter will get the Parameter binding path of the FilterBar and set the table binding path with parameter path.



 

 
onBeforeRebindTableExtension: function(oEvent) {

var oSmartTable = oEvent.getSource();
var oSmartFilterBar = this.byId(oSmartTable.getSmartFilterId());
var path = oSmartFilterBar.getParameterBindingPath();
oSmartTable.setTableBindingPath(path);

}

 

Output: 



16 Comments
Labels in this area