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: 

subtotal in ALV

Former Member
0 Kudos

i need to have subtotal based on location. how can i do subtotal in ALV list.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Nidhi

This can be done as follows. While populating the field catalog, use the following statement:

data: wa_fieldcat_1 TYPE slis_fieldcat_alv.

wa_fieldcat_1-subtot = 'X'. (for the corresponding field for which subtotal is req)

This should solve the problem.

PLZ REWARD POINTS IF HELPFUL

4 REPLIES 4

Former Member
0 Kudos

Hi Nidhi,

Yes, u can do subtotals in alv.

Just add <b>SUBTOTAL</b> in the fieldcatalog of the particular field.

I_FIELDCAT-DO_SUM = 'X'.

Reward if helpful.

Thanks,

pritha

Message was edited by:

Pritha Agrawal

Former Member
0 Kudos

Hello,


Data: I_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV.

*---Sort
WA_SORT-SPOS = '1'.
WA_SORT-FIELDNAME = 'LINE'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO I_SORT.
CLEAR WA_SORT.

Pass this in FM,
IT_SORT = I_SORT

Regards,

Vasanth

Former Member
0 Kudos

Hi Nidhi,

Use FM <b>REUSE_ALV_EVENTS_GET</b> to get all events in ur ALV report.then use event <b>SUBTOTAL_TEXT</b> to print subtotal.

following are the events that u can use in ALV :

CALLER_EXIT

USER_COMMAND

TOP_OF_PAGE

TOP_OF_COVERPAGE

END_OF_COVERPAGE

FOREIGN_TOP_OF_PAGE

FOREIGN_END_OF_PAGE

PF_STATUS_SET

LIST_MODIFY

TOP_OF_LIST

END_OF_PAGE

END_OF_LIST

AFTER_LINE_OUTPUT

BEFORE_LINE_OUTPUT

REPREP_SEL_MODIFY

<b>SUBTOTAL_TEXT</b>

GROUPLEVEL_CHANGE

Reward points if helpful.

Regards,

Hemant

Former Member
0 Kudos

Hi Nidhi

This can be done as follows. While populating the field catalog, use the following statement:

data: wa_fieldcat_1 TYPE slis_fieldcat_alv.

wa_fieldcat_1-subtot = 'X'. (for the corresponding field for which subtotal is req)

This should solve the problem.

PLZ REWARD POINTS IF HELPFUL