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 and total in alv report

Former Member
0 Kudos

hi,

i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.

can any one help me, how to total and subtotal.

6 REPLIES 6

Former Member
0 Kudos

Hi Cyrilvictor,

You could try using these options.

Fieldname - NO_TOTLINE

If this field is set, only subtotals, but no totals, are displayed.

Value range - SPACE, 'X'

Fieldname - NUMC_TOTAL

If this field is set, the user can calculate totals for fields of datatype NUMC (normally, users are not allowed to do this).

Value range - SPACE, 'X'

Fieldname - TOTALS_BEF

If this field is set, the ALV displays totals calculated as the first rows in the grid control. Subtotals are displayed before a new value of the subtotals criterion.

Value range - SPACE, 'X'

Regards,

Aniket

Please mark useful posts.

former_member188685
Active Contributor
0 Kudos

HI,

while mentioning the fieldcatalog for menge specify do_sum .then it will not give the info message.

 X_FIELDCAT-SCRTEXT_M = 'quantity'.
  X_FIELDCAT-FIELDNAME = 'MENGE'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '10'.
 <b> X_FIELDCAT-DO_SUM = 'X'.</b>
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.

REGARDS

vijay

Former Member
0 Kudos

Sort the internal table before display.

ram's

Former Member
0 Kudos

while creting field catalog for the field give th eoptin X_FIELDCAT-DO_SUM = 'X'.

this may help u.

rams

Former Member
0 Kudos

Hi,

If the field DO_SUM is set, the ALV uses this field to calculate the total (this corresponds to the generic totals function in the toolbar).

Data: FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,

FIELDCAT_LN-FIELDNAME = 'FIELD3'.

FIELDCAT_LN-TABNAME = 'ITAB1'.

FIELDCAT_LN-NO_OUT = ' '.

FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY

APPEND FIELDCAT_LN TO GT_FIELDCAT.

For subtotal,

TYPE-POOLS: SLIS.

DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.

CLEAR GS_SORT.

GS_SORT-FIELDNAME = 'FIELD1'.

GS_SORT-SPOS = 1. “ Sort first on column FIELD1.

GS_SORT-UP = 'X'.“ Ascending order.

GS_SORT-SUBTOT = 'X'.“ Display sub-total at change of

“ FIELD1.

APPEND GS_SORT TO GT_SORT.

Regards,

Sumana

former_member927251
Active Contributor
0 Kudos

Hi,

Please go through the following links. I am sure it will help you.

<a href="http://www.sapfans.com/forums/viewtopic.php?t=20386">http://www.sapfans.com/forums/viewtopic.php?t=20386</a>

<a href="http://www.sapfans.com/forums/viewtopic.php?t=85191">http://www.sapfans.com/forums/viewtopic.php?t=85191</a>

<a href="http://www.sapfans.com/forums/viewtopic.php?t=88401">http://www.sapfans.com/forums/viewtopic.php?t=88401</a>

Please reward helpful answer.

Regards,

Amit Mishra