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

How to use Aggregations Method generated by WIZARD

Former Member
0 Likes
629

Hi All,

I used ABAP wizard to develop I report.

This wizard generated one class and method as below


  zcl_bt_alv_template=>factory(
                 exporting  im_syrepid = sy-repid
                            im_lheader = gv_title
                            im_allowls = abap_true  " Allow layout save
                 importing  ex_alvo    = r_alv_template
                 changing   ch_datatab = it_efficiency ).

Inside this Factory Method there is one method for aggregations.


  ex_alvo->r_aggregations = ex_alvo->r_table->get_aggregations( ).

How to use this Method for getting aggregations for some fields.

Thanks,

Prasad.

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
548

It looks like the attribute R_TABLE is an instance of the CL_SALV_TABLE and r_aggregations is an instance of the cl_salv_aggregations.

To get the total on any column using this aggregation object, you need to call method ADD_AGGREGATION. Like:


*   Total for the Amount
    TRY.
        r_aggregations->add_aggregation(
           columnname  = 'DMBTR'
           aggregation = if_salv_c_aggregation=>total ).
      CATCH cx_salv_data_error .                        "#EC NO_HANDLER
      CATCH cx_salv_not_found .                         "#EC NO_HANDLER
      CATCH cx_salv_existing .                          "#EC NO_HANDLER
    ENDTRY.

Regards,

Naimesh Patel

Read only

0 Likes
548

Hi Patel,

I am getting DUMP for this.

Its saying Access via 'NULL' object reference not possible.

Patel when I am double clicking the


aggregation = if_salv_c_aggregation=>total

This if_salv_c_aggregation is not having any methods.

So may be the dump is coming.

The dump is


You attempted to use a 'NULL' object reference (points to 'nothing')
access a component (variable: "R_AGGREGATIONS").

Thanks,

Prasad.

Edited by: Dheeru Prasad on Aug 6, 2009 3:36 PM

Edited by: Dheeru Prasad on Aug 6, 2009 3:39 PM

Edited by: Dheeru Prasad on Aug 6, 2009 3:40 PM

Read only

Former Member
0 Likes
548

Hi Patel I used Normal ALV for this..