on 01-05-2010 7:33 PM
Hi,
I am already subtotalling ALV report using a field PSPID.(Project number)
but I want to subtotal again on KSTAR.
When I do this follwing code it is not subtotalling in the way i need.
I mean respective cost elements are not tying up..
Present output.
PSPID KSTAR
100 54000
200 54000
300 54000
100 54600
200 54600
300 54600
Required output
PSPID KSTAR
100 54000
100 54600
200 54000
200 54600
300 54000
300 54600
Here is the code.
lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
lr_function_settings = lr_salv_wd_table->get_model( ).
lr_column_settings ?= lr_function_settings.
lt_column = lr_column_settings->get_columns( ).
LOOP AT lt_column INTO ls_column.
CASE ls_column-id.
WHEN 'PSPID'.
CALL METHOD lr_function_settings->if_salv_wd_field_settings~get_field
EXPORTING
fieldname = 'PSPID'
RECEIVING
value = lr_field_curr1.
* * create aggregate rule as total
CALL METHOD lr_field_curr1->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.
WHEN 'KSTAR'.
CALL METHOD lr_function_settings->if_salv_wd_field_settings~get_field
EXPORTING
fieldname = 'KSTAR'
RECEIVING
value = lr_field_curr2.
* * create aggregate rule as total
CALL METHOD lr_field_curr2->if_salv_wd_sort~create_sort_rule
EXPORTING
sort_order = if_salv_wd_c_sort=>SORT_ORDER
group_aggregation = abap_true
RECEIVING
value = lr_sort_rule.
ENDCASE.
ENDLOOP.
Thank you All.
I have resolved it by adding a column which has both fields and did a sort.
It worked!
Rgds
Prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U can go through saptechnical---- /Tutorials/WebDynproABAP/Totals/ALV
madhukar..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this blog [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5?quicklink=index&overridelayout=true]. It may help.
Why have you written aggregation ruke for KSTAR. I dont think thats required.
BR,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.