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: 

Display Table in ALV Footer

Former Member
0 Kudos

Hi All,

I need to display a summary table in ALV footer with multiple columns. I am using event end of list and table with line type slis_listheader but this has limited columns.

Any ideas?

Thanks and Best Regards,

Tyken

1 ACCEPTED SOLUTION

former_member386202
Active Contributor
0 Kudos

Hi,

Use block ALV refer below code

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = v_repid.

wa_layout1-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout1

it_fieldcat = it_fieldcat[]

i_tabname = 'it_final'

it_events = it_events

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT it_fieldcat INTO wa_fieldcat.

lv_index = sy-tabix.

IF wa_fieldcat-fieldname = 'ERDAT'.

wa_fieldcat-fieldname = 'TITLE'.

wa_fieldcat-seltext_m = text-026.

wa_fieldcat-outputlen = 10.

ENDIF.

MODIFY it_fieldcat FROM wa_fieldcat INDEX lv_index TRANSPORTING

fieldname seltext_m outputlen.

CLEAR : wa_fieldcat.

ENDLOOP.

wa_layout2-no_colhead = 'X'.

wa_layout2-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout2

it_fieldcat = it_fieldcat[]

i_tabname = 'it_total'

it_events = it_event1

TABLES

t_outtab = it_total

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

wa_layout3-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout3

it_fieldcat = it_fieldcat2[]

i_tabname = 'it_ship'

it_events = it_event2

TABLES

t_outtab = it_ship

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF NOT it_final IS INITIAL OR

NOT it_total IS INITIAL OR

NOT it_ship IS INITIAL.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

Regards,

Prashant

5 REPLIES 5

Former Member
0 Kudos

any ideas guys?

how about other events?

Thanks, need this fast.

Tyken

former_member386202
Active Contributor
0 Kudos

Hi,

Use block ALV refer below code

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = v_repid.

wa_layout1-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout1

it_fieldcat = it_fieldcat[]

i_tabname = 'it_final'

it_events = it_events

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT it_fieldcat INTO wa_fieldcat.

lv_index = sy-tabix.

IF wa_fieldcat-fieldname = 'ERDAT'.

wa_fieldcat-fieldname = 'TITLE'.

wa_fieldcat-seltext_m = text-026.

wa_fieldcat-outputlen = 10.

ENDIF.

MODIFY it_fieldcat FROM wa_fieldcat INDEX lv_index TRANSPORTING

fieldname seltext_m outputlen.

CLEAR : wa_fieldcat.

ENDLOOP.

wa_layout2-no_colhead = 'X'.

wa_layout2-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout2

it_fieldcat = it_fieldcat[]

i_tabname = 'it_total'

it_events = it_event1

TABLES

t_outtab = it_total

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

wa_layout3-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = wa_layout3

it_fieldcat = it_fieldcat2[]

i_tabname = 'it_ship'

it_events = it_event2

TABLES

t_outtab = it_ship

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF NOT it_final IS INITIAL OR

NOT it_total IS INITIAL OR

NOT it_ship IS INITIAL.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

Regards,

Prashant

Former Member
0 Kudos

Hi,

Check this Demo program BCALV_TEST_BLOCK_LIST

0 Kudos

Hi,

I checked the sample program, can I output the report in a GRID instead of a list?

Thanks.

Tyken

0 Kudos

Hi,

Yes You can, for this you need to display the ALV using OOP's Concept. Where you need to split the container in two parts and dsiplay the alv in both the containers.