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

Former Member
0 Kudos

Hi Guys

I have ALV output like this

Customer currency Amount

1 GBP 500

1 GBP 1000

-


1500

1 EUR 100

1 EUR 200

-


300

Iam using ALV object oriented and how can i display the subtotals.

Highly appreciate your inputs.

Thanks in advance.

6 REPLIES 6

Former Member
0 Kudos

wa_fieldcat2-col_pos = '10'.

wa_fieldcat2-fieldname = 'FAKWR'.

wa_fieldcat2-tabname = 't_output2'.

wa_fieldcat2-seltext_l = 'Amount'.

<b> wa_fieldcat2-do_sum = 'X'. "SUM UPON DISPLAY</b><b> wa_fieldcat2-datatype = 'CURR'.</b>

  • wa_fieldcat-just = 'L'.

wa_fieldcat2-outputlen = '15'.

wa_fieldcat2-do_sum = 'X'.

APPEND wa_fieldcat2 TO t_fieldcat2.

CLEAR wa_fieldcat2.

0 Kudos

Hi

Iam not using normal REUSE_ function module

iam using object oriented and i want to display opn every change of customer number.

Thanks

0 Kudos

Hi,

Build Sort Catalog as below , For example to subtotal at MATNR

And Show only subtotal line

data gt_sort type lvc_t_sort. "sort catalog

data sort type lvc_s_sort.

  • Pass Sort sequence as below.

clear sort.

sort-fieldname = 'MATNR'.

sort-tabname = 'INTERNAL TABLE NAME'

sort-up = 'X'.

SORT-SUBTOT = 'X'.

SORT-EXPA = 'X'. " This will hide details lines

append sort to t_sort.

clear sort.

Pass This t_sort ITAB in set_table_for_first_display

reward points if it is helpful..

Regards,

Omakr.

Former Member
0 Kudos

Hi,

Check this code..

DATA:wa_layout type slis_layout_alv, "Layout

it_sort type slis_t_sortinfo_alv, "Sort table

wa_sort type slis_sortinfo_alv, "WA for sort table

perform generate_layout.

perform generate_sort.

&----


*& Form GENERATE_LAYOUT

&----


  • LAYOUT

----


FORM GENERATE_LAYOUT .

WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH

WA_LAYOUT-ZEBRA = 'X'. "PUTTING ZEBRA COLORS

WA_LAYOUT-TOTALS_TEXT = 'Total'.

WA_LAYOUT-SUBTOTALS_TEXT = 'SUB TOTAL'.

WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.

ENDFORM. " GENERATE_LAYOUT

&----


*& Form GENERATE_SORT

&----


  • SORT

----


FORM GENERATE_SORT .

WA_SORT-FIELDNAME = 'EBELN'.

WA_SORT-SPOS = '1'.

WA_SORT-UP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

ENDFORM. " GENERATE_SORT

Regards,

Omkar.

Former Member
0 Kudos

Please see

Regards,

Darren

Pawan_Kesari
Active Contributor
0 Kudos

Sort on currency and display subtotals.

pass internal table IT_SORT in method SET_TABLE_FOR_FIRST_DISPLAY. This internal table should contain a record with the fieldname of you currecy column and mark subtotals = 'X'

LVC_S_SORT-FIELDNAME = currency fildname

LVC_S_SORT-UP = 'X'

LVC_S_SORT-SUBTOT = 'X'