Skip to Content
0

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

Mar 29, 2017 at 07:24 AM

344

avatar image
Former Member

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

cds-in-para.jpg (63.9 kB)
10 |10000 characters needed characters left characters exceeded
Former Member

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

split.jpg (20.8 kB)
cds-in-para.jpg (80.5 kB)
0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Horst Keller
Mar 29, 2017 at 07:39 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Sean Zhang
Mar 29, 2017 at 09:59 AM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

split.jpg (20.8 kB)
cds-in-para.jpg (80.5 kB)
0

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

}

0