Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CDS View - Appending 0 to a variable

sabarna17
Contributor
0 Kudos

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 )

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert

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_ex...

1 REPLY 1

horst_keller
Product and Topic Expert
Product and Topic Expert

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_ex...