Google Search - Blog...........

ABAP - ALV Subtotals In Different Blocks.

REPORT ztest_alv.



*---type pools

TYPE-POOLS: slis.



*---internal tables

DATA: BEGIN OF it_flight OCCURS 0,

pernr LIKE pa0008-pernr,

begda LIKE pa0008-begda,

endda LIKE pa0008-endda,

ansal LIKE pa0008-ansal,

lga01 LIKE pa0008-lga01,

bet01 LIKE pa0008-bet01,

END OF it_flight,



*--internal tables for alv

it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fcat LIKE LINE OF it_fieldcat,

layout TYPE slis_layout_alv,

it_sort TYPE slis_t_sortinfo_alv,

wa_sort LIKE LINE OF it_sort.



*---start-of-selection .



START-OF-SELECTION.



CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'IT_FLIGHT'

i_inclname = sy-repid

CHANGING

ct_fieldcat = it_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2.



*----get data

SELECT pernr

begda

endda

ansal

lga01

bet01

FROM pa0008

INTO CORRESPONDING FIELDS OF TABLE it_flight

UP TO 20 ROWS.

.

wa_fcat-do_sum = 'X'.

MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum

WHERE fieldname = 'BET01' .



wa_sort-fieldname = 'PERNR'.

wa_sort-group = '*'.

wa_sort-up = 'X'.

APPEND wa_sort TO it_sort.



wa_sort-fieldname = 'ANSAL'.

wa_sort-subtot = 'X'.

wa_sort-up = 'X'.

APPEND wa_sort TO it_sort.



CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = layout

it_fieldcat = it_fieldcat

it_sort = it_sort

TABLES

t_outtab = it_flight

EXCEPTIONS

program_error = 1.


ALSO READ:

- ALV With Page Numbers & Subtotals.

- Footer Functionality In ALV Reports.

- Calling One ALV From Other ALV Report Program.

- Capture Single & Multiple Row Selction In ALV Report Program.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.


No comments:

Post a Comment