‎2011 Jan 30 5:41 AM
I know there are a lot of threads that talk about padding zeros, but I could not find the solution to my prolem by seraching threads.
Here it is ... how do convert below ...
123.99 to 0123.99
23.99 to 0023.99
2.99 to 0002.99
I want that single statement to dynamically pad zeros before the numbers, can MASK EDIT do it? or CONVERSION_EXIT_ALPHA_INPUT, or do I need to use SHIFT statement or something else?
Please suggest, a small code snippet would be greatly appreciated!
Thanks,
‎2011 Jan 30 10:23 AM
Hi,
You can use function module 'HRPBSNO_FORMAT_ZERO' for adding zeros to left.
Data: pfield1 TYPE p DECIMALS 2 VALUE '123.99',
cfield1(20) type c.
cfield1 = pfield1.
CALL FUNCTION 'HRPBSNO_FORMAT_ZERO'
EXPORTING
left = '4'
right = '2'
in_separator = ' '
out_separator = '.'
CHANGING
str = cfield1.
Hope this helps,
‎2011 Jan 30 10:23 AM
Hi,
You can use function module 'HRPBSNO_FORMAT_ZERO' for adding zeros to left.
Data: pfield1 TYPE p DECIMALS 2 VALUE '123.99',
cfield1(20) type c.
cfield1 = pfield1.
CALL FUNCTION 'HRPBSNO_FORMAT_ZERO'
EXPORTING
left = '4'
right = '2'
in_separator = ' '
out_separator = '.'
CHANGING
str = cfield1.
Hope this helps,
‎2011 Jan 30 5:33 PM
Hi Frozen Monkey,
use WRITE, press F1m check USING EDIT MASK option.
Regards,
Clemens