‎2009 Aug 06 1:44 PM
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.
‎2009 Aug 06 2:09 PM
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
‎2009 Aug 06 2:34 PM
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
‎2009 Aug 06 4:38 PM