Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

subtotal calculation

Former Member
0 Likes
504

Hello,

How to calculate the subtotal through ABAP OOPS method.

The Subtotal needs to be changed to custom value. For eg: if there are values +m, -n, +o

The subtotal should include only m and o. (m+o). The calculated subtotal needs to be changed to desired valued based on condition.

please provide the solution << priority normalized >>

Edited by: Rob Burbank on Jul 12, 2011 2:41 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
465

Hi,

Just to make sure, I have understood the problem correctly. You want to change the value of the totals or subtotals in ALV output.



data : go_grid_mark  TYPE REF TO cl_gui_alv_grid,
          lv_totals TYPE REF TO data.

CALL METHOD go_grid_mark->get_subtotals
      IMPORTING
        ep_collect00 = lv_totals.

ASSIGN lv_totals->* TO <ft_totals>.

   LOOP AT <ft_totals> ASSIGNING <fs_total>.
      ASSIGN COMPONENT 'SOME_FIELD' OF STRUCTURE <fs_total> TO <fv_total>.
<fv_total> = "SOME VALUE".
modify <ft_totals> from <fs_total>
    ENDLOOP.

Hope this helps.

Regards,

Sagar

2 REPLIES 2
Read only

Former Member
0 Likes
466

Hi,

Just to make sure, I have understood the problem correctly. You want to change the value of the totals or subtotals in ALV output.



data : go_grid_mark  TYPE REF TO cl_gui_alv_grid,
          lv_totals TYPE REF TO data.

CALL METHOD go_grid_mark->get_subtotals
      IMPORTING
        ep_collect00 = lv_totals.

ASSIGN lv_totals->* TO <ft_totals>.

   LOOP AT <ft_totals> ASSIGNING <fs_total>.
      ASSIGN COMPONENT 'SOME_FIELD' OF STRUCTURE <fs_total> TO <fv_total>.
<fv_total> = "SOME VALUE".
modify <ft_totals> from <fs_total>
    ENDLOOP.

Hope this helps.

Regards,

Sagar

Read only

0 Likes
465

As you said , I am able to change the subtotal. But total is not getting changed.

How to calculate the Total based on subtotal. As of now, the total is based on the values of the column.

Total field needs to be changed to custom value(sum of changed subtotals)

please let me know the solution.