cancel
Showing results for 
Search instead for 
Did you mean: 

About Alv Total and sub-total

Former Member
0 Kudos

hi, all

How can i use the total and sub-total in alv for web dynpro?

Thanks for your help!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Answers (1)

Answers (1)

Madhu2004
Active Contributor
0 Kudos

hai,

Here in i tried for the sub total of amount for each Billing document and grand total for all the billing documents:

code is as follows:

data:

lr_field_settings type ref to if_salv_wd_field_settings.

lr_field_settings ?= l_value.

lr_field_settings->set_group_aggr_displayed( abap_true ).

*...Sort Field Billing Document

data:

lr_field type ref to cl_salv_wd_field,

lr_sort_rule type ref to cl_salv_wd_sort_rule,

lr_aggr_rule type ref to cl_salv_wd_aggr_rule.

lr_field_settings ?= l_value.

lr_field = lr_field_settings->get_field( 'BILL_DOC' ).

lr_field->if_salv_wd_sort~set_group_aggregation_allowed( abap_true ).

lr_field->if_salv_wd_sort~create_sort_rule( ).

lr_sort_rule = lr_field->if_salv_wd_sort~get_sort_rule( ).

lr_sort_rule->set_sort_order( if_salv_wd_c_sort=>sort_order_ascending ).

lr_sort_rule->set_group_aggregation( abap_true ).

*...Aggregate Field Amount

lr_field = lr_field_settings->get_field( 'AMOUNT_OUTPUT' ).

lr_field->if_salv_wd_aggr~create_aggr_rule( ).

lr_aggr_rule = lr_field->if_salv_wd_aggr~get_aggr_rule( ).

lr_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).

I hope this will be help ful.

cheers,

Madhu