Skip to Content
0
Former Member
Feb 26, 2008 at 05:17 AM

ALV Subtotal

41 Views

Hi Experts,

I have to display Subtotal & total in my ALV like this

Item Material

______________________________________

1 100000012

______________________________________

1

______________________________________

1 100000040

1 100000040

______________________________________

2

______________________________________

1 100000050

1 100000050

1 100000050

1 100000050

______________________________________

4

_______________________________________

7(Total)

How can we achive this ? Item field is simply an int field with constant 1. Subtotal of items should be dependent on materials.

I tried below code but no result.

&----


*& Form alv_it_sort_subtotal

&----


  • sort & subtotal

----


FORM alv_it_sort_subtotal .

PERFORM ale_sort

USING 'MATNR' '' 'X'.

ENDFORM. " alv_it_sort_subtotal

&----


*& Form ale_sort

&----


FORM ale_sort USING fieldname

subtotal

up.

CLEAR it_sort_subtotal.

it_sort_subtotal-fieldname = fieldname.

it_sort_subtotal-subtot = subtotal.

it_sort_subtotal-up = up.

APPEND it_sort_subtotal.

ENDFORM. " ale_sort

regards,

Nik