Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
saurabh_nimbl
Participant
3,947
Hi Friends,

In this blog post I'm going to show how you can add parameters in custom CDS views built in S/4 HANA Cloud environment. Sometimes it is required and quite useful when you add parameters to your views so that when view is being called, those parameters will be passed to underlying data objects and only specific records will be retrieved.

Let's consider a scenario where we need to get data from material stock based on posting date.

To achieve this, create a custom CDS view based on standard CDS view I_MaterialStock. 

 



 

Navigate to "Parameters" tab and add an entry, let's say it, ToDate. We can choose any default value to set, it can be a manual date or system default date as well.

 



Switch to "Filters" tab and edit it. Add a filter for Posting Date is less than equal to date from parameters, as shown below -

 



 



 

Now apply the changes and save the CDS view. When we preview the view, parameters pop up for 'To Date' will appear where date needs to be entered. After entering the date, data will be retrieved based on filter criteria.

 



 



 



 

Additionally, when you expose this CDS view as cube and build a Custom Analytical Query on top of this, these parameters will be pulled up as selection criteria in the query.

 



 

To conclude, we can add parameters to filter the records at database level itself which can be consumed in queries or applications

 

Thanks,

Saurabh
2 Comments
Labels in this area