03-29-2017 8:24 AM
Hi All,
I am creating CDS view using parameter.
In that, I want to split input parameter.
Please go through image.
in this example, I want to split input parameter fiscyr having lenth 6 into 2 variable year which is 1st 4 char in fiscyr and month which is 2 char from 5th position. e.g. fiscyr = 201604 then
year = 2016 and month = 04.
Please let me know if anyone have input.
Thanks.
Regards,
Sandeep
03-29-2017 8:39 AM
Check if an appropriate SQL-function is available in your release.
03-29-2017 10:59 AM
do you need something like this?
define view ZTest_split with parameters P_Date: char6
as select from vbak { vbeln, LEFT($parameters.P_Date, 4) as FYear, RIGHT($parameters.P_Date,2) as FMonth }
if the input parameter is a date, you might be interested in the table: scal_tt_date, if it's available in your system.
03-29-2017 1:41 PM
I want to split parameter into 2 variable and use that in condition. I don't want split it in table.
03-30-2017 11:56 AM
Then you need additional views to split the variable and use that in condition.
e.g. based on the previcous code, we could have another one:
@AbapCatalog.sqlViewName: 'ZT_SPLIT2' @AbapCatalog.compiler.compareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'test2'
define view ZTest_split2
with parameters P_Date: char6 as
select from ZTest_split(P_Date: $parameters.P_Date) left outer join bsak on FYear = gjahr and FMonth = monat
{
bukrs,
FYear,
FMonth
}
03-29-2017 1:44 PM
I want to split INPUT parameter into 2 variable and use that in condition. I don't want split it in table.
Regards,
Sandeep