cancel
Showing results for 
Search instead for 
Did you mean: 

How to set default value using @Consumption.filter.defaultValue (CDS RAP)

sankar1781
Participant
0 Kudos
166

Hello Experts,

Building a consumption view to display Supplier invoice data with workflow details. In that, the requirement is to build below inputs with a default value as 

1) Net value date : last day of the current month (calendar as VH)  

2) Fiscal year : Current year (it has all years in the drop down/VH but must have the current year) 

3) PR block reason key : = !blank (it has all values but must be equal to blank) 

4) Document date : multiple range selection input with (first day of the current month and current day of the current month) 

Please help how to achieve it with the code. 

Thank you for your time and any help is highly appreciated. 

Accepted Solutions (0)

Answers (1)

Answers (1)

NooruBohra
Active Participant
0 Kudos

`You can use the below code snippet for reference.

Here I have created a copy for view "C_SglGregorianCalMonthToDate" and fixed the parameter P_DateFunction = 'MONTHTODATE'. 

@Consumption.filter: {
          mandatory: true,
          selectionType: #INTERVAL,
          multipleSelections: false }
      @Consumption.derivation: {
                lookupEntity: 'ZC_SglGregorianCalMonthToDate',
                resultElement: 'StartDate',
                resultElementHigh: 'CurrentDate' }
      fkdat                      as BillingDate,

 

sankar1781
Participant
0 Kudos

Hi NooruBohra,

Thank you for your response and help.

I copied "C_SglGregorianCalMonthToDate" to "ZCSglGregorianCalMonthToDate" but not able to provide a fixed parameter value. 

How to provide a fixed parameter for P_DateFunction = 'MONTHTODATE'?

Please help.

NooruBohra
Active Participant
0 Kudos

Use the below example.

https://community.sap.com/t5/application-development-discussions/how-to-use-a-cds-view-with-paramete...

my code is to just let you know how can you derive values. Might not be the exact solution for your requirement.