Application Development 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: 

percentage in alv report

Former Member
0 Kudos

Hi Expert,

In alv report percentage calculation.Here we have a problem, In total column it will adding the fields

in percentage column, but i want to calculate the percentage in run time.

Example:

A B %*100

-


-


-


10 20 20%

20 40 20%

-


-


-


TOTAL: 30 60 40 -


>it is a total but not percentage

-


-


-


Thank you,

Dinesh.

4 REPLIES 4

former_member226519
Active Contributor
0 Kudos

try to pass 'A' or 'P' instead of 'X' to fieldcat parameter "DO_SUM".

Former Member
0 Kudos

Hi,

1. In the ALV output tab add extra fields that are the same as those on which you are sorting and contain the same values.

2. In the Field Catalog you must add these fields but they must be hidden i.e. no_out = 'X'.

3. These fields must be included in the Sort Catalog with subtot = 'X'.

4. In order to handle the final total line in your layout for the ALV you must set field no_totalline'X' because you are going to be taking this over as well.

5. Create a form called SUBTOTAL_TEXT or similar structured as follows:

form subtotal_text using ep_subtot_line like output_tabes_subtottxt type slis_subtot_text.

In this form you will do the percentage calculation again at total level. The structure ep_subtot_line

will contain a field for each of the fields in your output_tab i.e. ep_subtot_line-sales,

ep_subtot_line-cost and ep_subtot_line-margin. Put the margin calculation into ep_subtot_line-margin.

6. In the eventtab that you pass to the ALV_GRID function module you must create a record with the

field name = 'SUBTOTAL_TEXT' and the field form = the name of the form you created in step 5 above.

Former Member
0 Kudos

answered

0 Kudos

hi Dinesh,

how did you get the percentage in the subtotals and total.

Many thanks,

aashta