Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid zeros in output for a field with Decimal type

Former Member
0 Kudos

Hi Friends

In a Report one output field is declared with decimal type.

Whenver that field is not filled with any values zeros will be displayed in the output.

I tried to change the data type to char but i am facing some issues in calculations and shwoing only 2 decimal places.

So is there any way to hide the zeros in the output if we the field is not filled with any value.

6 REPLIES 6

Former Member
0 Kudos

Hi Amit,

Let's say p_lc is ur decimal variable u want to dislay using the write statement.

try to use the below way:

write : p_lc no-ZERO.

0 Kudos

Hi,

Here the ouput is displayed through ALV function modules only.

But the program is copy of some standard program and we can not modify any statements.

I am not displayint the ouput through write statement write no-zero also work.

If we able to modify internal table values to non zero values then we can get a solution to the issue.

I have tried no-zero but it has not wroked.

0 Kudos

Hi Sandeep,

If required field type is declared as type p decimals 2 , if for that field in internal table there is no value - then automatically output will get display in ALV as 0.00.

To remove 0.00 in the output screen and to be displayed in blank then in the field catalogue add wa_fieldcat-no_zero = 'X'. in that particular field. then if no value for that field then it will display space in the output.

wa_fieldcat-fieldname = 'ZQUAN'.

wa_fieldcat-seltext_l = 'Quantity'.

wa_fieldcat-outputlen = '13'.

wa_fieldcat-no_out = ' '.

wa_fieldcat-no_zero = 'X'. wa_fieldcat-hotspot = ' '.

wa_fieldcat-key = ' '.

wa_fieldcat-do_sum = 'X'.

wa_fieldcat-qfieldname = ' '.

wa_fieldcat-ref_tabname = ' '.

wa_fieldcat-just = ' '.

Regards,

Priya

0 Kudos

Hi,

To display the output the final internal table passed to the standard program rsaqexce.

Inside that ALV function modules are called. So we don't have control on ALV function module to change the paratmeters.

Before passing the final internal table to the standard program if we have any option to avoid zeros the issue will be resolved.

Thanks for all for providing different solutions. It will be great if i get suitable solution for my issue.

Former Member
0 Kudos

Hi ,

Use the NO-ZERO in write statement where there is zeros it will display empty space if there is any value it will display the value.

1. Data a type c length 5 value '0000'.

Eg: Write : / a no-zero.

o/p : empty (no zeros will display it will hide).

2 . Data a type c length 5 value '0100'.

Eg: Write : / a no-zero.

o/p : 100 (no zeros will display it will hide).

former_member458055
Participant
0 Kudos

Hi,

Please specify the report type.

If it is ALV.

Then use l_fieldcat-no_zero = 'X'.

- Regards,

Makarand Tale