Skip to Content

Passing derived values to ABAP CDS parameter mappings

Hi All,

I am creating a custom view pulling data from a standard view. The select part including the parameter mapping currently is as shown below:

as select from I_GLAcctBalanceComprnCube 


( P_FromPostingDate: $parameters.P_ToPostingDate ,
  P_ToPostingDate: $parameters.P_ToPostingDate, 
  P_ComprnFromPostingDate :$parameters.P_ComprnFromPostingDate, 
  P_ComprnToPostingDate:$parameters.P_ComprnToPostingDate )

Currently, the user enters posting dates but now the requirement is to remove the posting date parameters from user input and ask user for fiscal periods instead.

My assumption is that I can create fiscal period inputs and calculate the start and end dates for that fiscal period using the available standard fiscal period views but I can't think of an way I can map this calculated fiscalperiod start or end date to these parameter mappings. So what I can do is add an association as below.

as select from I_GLAcctBalanceComprnCube 
( P_FromPostingDate: $parameters.P_ToPostingDate ,
  P_ToPostingDate: $parameters.P_ToPostingDate, 
  P_ComprnFromPostingDate :$parameters.P_ComprnFromPostingDate, 
  P_ComprnToPostingDate:$parameters.P_ComprnToPostingDate )
association [0..1] to I_FiscalYearPeriod as _year on 
$projection.FiscalYearVariant = _year.FiscalYearVariant and 
_year.FiscalPeriod = $parameters.P_FiscalPerFrom and 
_year.FiscalYear   = $parameters.p_FiscalYear

Now I have access to fields like _year.fiscalperiodstartdate and I want to do something like the below so that even though the user is now not entering posting dates, I derive those dates and pass it on to the view below. But this ofcourse will not work because _year.fiscalperiodstartdate is not a scalar value but a list of values.

Not sure how to do this.

as select from I_GLAcctBalanceComprnCube 
( P_FromPostingDate: _year.fiscalperiodstartdate ,  //replaced paramter with start date
  P_ToPostingDate: $parameters.P_ToPostingDate, 
  P_ComprnFromPostingDate :$parameters.P_ComprnFromPostingDate, 
  P_ComprnToPostingDate:$parameters.P_ComprnToPostingDate )

Can you please let me know how I can achieve this?

Thanks,

Shyam

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.