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

Modifying calculated subtotal in ALV

Former Member
0 Likes
774

Hi experts,

I am calculating subtotal for a column in ALV but I want to manipulate the default calculated subtotal value by dividing it by a number before displaying it in ALV.

Please help.Its urgent.

Thanks in advance.

Regards,

Vinaya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

Hi Vinaya,

You cannot do that.

If you want the AVERAGE instead of total, then you have to set

DO_SUM = 'C'. in the field catalog for that value.

Regards,

Ravi

Hi experts,

I am calculating subtotal for a column in ALV but I want to manipulate the default calculated subtotal value by dividing it by a number before displaying it in ALV.

Please help.Its urgent.

Thanks in advance.

Regards,

Vinaya.

5 REPLIES 5
Read only

Former Member
0 Likes
708

I am not clear about ur requirement,in alv subtotals,it is possible only column wise and not in row wise.

Let me take one example

On the subtotal and grand total line want to do arithmatic calculations on two fields to be displayed as the total of the third field.

The above case ALV is not possible.

Thanks

Seshu

Read only

0 Likes
708

yes, it's possible by calling dynamic form SUBTOTAL_TEXT in IT_EVENT of the alv display:

Follow the following steps:

1. Call dynamic form FORM subtotal_text USING p_sub_final TYPE ts_final

p_subtottxt TYPE slis_subtot_text.

Where p_sub_final work area contain the subtotal values , ts_final is the final int table

Modify the field which u want to modify.

Also don’t forget to code the following at the time of event handling.same as top-of-page

2.READ TABLE it_events INTO is_event WITH KEY name = slis_ev_subtotal_text

BINARY SEARCH .

IF sy-subrc = 0.

  • For TOP_OF_PAGE Event, the Subroutine to be Called is SUB_TOP_OF_PAGE

MOVE “SUBTOTAL_TEXT’ TO is_event-form.

MODIFY it_events FROM is_event INDEX sy-tabix .

CLEAR is_event .

ENDIF.

ENDIF.

try this.......it will work

thanks

PR R

Read only

0 Likes
708

Hi,

I am working with the SUBTOTAL_TEXT but i've an error with

TYPE ts_final, when i run the program this is giving me an error, the system show the next message: "This type ts_final it`s unknown". Please i need urgent help with this. If you can give me the abap code to have a work reference.

thanks. .:Liordi:.

Read only

Former Member
0 Likes
709

Hi Vinaya,

You cannot do that.

If you want the AVERAGE instead of total, then you have to set

DO_SUM = 'C'. in the field catalog for that value.

Regards,

Ravi

Read only

Former Member
0 Likes
708

Hi,

Me too faced the same problem, but was not able to trigger the dynamic form SUBTOTAL_TEXT,

Is any prerequiste to trigger this event?

Thanks

sandeep