Skip to Content
0
Former Member
Jul 03, 2007 at 07:11 AM

calculating totals in alv

39 Views

This is the report i have created and i want it to display the totals for fkimg and netwr(below the columns), so may you please guys help me out on this...

REPORT Z_DAILY_STOCK_NEW.

TYPE-POOLS: SLIS.

TABLES: vbrk, kna1, vbrp, vbap, vbak.

data it_fieldcat TYPE SLIS_T_FIELDCAT_ALV.

data i_repid like sy-repid.

SELECT-OPTIONS:

s_werks FOR vbrp-werks,

s_auart FOR vbak-auart.

DATA: begin of i_stocktab occurs 0,

kunag LIKE vbrk-kunag,

name1 LIKE kna1-name1,

ort01 LIKE kna1-ort01,

inco1 LIKE vbrk-inco1,

vkgrp LIKE vbrp-vkgrp,

fkimg LIKE vbrp-fkimg,

netwr LIKE vbrk-netwr,

end of i_stocktab.

SELECT vbrkkunag kna1name1 kna1ort01 vbrkinco1 vbrp~vkgrp

vbrpfkimg vbrknetwr

FROM kna1 inner join vbrk on kna1kunnr EQ vbrkkunrg

inner join vbak on kna1kunnr EQ vbakkunnr

inner join vbrp on vbrkvbeln EQ vbrpvbeln

INTO i_stocktab

WHERE vbrp~werks IN s_werks

AND vbak~auart IN s_auart.

APPEND i_stocktab.

endselect.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'I_STOCKTAB'

I_INCLNAME = i_repid

CHANGING

ct_fieldcat = it_fieldcat.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = I_REPID

IT_FIELDCAT = IT_FIELDCAT[]

I_SAVE = 'X'

TABLES

t_outtab = i_stocktab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.