cancel
Showing results for 
Search instead for 
Did you mean: 

How to display leading zeros in RAP Fiori App key field?

HugoJ
Advisor
Advisor
182

Hi, I'm implementing a RAP-based Fiori Application in S/4HANA On-Prem.

My current issue is figuring out how to display the main Key field - Document Number - with leading zeros. It is a NUMC 10 field in the database, with output length 10 in the domain.

How it currently displays:

HugoJ_3-1719100411344.png

How I would like it to display:

HugoJ_2-1719100365532.png

I have tried to create a duplicate field in the main CDS View and force the leading zeros:

key docnr                                     as Docnr,
cast(lpad(docnr,10,'0') as abap.char(10))     as DocnrLong,

However the frontend seems to always delete the leading zeros, maybe if I change something in BAS files, like formatter.js, is there a way?

Thank you

junwu
Active Contributor
did you check what the odata return for DocnrLong? are you sure your UI field is bound to DocnrLong?
HugoJ
Advisor
Advisor
0 Kudos
Thanks for your reply junwu, apparently it was just a matter of cache cleanup. The solution I presented is already okay.
View Entire Topic
HugoJ
Advisor
Advisor
0 Kudos

Solution provided in the original question was already OK.