Application Development and Automation 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: 
Read only

ALV Grid subtotal function - two columns as one

Former Member
0 Likes
2,172

Hello experts,

I am using a ALV GRID with function ... and i have a problem with subtotals, how can i a take 2 columns as one in the subtotal

i mean i have 4 columns .... CODE1 DESC1 and CODE2 DESC2 and the amount columns AMOUN1 AMOUNT2

if i subtotalize by colums i am going to have 4 leveles plus the gran total.

HOw can i make te CODE1 and DESC1 act as just one colums ... that theyll be at the same level. So ill just have 2 leves plus the gran total.

Thx in advance .

6 REPLIES 6
Read only

Former Member
0 Likes
1,320

Hello!

Im not sure if it's what you need, but this FIELDCAT-SP_GROUP defines a group in your fieldcat, and the columns added to this group act as one. I never tried using this, let us know if it works and fixes your problem.

See ya.

Thales Schmidt

Read only

Former Member
0 Likes
1,320

in Fieldcar Cat loge

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

CLEAR wa_fieldcat.

Use this condition where u Defin. tax for Column Name

*Total

wa_fieldcat-fieldname = 'TOTAL'.

wa_fieldcat-key = ''.

*wa_fieldcat-do_sum = 'X'.

wa_fieldcat-emphasize = 'C300'.

wa_fieldcat-outputlen = 20.

wa_fieldcat-seltext_l = 'Current Total '.

APPEND wa_fieldcat TO t_fieldcat.

CLEAR wa_fieldcat.

at end of Field Use

gs_sort-fieldname = 'TXT50'.

gs_sort-spos = 2.

gs_sort-up = 'X'.

Read only

Former Member
0 Likes
1,320

in Fieldcar Cat loge

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

CLEAR wa_fieldcat.

Use this condition where u Defin. tax for Column Name

*Total

wa_fieldcat-fieldname = 'TOTAL'.

wa_fieldcat-key = ''.

*wa_fieldcat-do_sum = 'X'.

wa_fieldcat-emphasize = 'C300'.

wa_fieldcat-outputlen = 20.

wa_fieldcat-seltext_l = 'Current Total '.

APPEND wa_fieldcat TO t_fieldcat.

CLEAR wa_fieldcat.

at end of Field Use

gs_sort-fieldname = 'TOTAL'.

gs_sort-spos = 2.

gs_sort-up = 'X'.

Edited by: Shailesh Dhanani on Feb 15, 2011 7:52 AM

Read only

Former Member
0 Likes
1,320

Hello

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

this z usefull for u pls try it.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,320

In the sort parameter (type LVC_T_SORT in OO or SLIS_T_SORTINFO_ALV in old REUSE library)

- Define all key fields as sort criteria CODE1, DESC1 -> UP = 'X'

- Only define only one field as sub-total level, e.g. text DESC1 -> SUBTOT = 'X'

Ref: [Fields of the Sort Table|http://help.sap.com/saphelp_erp2004/helpdata/en/9e/2c7b38180fee45e10000009b38f8cf/frameset.htm]

Regards,

Raymond

Read only

former_member184635
Participant
0 Likes
1,320

Hi,

R u sure, you will need six (6) cloumns. Will three (3) columns will not suffice.

In the field catlogue just mark the field do_sum = 'X' for the Amount column.

Rest cloumns do the sorting.

Hope this will help.

Regards,

Dadarao.