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: 

how to write code for totals and subtotals in alv programing?

Former Member
0 Kudos

how to write code for totals and subtotals in alv programing?

5 REPLIES 5

Former Member
0 Kudos

Hi,

Please refer,

Regards,

Hema.

    • Reward points if it is useful.

Former Member
0 Kudos

Just set the DO_SUM parameter in the field catalog to 'X' and sort on the field based on which you want the sub-totals.

Check package SLIS for examples.

Former Member
0 Kudos

hai

in slis_T_fieldcat_alv in that table u have field named DO_SUM = 'X' set this for

the field which are u want to calculate total.

for subtotal in slis_t_sortinfo_alv in that structure u have field named

SUBTOT = 'X' set this field which are u want to calculate subtotal.

Former Member
0 Kudos

Hi.

Totals :

while populating the fieldcat add one more field(DO_SUM) for which field u want total.

WA-FIELDNAME = ' '.

WA-SELTEXT_M = ' ' .

WA-DO_SUM = 'X'.

APPEND WA TO I_FIELDCAT.

CLEAR WA.

Subtotals.

Create internal table and wa type SLIS_T_SORTINFO_ALV.

and populate this internal table like this.

WA-FIELDNAME = ' '.(for which field u want subtotal)

WA-UP = 'X' (sorting)

WA-SUBTOTAL = 'X'.

APPEND WA TO I_SORT.

CLEAR WA.

and pass this internal table to I_SORT of REUSE_ALV_GRID_DISPLAY function module.

Thanks,

Srinivas