Application Development and Automation 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: 
Read only

alv event

Former Member
0 Likes
732

hi friends,

how to give top-of-page event in alv.

should we need to declare internal table for that.

how to provide header details?

thax.

hi friends,

how to give top-of-page event in alv.

should we need to declare internal table for that.

how to provide header details?

thax.

5 REPLIES 5
Read only

Former Member
0 Likes
696

Hi,

do you use ALV-GRID or normal ALV?

Regards, Dieter

Read only

Former Member
0 Likes
696

Build Header:

FORM f3000_build_header USING i_header TYPE slis_t_listheader.

DATA: gs_line TYPE slis_listheader.

CLEAR gs_line.

gs_line-typ = 'H'.

gs_line-info = 'This is line of type HEADER'.

APPEND gs_line TO i_header.

CLEAR gs_line.

gs_line-typ = 'S'.

gs_line-key = 'STATUS 1'.

gs_line-info = 'This is line of type STATUS'.

APPEND gs_line TO i_header.

gs_line-key = 'STATUS 2'.

gs_line-info = 'This is also line of type STATUS'.

APPEND gs_line TO i_header.

CLEAR gs_line.

gs_line-typ = 'A'.

gs_line-info = 'This is line of type ACTION'.

APPEND gs_line TO i_header.

ENDFORM. " f3000_build_header

Build Events:

FORM f4000_events_init CHANGING i_events TYPE slis_t_event.

DATA: line_event TYPE slis_alv_event.

CLEAR line_event.

line_event-name = 'TOP_OF_PAGE'.

line_event-form = 'F4100_TOP_OF_PAGE'.

APPEND line_event TO i_events.

ENDFORM. " f3000_events_init

Top_of_page:

FORM f4100_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_header.

ENDFORM.

Use FM:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = report_id

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • i_structure_name = ' '

  • I_BACKGROUND_ID = ' '

i_grid_title = ws_title

  • I_GRID_SETTINGS =

is_layout = i_layout

it_fieldcat = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

  • IS_VARIANT =

it_events = i_events

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = i_data

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.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
696

Try using this code........

**-- Internal table for ALV events

data: IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE.

**-- For passing events to the function module

PERFORM EVENTS.

&----


& Form EVENTS

&----


This subroutine passes events to the function module

*----


FORM EVENTS.

IT_EVENTS-NAME = 'TOP_OF_PAGE'.

IT_EVENTS-FORM = 'TOP'.

APPEND IT_EVENTS.

CLEAR IT_EVENTS.

IT_EVENTS-NAME = 'USER_COMMAND'.

IT_EVENTS-FORM = 'PICK'.

APPEND IT_EVENTS.

CLEAR IT_EVENTS.

ENDFORM. " EVENTS

in CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' populate the events table with your internal table.

Madhavi

Read only

Former Member
0 Likes
696

Do something like this:

DATA:X_EVENTS TYPE SLIS_ALV_EVENT, "Events

IT_EVENTS TYPE SLIS_T_EVENT. "Table for Events

*- Top of page

X_EVENTS-NAME = 'TOP_OF_PAGE'.

X_EVENTS-FORM = 'TOP_OF_PAGE'.

APPEND X_EVENTS TO IT_EVENTS.

CLEAR X_EVENTS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = X_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_EVENTS = IT_EVENTS

TABLES

T_OUTTAB = IT_FINAL

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

then you should write this:

FORM TOP_OF_PAGE.

*-To show the top of page

Write:/ 'This is top of page'.

ENDFORM. "top_of_page

Regards,

ravi

Read only

Former Member
0 Likes
696

Hi

All events to be used have to indicate in table for events:

TYPE-POOLS SLIS.

DATA: .................................

GT_EVENTS TYPE SLIS_T_EVENT,

LS_EVENT TYPE SLIS_ALV_EVENT.

LS_EVENT-NAME = 'TOP_OF_PAGE'.

LS_EVENT-FORM = 'TOP-OF-PAGE'.

APPEND LS_EVENT TO GT_EVENTS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

....................................

IT_EVENTS = GT_EVENTS

....................................

FORM TOP-OF-PAGE.

WRITE: 'This is TOP-OF-PAGE event'.

ENDFORM.

Max