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: 

ALV Salv - show blank space to quan fields with initial value

bruno_franzini1
Explorer
0 Kudos
1,053

Hi,

Please, can anyone tell me a way to show blank spaces into SALV ALV cells that have initial values like '0.00'.

I read about REUSE_ALV_GRID_DISPLAY into layout you have to use NO_ZERO.

What's the corresponding for NO_ZERO of REUSE_ALV_GRID_DISPLAY for SALV ALV? What method to use for achieve that goal?

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
174

Hi Bruno,

Try using set_zero method of column, as below:

CALL METHOD cl_salv_table=>factory

   IMPORTING

     r_salv_table = o_alv

   CHANGING

     t_table      = it_data.

lo_columns = o_alv->get_columns( ).

lo_column = lo_columns->get_column( 'QUANTITY' ).

lo_column->set_zero( abap_false ).

o_alv->display( ).

4 REPLIES 4

venuarun
Active Participant
0 Kudos
174

Hi Bruno,

In your fieldcatalog you can set Fieldcat-NO_ZERO = 'X'. So it will display initial zeros in your output.

With Regards

Arun VS

Former Member
0 Kudos
175

Hi Bruno,

Try using set_zero method of column, as below:

CALL METHOD cl_salv_table=>factory

   IMPORTING

     r_salv_table = o_alv

   CHANGING

     t_table      = it_data.

lo_columns = o_alv->get_columns( ).

lo_column = lo_columns->get_column( 'QUANTITY' ).

lo_column->set_zero( abap_false ).

o_alv->display( ).

VenkatRamesh_V
Active Contributor
0 Kudos
174

Hi Bruno,

FM Reuse_alv_grid_display.

wa_fcat-no_zero = 'X'.

SALV

DATA :  gr_table      TYPE REF TO cl_salv_table,

             gr_columns type ref to cl_salv_columns_table,

             gr_column  type ref to cl_salv_column_table,

             lx_msg     TYPE REF TO cx_salv_msg.

TRY.

         CALL METHOD cl_salv_table=>factory(

           IMPORTING

             r_salv_table = gr_table

           CHANGING

             t_table      = it_final ).

       CATCH cx_salv_msg  INTO lx_msg.

     ENDTRY.

gr_columns = gr_table->get_columns( ).

TRY.

         gr_column ?= gr_columns->get_column( 'RDTOT' ).

         CALL METHOD gr_column->set_short_text( 'T.Countrdg' ).   "#EC NOTEXT

         CALL METHOD gr_column->set_medium_text( 'Tot.Count.Rdg' ). "#EC NOTEXT

         CALL METHOD gr_column->set_long_text( 'Total Counter Reading' ). "#EC NOTEXT

         CALL METHOD gr_column->set_zero

           EXPORTING

             value = if_salv_c_bool_sap=>false.

       CATCH cx_salv_not_found.                          "#EC NO_HANDLER

     ENDTRY.

Hope it helpful,

Regards,

Venkat.V

bruno_franzini1
Explorer
0 Kudos
174

Hi,

Tiki Patra and VenkatRamesh V  both of you helped a lot, it worked fine.

Thanks.