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: 
AnkurBajpai
Active Participant
Hi Folks,

In this blog we’re going to develop an SAP Fiori Elements (List Report) Application utilizing CDS view with parameter.

I checked in lots of blogs statement that Standard List Report doesn’t not support CDS view with parameter.

I found a solution and we just need to use single property in our manifest.json file to achieve it.

Below are the steps we need to do:

  1. CDS View source code

  2. Metadata of CDS view

  3. Web IDE code


 

  1. CDS View source code


@AbapCatalog.sqlViewName: 'ZCQMBTHFLGUXPOC'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #NOT_REQUIRED

@VDM.viewType: #CONSUMPTION

@OData.publish: true

@EndUserText.label: 'Batch Flagging Activities Report'

@UI.headerInfo: {
typeName : 'Batch Flagging Activities Report' ,
typeNamePlural: 'Batch Flagging Activities Report' }

define view ZC_QM_BTHFLG_POC_UX
with parameters
@EndUserText.label: 'History/Current'
@Consumption.defaultValue: 'Current'
@Consumption.valueHelpDefinition:[{entity:{name : 'ZI_Current_History',
element : 'Status'}}]
hist_curr : char7,

@EndUserText.label: 'Start Date'
@Environment.systemField: #SYSTEM_DATE
S_Date : dats,

@EndUserText.label: 'End Date'
@Environment.systemField: #SYSTEM_DATE
E_Date : dats,

@EndUserText.label: 'Plant'
@Consumption.valueHelpDefinition:[{entity:{name : 'I_Plant',
element : 'Plant'}}]
ip_Plant : werks_d

as select from ZI_QM_HIST_CURR_001 (S_Date:$parameters.S_Date,E_Date:$parameters.E_Date,
ip_Plant:$parameters.ip_Plant,
hist_curr:$parameters.hist_curr)
{
@EndUserText.label: 'Material'
@UI.selectionField.element: 'Material'
@UI.lineItem.position: 10
key Material,
_matnr_txt,

@EndUserText.label: 'Batch'
@Consumption.semanticObject: 'Batch'
@UI.lineItem.position: 20
key Batch,

@EndUserText.label: 'Change Control'
@UI.lineItem.position: 30
@UI.selectionField.element:'Change Control'
CC_ID,

@EndUserText.label: 'Flag/ Unflag'
@UI.lineItem.position: 40
@UI.selectionField.element:'Flag'
Flag,

@EndUserText.label: 'Flagging Type'
@UI.lineItem.position: 50
@UI.selectionField.element:'Flagging Type'
FlaggingSource,

}

2. Metadata of CDS view:

As I made 4 fields as parameterized, we can see in the below screenshot of Metadata of CDS view.


 

3. SAP Web IDE code:

  • Select a List Report template Application-> Click on Next



 

  • Enter the project details -> Click on Next



 

  • Select the system -> Select the OData service -> Click on Next





  • Select the Annotations files-> Click on Next



 

  • Select the OData Collection -> Click on Finish



 

  • Open the json file from the project structure.

  • Add "considerAnalyticalParameters": true as highlighted in below screenshot.



 

  • Run the application

  • Fill all the mandatory parameter-> click on Go



 

As you can see in the above screenshot the data is coming.

So, folks cheers we can use CDS view with Parameters in List Report Application. We don’t need any extension or any extra code for Parameterized CDS.

I hope this simple trick can help you guys to consume CDS view with Parameters in List Report Application template.

 

 

Regards,

Ankur Bajpai

 
18 Comments
Labels in this area