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: 

subtotals are not displayed

Former Member
0 Kudos

dear experts,

I tried the BELOW CODE-LINES in alv report to display the TOTALS and SUBTOTALS , but anyhow the 'SUMMATION AND SUBTOTALING ' signs are not comming in the display and I couldn't calculate them.

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

W_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA:wa_sortinfo TYPE slis_sortinfo_alv,

t_sort_info TYPE slis_t_sortinfo_alv.

DATA: W_LAYOUT TYPE SLIS_LAYOUT_ALV.

FORM BUILD_FIELDCATALOG.

W_FIELDCAT-TABNAME = 'I_FINAL'.

W_FIELDCAT-FIELDNAME = 'MATNR'.

W_FIELDCAT-SELTEXT_M = 'MAT NO'.

W_FIELDCAT-COL_POS = 1.

W_FIELDCAT-OUTPUTLEN = 8.

W_FIELDCAT-DO_SUM = 'X'.

W_FIELDCAT-SP_GROUP = 'X'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-TABNAME = 'I_FINAL'.

W_FIELDCAT-FIELDNAME = 'ERNAM'.

W_FIELDCAT-SELTEXT_M = 'PERSON NAME'.

W_FIELDCAT-COL_POS = 2.

W_FIELDCAT-OUTPUTLEN = 15.

W_FIELDCAT-DO_SUM = 'X'.

W_FIELDCAT-SP_GROUP = 'X'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-TABNAME = 'I_FINAL'.

W_FIELDCAT-FIELDNAME = 'WERKS'.

W_FIELDCAT-SELTEXT_M = 'PLANTS'.

W_FIELDCAT-COL_POS = 4.

W_FIELDCAT-OUTPUTLEN = 20.

W_FIELDCAT-DO_SUM = 'X'.

W_FIELDCAT-SP_GROUP = 'X'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

ENDFORM.

FORM DATA_SORT USING SORTINFO TYPE SLIS_T_SORTINFO_ALV.

CLEAR SORTINFO.

WA_SORTINFO-TABNAME = 'I_FINAL'.

WA_SORTINFO-FIELDNAME = 'MATNR'.

WA_SORTINFO-DOWN = C_X.

WA_SORTINFO-SUBTOT = 'X'.

APPEND WA_SORTINFO TO SORTINFO.

CLEAR WA_SORTINFO.

WA_SORTINFO-TABNAME = 'I_FINAL'.

WA_SORTINFO-FIELDNAME = 'ERNAM'.

WA_SORTINFO-DOWN = C_X.

WA_SORTINFO-SUBTOT = 'X'.

APPEND WA_SORTINFO TO SORTINFO.

CLEAR WA_SORTINFO.

WA_SORTINFO-TABNAME = 'I_FINAL'.

WA_SORTINFO-FIELDNAME = 'WERKS'.

WA_SORTINFO-DOWN = C_X.

WA_SORTINFO-SUBTOT = 'X'.

APPEND WA_SORTINFO TO SORTINFO.

CLEAR WA_SORTINFO.

ENDFORM. " DATA_SORT

FORM BUILD_LAYOUT .

W_LAYOUT-TOTALS_TEXT = 'TOTALS'.

W_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTALS'.

w_layout-colwidth_optimize = 'X'.

*w_layout-totals_only = 'X'.

w_layout-no_input = 'X'.

*w_layout-no_subtotals = space.

ENDFORM. " BUILD_LAYOUT

I have passed all the 'I_FIELDCAT[ ], W_LAYOUT and T_SORT_INFO' in 'REUSE_ALV_GRID_DISPLAY',

but it didn't work.

PLEASE HELP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi.

Please try.

http://wiki.sdn.sap.com/wiki/display/ABAP/ALVStandardSumTotalOr+Subtotal

5 REPLIES 5

Former Member
0 Kudos

Hi.

Please try.

http://wiki.sdn.sap.com/wiki/display/ABAP/ALVStandardSumTotalOr+Subtotal

Former Member
0 Kudos

Check this link

http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid

Former Member
0 Kudos

Hi,

There should be atleast one field of quanity data type then only you can get the sum icon.

Regards,

Thiru

Former Member
0 Kudos

As thirukumaran rajendran mentioned, you cannot have Total & Subtoal without Quantity or Currency fields in the ALV. On what field in the fieldcatalog do you want the Total & Subtotal ?

Former Member
0 Kudos

ALL ARE VERY HELPFUL TIPS. THANK U VERY MUCH EXPERTS.