Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to split input parameter in CDS View?(ABAP on HANA)

Former Member
0 Kudos

Hi All,

I am creating CDS view using parameter.

In that, I want to split input parameter.

Please go through image.

cds-in-para.jpg

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

5 REPLIES 5

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Check if an appropriate SQL-function is available in your release.

Sean_Zhang
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.

0 Kudos

I want to split parameter into 2 variable and use that in condition. I don't want split it in table.

split.jpg

cds-in-para.jpg

Sean_Zhang
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

}

Former Member
0 Kudos

I want to split INPUT parameter into 2 variable and use that in condition. I don't want split it in table.

split.jpg

cds-in-para.jpg

Regards,

Sandeep