cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CDS Parameter without leading zero

hassin
Explorer
0 Kudos
7,737

Hello Guys,

I have a question about the use of parameters in my CDS Code.

For example I'm want to search via parameter a specific material.

In our DB all material have leading zeros.

But I want to enter the materialnummer without the leading zero.

Down you can see my code, hava you idea/tip how I can solve this problem?

Regads

Hassin

@AbapCatalog.sqlViewName: 'ZCS_MARA_PARA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'VDS View with Parameter'

define view ZCS_MARA_Test1_PARA
    with parameters p_matnr : matnr, p_ernam : ernam
as select from ZCP_MARAView_Test1 

{
    //ZCP_MARAView_Test1
    ltrim(matnr,'0')    as Materialnummer,
    ersda               as Angelegt_Am,
    ernam               as Angelegt_Von,
    laeda               as Geaedert_Am,
    aenam               as Geaendert_Von
}
where   matnr = :p_matnr
View Entire Topic
hassin
Explorer

To solve this issue you have to use "ltrim(matnr,'0') as Matnr_Test" one view before.