Skip to Content

CDS View - Appending 0 to a variable

In CDS view, I have to pass prps.psphi in the output appending 0s to it and have to make it upto 24 char and then I need to concatenate the value with EBELN. I am facing two problems regarding this.

1. Appeding 0 to the variable of shorter length.

2. While concatenating its taking the internal numeric number with it. means -

I have written - "concat( prps.psphi , ekkn.ebeln ) end as uniquekey,"

I am getting data like - "000045664000000001"

(Where - prps.psphi = 00004566 & ekkn.ebeln = 4000000001 )

but I want - "0000000000000ABCDE.LOO184000000001"

(Where - external value of PRPS.PSPHI - ABCDE.LOO18 & ekkn.ebeln = 4000000001 )

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 25, 2017 at 03:06 PM

    Use the CAST operator to cast the intermediate types to something that fits your purpose. Think about using LPAD and other functions.

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abencds_f1_cast_expression.htm

    Add comment
    10|10000 characters needed characters exceeded