Skip to Content
0

CDS View - Appending 0 to a variable

Apr 25, 2017 at 02:40 PM

73

avatar image
Former Member

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 )

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

1 Answer

Best Answer
Horst Keller
Apr 25, 2017 at 03:06 PM
1

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

Share
10 |10000 characters needed characters left characters exceeded