Application Development and Automation 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: 
Read only

ALV cell dynamic zero/space

Former Member
0 Likes
545

Dear SAP friends,

Here is an internal table:

DATA : BEGIN OF it_rpt_ln,
         doc_type(2),
         days_chck_base  TYPE i,
       END OF it_rpt_ln.
DATA: it_rpt     LIKE TABLE OF it_rpt_ln.

What is the way to tell the ALV grid at the runtime that I want it_rpt_ln-days_chck_base to:

- display value '0' as '0' for row 1.

- display value '0' as Space for row 2.

The problem is that if I define the column for this field in the fieldcatalog as

lvc_s_fcat-no_zero     = 'X'

then the field will be always displayed as space even if the field value is zero.

I need to display Zero for one cell and Space for another cell on the same column depending on condition.

We can tell ALV how to color cells by adding a structure field into the Internal Table:

color_cell   TYPE lvc_t_scol   " Cell color 

We can tell ALV the style of a specific cell by adding a structure field into the Internal Table:

cellstyles  TYPE lvc_t_styl     " Cell styles 

But what about zero/space?

Please note that:

- field days_chck_base has to be of TYPE i . Otherwise the Total button will not work for this column.

Thank you

Tatyana

1 REPLY 1
Read only

Former Member
0 Likes
340

hi,

please take a look at the quick reference [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

on topic "Controlling Data Changes" you can see how to modify each cell.