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: 

Regarding SALV

Former Member
0 Kudos

Hi All,

I'm using SALV to display a list. I'm using aggregation function for MENGE field.

But the list displayed is not the showing the Unit of measure field after aggregation.

Can u please tell me how to display it?

Thanks & Regards

Santhosh

Message was edited by:

Santhosh DS

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please review this example, notice here that since I am defining the internal table manually using the TYPES statement, that means I also have to tell the ALV that the DISTID(uom field) is the UOM field for the field DISTANCE. I believe that you will need to do something simular.




REPORT  zrich_0001.


Types: begin of t_spfli,
       CARRID type spfli-carrid,
       CONNID type spfli-connid,
       COUNTRYFR type spfli-countryfr,
       CITYFROM type spfli-cityfrom,
       AIRPFROM type spfli-airpfrom,
       COUNTRYTO type spfli-countryto,
       CITYTO type spfli-cityto,
       AIRPTO type spfli-airpto,
       FLTIME type spfli-fltime,
       DEPTIME type spfli-deptime,
       ARRTIME type spfli-arrtime,
       DISTANCE type spfli-distance,
       DISTID type spfli-distid,
       end of t_spfli.

data: ispfli type table of t_spfli.

data: gr_table     type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display   type ref to cl_salv_display_settings.
data: gr_columns   type ref to cl_salv_columns_table.
data: gr_column    type ref to cl_salv_column_table.
data: gr_sorts     type ref to cl_salv_sorts.
data: gr_agg       type ref to cl_salv_aggregations.


start-of-selection.

  select * into CORRESPONDING FIELDS OF TABLE ispfli from spfli.


  cl_salv_table=>factory( importing r_salv_table = gr_table
                           changing t_table      = ispfli ).

  gr_functions = gr_table->get_functions( ).
  gr_functions->set_all( abap_true ).


* Tell the ALV that the DISTID is the UOM field for the DISTANCE field.
  gr_columns = gr_table->get_columns( ).
  gr_column ?= gr_columns->get_column( 'DISTANCE' ).
  gr_column->SET_QUANTITY_COLUMN( 'DISTID' ).


  gr_sorts = gr_table->get_sorts( ).
  gr_sorts->add_sort( columnname = 'CITYTO' subtotal = abap_true ).

  gr_agg = gr_table->get_aggregations( ).
  gr_agg->add_aggregation( 'DISTANCE' ).

  gr_table->display( ).

Regards,

Rich Heilman

0 Kudos

Hi,

Rich. Thanks for new info.

gr_column->SET_QUANTITY_COLUMN( 'DISTID' ).