‎2019 Aug 30 4:47 PM
Hi,
I am looking to create a CDS with parameters and perform a like operation on the parameter. But I can't get the correct syntax. Any help would be appreciated.
@AbapCatalog.sqlViewName: 'zviewshipnum'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Get shipment numbers like the parameter'
define view zcds_view_shipment_num
with parameters p_shipNum : abap.Lang,
p_haulier : TSPID
as select from /SCMTMS/D_TORROT {
TOR_ID
}
where TOR_ID like CONCAT('%', '%')
‎2019 Sep 02 3:09 PM
Looks like this is not possible. The error message and documentation say "Comparison value of LIKE condition must be a character-type literal". No variables/functions can be used here.
So you have to use the LIKE in the where statement of the calling select.
SELECT tor_id FROM zcds_view_shipment_num
INTO TABLE @DATA(tor_ids)
WHERE tor_id LIKE 'Whatever%'
‎2019 Sep 03 1:55 AM
maybe you could try instr( tor_id, :parameter ) function instead (i think it for abap 7.50+).