Skip to Content

CDS View join table with asterisk values

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.

Regards

Fabian

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • 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

    Regards

    Rajkumar Narasimman

    Add comment
    10|10000 characters needed characters exceeded