cancel
Showing results for 
Search instead for 
Did you mean: 

ALV WEbdynpro Subtotal -subtotal

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank you All.

I have resolved it by adding a column which has both fields and did a sort.

It worked!

Rgds

Prasad

Former Member
0 Kudos

Hi,

U can go through saptechnical---- /Tutorials/WebDynproABAP/Totals/ALV

madhukar..

Former Member
0 Kudos

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.

Former Member
0 Kudos

Check this thread..

Hope this helps