How to Remove Preceeding Zeros in ABAP Development
I have developed a simple ABAP report / ABAP program which displays the contents of an SAP table on screen and writes the total number of lines or total number of records in the related SAP table on the screen.
The output of the ABAP program where I write the lines number of the sample SAP table SAPLANE is as follows :
As seen in the above screenshot, for a better result we have to remove the preceeding zeros using various methods in ABAP.
Sample ABAP Code for Removing Preceeding Zeros
Here is the source code of an ABAP program which requires to be corrected in order to display the lines count without preceeding zeros.
Remove Preceeding Zeros using SHIFT LEFT DELETING LEADING
Calling the SHIFT ... LEFT DELETING LEADING '0' is a nethod that can be implemented in ABAP codes in order to delete the zeros before the integer part of the variable.
And the solution is as simple as using the SHIFT ... LEFT DELETING LEADING '0' ABAP code before CONCATENATE command call.
Remove Preceeding Zeros by Calling CONVERSION_EXIT_ALPHA_OUTPUT funcion
To call the CONVERSION_EXIT_ALPHA_OUTPUT function is an other solution for removing preceeding zeros.
Here is how the function CONVERSION_EXIT_ALPHA_OUTPUT is called with parameters.