on 06-24-2010 9:40 AM
Hi experts,
I had three columns and i sort on these three columns..and i need to get subtotals for these in web dynpro ALV programitically..??
Can any one help...???
Hi Prakash ,
you have to set the is_aggregation_allowed to abap_true
Alv Functions :
http://help.sap.com/saphelp_nw70/helpdata/en/7f/849e6d796d4fe49221609ffcbc357d/frameset.htm
pls look at the similar problem in below thread
Regards
chinnaiya P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakash,
Check out the below sample code. It will solve your problem.
method WDDOINIT .
DATA: lo_cmp_usage TYPE ref to if_wd_component_usage.
DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column TYPE salv_wd_t_column_ref,
ls_column TYPE salv_wd_s_column_ref.
DATA: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
DATA: lr_field_settings TYPE REF TO IF_SALV_WD_FIELD_SETTINGS,
lr_field_curr TYPE REF TO CL_SALV_WD_FIELD,
lr_field_amnt TYPE REF TO CL_SALV_WD_FIELD.
DATA: lv_aggr_rule TYPE REF TO CL_SALV_WD_AGGR_RULE.
DATA: lr_sort_rule TYPE REF TO CL_SALV_WD_SORT_RULE.
*create an instance of ALV component
lo_cmp_usage = wd_this->wd_cpuse_MY_ALV( ).
if not initialized, then initialize
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
get ALV component
lr_salv_wd_table = wd_this->wd_cpifc_MY_ALV( ).
lr_function_settings = lr_salv_wd_table->get_model( ).
get reference to column settings
lr_column_settings ?= lr_function_settings.
get all columns
lt_column = lr_column_settings->get_columns( ).
loop at columns
loop at lt_column into ls_column.
CASE ls_column-id.
when 'PRICE'.
for PRICE aggregate field
CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD EXPORTING FIELDNAME = 'PRICE' RECEIVING VALUE = lr_field_amnt.
create aggregate rule as total
CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE EXPORTING AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL RECEIVING VALUE = lv_aggr_rule.
when 'CURRENCY'. CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD EXPORTING FIELDNAME = 'CURRENCY' RECEIVING VALUE = lr_field_curr.
sub totals based on contract currency.
CALL METHOD LR_FIELD_CURR->IF_SALV_WD_SORT~CREATE_SORT_RULE EXPORTING SORT_ORDER = IF_SALV_WD_C_SORT=>SORT_ORDER_ASCENDING GROUP_AGGREGATION = ABAP_TRUE
RECEIVING VALUE = lr_sort_rule.
*hide others when OTHERS.
ls_column-r_column->set_visible( if_wdl_core=>visibility_none ).
endcase.
endloop.
endmethod.
Regards,
Susil.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.