Skip to Content

CDS View join table with asterisk values

Mar 21 at 09:29 AM


avatar image

Hello Experts,

i would like to start using more CDS View but i have small problem.

I would like to check if a value is like a value in a customizing table.

The values in the customizing table would be for example mvgr1 = '3*', mvgr1 = '4*'

Something like this:

as select from vbap
inner join zzc_table on vbpa.mvgr1 like zzc_table.mvgr1<br>

If i had only a single asterisk value i would select with

where mvgr1 like '3%'

but the pattern should be edited in the customizing table.

In ABAP i could use range tables with the CP option.



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

1 Answer

Rajkumar Narasimman Mar 21 at 10:58 AM

Hi Fabian Schmidt,

In ABAP i could use range tables with the CP option.

Hope you can try the same range table concept in CDS also. Create one more CDS view and get first the letter in the zzc_table.mvgr1 variable using SUBSTRING function and using CONCAT function merge '%' into the same variable as shown below.

define view ZCDS_ZZCTABLE
as select from zzc_table as _zc
  CONCAT(SUBSTR(_zc.mvgr1,1,1),'%')     as MatGroup,

and use the above CDS view into the existing CDS view and do the inner join like below.

as select from vbap
innerjoin ZCDS_ZZCTABLE on vbpa.mvgr1 like ZCDS_ZZCTABLE.MatGroup


Rajkumar Narasimman

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

Hi Rajkumar,

thanks for your reply.

Unfortunately i get an syntax error if i try to use like in the join with a tablefield.

compare value with like-condition must be a character-like literal. (translated by myself from German).

Looks like the like-condition could only be with parameters or manual constants.




It looks LIKE supports character literal 'A%' externally in select statement(SQL). Passing the same value in field it is not working. It is better to double check with @horst.keller