Skip to Content
0

Passing paramer in ABAP CDS Views

Aug 24, 2017 at 06:55 AM

50

avatar image

Hi Experts,

I am new to CDS , am getting below error while passing a parameter for LIKE is Where clause.

Error : The Like condition can only contain character like comparison values.

pstatus is character type. So am confused here.

And also i wanted a new column for some constant values , which is not part of the table (zmm_temp).

@AbapCatalog.sqlViewName: 'ZV_MY_REQ'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Get All Request Based on User and Status'
define view ZCDS_REQUESTS with parameters pusername : syuname ,
                               pstatus : abap.char( 5 )
as select from zmm_temp 
{   
req_id,
title 
} where requested_by = :pusername and status like :pstatus

Request your quick help .

Thanks in Advance

Aisurya

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Aug 24, 2017 at 07:12 AM
0

If you are new, it is a good idea, to learn to read the documentation (F1-help).

Only character-like literals without domain prefix are allowed for rhs.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks.

The lhs and rhs are of same type which am passing. But still the error.

0

Sigh, please read the documentation ...

Only literals are allowed, no parameters ...

0

Hello Horst,

Is this means I cannot use a string dynamically to use in WHERE clause for LIKE operation?

Even by converting the parameter data type using a CONCAT(), etc function...

I actually wonder how I can filter for example materials starting with 'M' for example, so I want to use WHERE clause similar to " matnr like 'M%' "

But of course I want to pass M as a parametric value

0