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: 

display default value 'NA' for blank fields in ALV

Former Member
0 Kudos
287

Hi,

I want to display default value 'NA' for blank fields in ALV .I tried to populate 'NA' for blank values in internal table but it goes into dump for numeric fields and some fields are single character .pls advise.

Rgds

6 REPLIES 6

mithun_shetty4
Contributor
0 Kudos
158

if u have to display 'NA' u need to have atleast 2 character field.Without that i would not be possible

0 Kudos
158

ok..atleast tell me how to display default 'NA' without populating internal table for 2 char fields

0 Kudos
158

If you have non-character fields or 1-character fields, then the requirement is absolutely nonsensical, isn't it? You must either convert your numerics to character and convert your 1 character fields to 2 character (or is it 3 for 'N/A'). It should be obvious to even the dumbest PhD end user that a blank field means there is no value for that column and particular entity.

0 Kudos
158

ok..forget abt replacing Space with NA ,suppose there is a value 'BD' to be replaced by 'GD' in alv without modifying itab. can we achieve it ,pls tell me .

0 Kudos
158

There is no way of dynamically transforming values when generating the ALV if that is what you mean...

You will just have to loop through your itab making changes to the itab that way. If you need the original value for later processing, perhaps consider including an extra field in the itab that can store the value to be displayed (GD) while keeping the actual value (BD) in another field. Then, you can make your own field catalogue to only show the display field in the ALV

0 Kudos
158

How about defining the output length of the data element as 2 and use a conversion routine to display NA? Common practice of SAP: example MATNR, internal length 18, display length 40.