Umar Abdullah
Umar Abdullah

Reputation: 1290

Calculations before parameter mapping in ABAP CDS

I have a fiscal period parameter (Ex. 03) and a fiscal year (Ex. 2018) parameter flowing in from a layer of views below.Select statement now is:

select from <view> 

(P_FiscalPeriod: $parameters.P_FiscalPeriod ,P_FiscalYear: $parameters.P_FiscalYear).

User wants to enter a single parameter 03.2018.

To accomodate this change, I would want to separate out the fiscal period and year from this string before parameter mapping is done - maybe use one of the substring functions.

The problem is that I can not do this within the parameter mapping code. I can not write

P_FiscalPeriod: LEFT($parameters.P_FiscalPeriod,2) . 

It starts giving syntax errors.

I can not figure out the right syntax or other methods to do this. i am not able to find an example either.

Any help would be greatly appreciated.

Regards, Umar Abdullah

Upvotes: 2

Views: 1019

Answers (1)

Florian
Florian

Reputation: 5051

Not sure CDS views are the right layer for what you are doing. CDS views are mainly there to provide integrated, consistent views on your data. They are not there to process user input.

I'd recommend to choose the input data format as appropriate for your selection and let some outer layer (ABAP?) do the splitting and validating part.

Upvotes: 1

Related Questions