2022 Jul 07 1:35 PM
i am a beginner in ABAP so i am using an online ABAP editor to practise.
my question is the zeros are automatically suppresses without using the no-zero.
for eg:
data num1 type i.
num1 = 000040.
write num1.
*now without using no-zero, all the zeros in 00040 are removed in the output.
what i don't understand is that is it because of the editor or any other reason?
a help will be appreciated 🙂
2022 Jul 07 1:45 PM
Hi,
this is normal. WRITE uses several conversions to format the output to the user (in some cases based on the personal preferences of the user, e.g. the format of a decimal number or date-display).
In your case, you use an integer variable, for this type SAP does not show the leading zeros in this case.
Kind regards
Jens
2022 Jul 07 1:47 PM
NO-ZERO only works for types C, N or string.
No effect on type i, as in your case.
2022 Jul 08 4:50 PM
Abap use some Conversion Rules for Elementary Data Objects to convert elements, in case of WRITE target is a character type field.
Your field is of type Integer, so look at Conversion Rules for Elementary Data Objects, Numeric Source Fields, Source Field Type i, int8, (b, s), Character-Like Target Fields