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: 

AVL own total

Former Member
0 Kudos
117

Hello all.

I have a ALV wich gives the totals. What i need is that those totals stay as they are and i had up another total, that is calculated by me.

How can i do that?

Thanks in advance

Nuno Silva

10 REPLIES 10

Former Member
0 Kudos
72

Hi,

why don't you try to create a ALV Footer for your total ?

check this post:

Regards,

Former Member
0 Kudos
72

Hi Nuno ,

I don't think , you can modify the logic and then display it in totals of ALV.

It could be done by adding one row as a total / subtotals row and then displaying the values accordingly in it.

Former Member
0 Kudos
72

Hi.

Even if i just add a row with my own totals is there any way i can exclude that row from the totals?

Thank you

0 Kudos
72

Hi ,

In ALV, the totals line is displayed if in the fieldcat leven for any col , do_dum is set. Else it shldn't be displayed. Also u cld exclude the sum btn in tool bar.

And add the total row manually.

BTW , iam not very clear abt ur req. Could you kindly explain it more elobarately ?

0 Kudos
72

Hello Srivijaya,

What i need is to have 2 total lines in the alv.

One wich is the actual total as is auto calculated with the DO_SUM option.

And another wich will be calcuted by me (wich is pretty much like the other but excluding some lines).

Example:

2 2 2

1 3 4

My Total 1 3 4

Total 3 5 6

So i actually want to keep the DO_SUM option in the totals row but i want to add another row with my own totals.

Thank you

0 Kudos
72

Hi again,

Then this is possibel. Add the row to the internal table which u pass to ALV.

i have pasted a part of my code where i did something similar.

FORM add_subtotal_line USING

u_tab_sub_total_line LIKE gt_outtab

u_flg_total TYPE char1.

DATA:

l_sum_eff_int_rate TYPE fti_nominal_amt_dc,

l_sum_int_rate TYPE fti_nominal_amt_dc,

l_excl_sum_nom_eff_int TYPE fti_nominal_amt_dc,

l_excl_sum_nom_int_rate TYPE fti_nominal_amt_dc,

l_sum_mac_dur TYPE fti_nominal_amt_dc,

l_sum_mod_dur TYPE fti_nominal_amt_dc,

l_wa_ldb_result TYPE fti_int_instr_data,

l_wrk_output_result TYPE fti_int_instr_data.

DATA: l_icon_name(20),

l_icon_text(140),

l_icon_res TYPE icon_text,

l_txt_1(10),

l_flg_err TYPE c.

FIELD-SYMBOLS: <fld_first> TYPE any,

<fld_second> TYPE any.

**Loop at the ldb data result & cal. int.instr.values

LOOP AT u_tab_sub_total_line INTO l_wa_ldb_result.

l_sum_nom_amt_dc = l_sum_nom_amt_dc +

l_wa_ldb_result-nominal_amt_dc.

l_sum_aqu_val_dc = l_sum_aqu_val_dc +

l_wa_ldb_result-aqu_val_dc.

ENDLOOP.

IF l_sum_nom_amt_dc NE 0.

l_wrk_output_result-med_eff_int_rate = l_sum_eff_int_rate /

l_sum_nom_amt_dc.

ELSE.

l_wrk_output_result-med_eff_int_rate = 0.

ENDIF.

  • DC values

l_wrk_output_result-nominal_amt_dc = l_sum_nom_amt_dc.

l_wrk_output_result-amaqu_val_dc = l_sum_amaqu_val_dc.

l_wrk_output_result-aqu_val_dc = l_sum_aqu_val_dc.

    • Color line

l_wrk_output_result-color_line = 'C310'.

  • populate led for eff. int. rate

WRITE l_wrk_output_result-err_eff_int DECIMALS 2 TO l_txt_1 .

IF l_wrk_output_result-err_eff_int <= p_g_high.

l_icon_name = icon_led_green.

CONCATENATE text-t01 l_txt_1 '%'

INTO l_icon_text.

ELSEIF l_wrk_output_result-err_eff_int <= p_y_high.

l_icon_name = icon_led_yellow.

CONCATENATE text-t01 l_txt_1 '%' INTO l_icon_text.

ELSE.

l_icon_name = icon_led_red.

CONCATENATE text-t01 l_txt_1 '%'

INTO l_icon_text.

ENDIF.

PERFORM create_icon USING

l_icon_name

l_icon_text

CHANGING

l_icon_res.

l_wrk_output_result-icon_eff_int = l_icon_res.

0 Kudos
72

BTW, i want to mention that u have to color the line , add any icon for subtotal manually ..depending on the req.

0 Kudos
72

But wont that affect the totals calculated by the DO_SUM option?

0 Kudos
72

Hmm.. yeah it would. In my case , i have added even the totals line manually.

Former Member
0 Kudos
72

this helps u

Creating Subtotals

Use

You can create subtotals in one or more columns in the list that are not value columns. This function is also available for fields that are not in the list.

You can create subtotals in sequential lists for column headers but not, however, for their subordinate rows.

In the order selection of Product Cost Controlling you can calculate a total of the actual costs of all manufacturing orders. You can then show the actual costs broken down into materials by forming subtotals across the material numbers.

Prerequisites

Before you can create a subtotal, you must have created a total for at least one column (see Displaying and Deleting Sums).

Procedure

Creating Subtotals for One Column

Select the columns for which you require subtotals by clicking on the column header.

Choose Subtotal or Edit ® Subtotal.

Creating Subtotals for More Than One Column

Choose Subtotal or Edit ® Subtotal. The dialog box Define Sort Order appears.

The dialog box Define Sort Order shows the fields you can create subtotals on. Fields are also available that are not shown in the list.

You can limit the fields available in the list (field catalog) by choosing a field group that contains the desired fields.

To select fields for subtotaling, select the relevant rows and choose Show selected fields (arrow key). The selected fields then appear in the dialog box as sorting fields.

The sequence in which the selected fields are shown in the dialog box determines the sequence in which subtotals are created. To change the sequence of the fields, use the functions Cut and Paste.

Specify whether the rows on which a subtotal is calculated are to be sorted ascending or descending. Also set the indicator for subtotals.

Exit the dialog box with Copy.

Deleting Subtotals

You delete subtotals as follows:

Choose Subtotal or Edit ® Subtotal. The dialog box Define Sort Order appears.

The dialog box Define Sort Order shows the fields that were selected for subtotaling.

To delete the calculation of subtotals for individual fields, select the corresponding rows in Sorting Fields in the dialog box, and choose Hide Selected Fields (arrow key). The selected fields then appear in the dialog box under Field List.

Exit the dialog box with Copy.

Depending on the list, the subtotals rows may contain information in addition to that of the summation level, if a number of stars ("*") are shown. The texts can only be viewed if the lead column was wide enough when it was selected in the current layout (see Changing Layouts).

There is no specific text for the first column of the list. The content of the columns that were totaled is always repeated.

Depending on the list, the subtotals can also be shown above the subtotaled rows. This is only possible with single-level lists.

The list status function gives you an overview of the fields for which subtotaling was defined.