ABAP supports supressing zeroes from the input data. It increases the readability and understandability.
NO-ZERO command used to supress the leading zeroes from the number field. NO-ZERO only suppresses the zeroes while displaying.
NO-ZERO not replaces the value in the actual numeric field. NO-ZERO applies on only numeric fields.
Syntax –
WRITE numeric-field NO-ZERO.
Example –
Write a program to display numeric value with and without NO-ZERO function.
Code –
REPORT Z_NOZERO.
DATA: W_N1(10) TYPE N VALUE 70.
WRITE : 'Displaying numeric data without NO-ZERO: ',W_N1.
SKIP 2.
WRITE : 'Displaying numeric data with NO-ZERO: ',W_N1 NO-ZERO.
Output –
Explaining Example –
W_N1(10) TYPE N VALUE 70 – initializes W_N1 with 70.
WRITE : ‘Displaying numeric data without NO-ZERO: ‘,W_N1. – displaying the entire value which includes leading zeroes.
WRITE : ‘Displaying numeric data with NO-ZERO: ‘,W_N1 NO-ZERO. – displaying the value without leading zeroes.