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: 

EVENTS in ALV

Former Member
0 Kudos

how cud we make use of d events which we get by using

REUSE_ALV_EVENTS_GET

can any1 explain wid examples??

7 REPLIES 7

Former Member
0 Kudos

helloooooooo...

somebody help plzzzzzzzz

ill reward if worth....

Former Member
0 Kudos

hi,

check this link may be helpful for u

http://www.sap-basis-abap.com/abap/events-in-alv-and-their-fm.htm

~~Guduri

0 Kudos

hi man!!

reply to d Q man....not to d thread...

0 Kudos

do you want the list of events?

if yes try:

data: fk_events TYPE slis_t_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

IMPORTING

et_events = fk_events.

thenn analyse each and every event...

0 Kudos

i got d list of events man...

i dunno how to use em...

let me know how cud i use em...

thnx

zidd

0 Kudos

HI,

The func.module will return:

CALLER_EXIT

USER_COMMAND

TOP_OF_PAGE

TOP_OF_COVERPAGE

END_OF_COVERPAGE

FOREIGN_TOP_OF_PAGE

FOREIGN_END_OF_PAGE

PF_STATUS_SET

LIST_MODIFY

TOP_OF_LIST

END_OF_PAGE

END_OF_LIST

AFTER_LINE_OUTPUT

BEFORE_LINE_OUTPUT

REPREP_SEL_MODIFY

SUBTOTAL_TEXT

GROUPLEVEL_CHANGE

The above events.

So if you define subroutines like:

----


  • FORM TOP_OF_PAGE *

----


  • ........ *

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = HEADING.

ENDFORM.

then the particular event will get executed.

Regards

Subramanian

Former Member
0 Kudos

Hi ziden,

Here is an example of reuse_alv_events_get for top of page event:

  • work area and internal table for top of page.

DATA: it_list_top_of_page TYPE slis_t_listheader,

it_events TYPE slis_t_event,

gs_layout TYPE slis_layout_alv,

lwa_line TYPE slis_listheader.

  • constant to store top of page

CONSTANTS: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

PERFORM eventtab_build USING it_events[].

PERFORM list_header USING it_list_top_of_page[].

PERFORM layout_build USING gs_layout.

PERFORM display.

FORM eventtab_build USING lit_events TYPE slis_t_event.

DATA: lit_alv_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = lit_events.

READ TABLE lit_events WITH KEY name = slis_ev_top_of_page

INTO lit_alv_event.

IF sy-subrc = 0.

MOVE gc_formname_top_of_page TO lit_alv_event-form.

APPEND lit_alv_event TO lit_events.

ENDIF.

ENDFORM. "EVENTTAB_BUILD

FORM list_header USING lt_top_of_page TYPE slis_t_listheader.

CLEAR lwa_line.

lwa_line-typ = 'S'.

lwa_line-key = description for field.

lwa_line-info = <field name or date ot time, etc> .

APPEND lwa_line TO lt_top_of_page.

lwa_line-key = description for field.

lwa_line-info = <field name or date ot time, etc>.

APPEND lwa_line TO lt_top_of_page.

CLEAR lwa_line.

lwa_line-typ = 'S'.

lwa_line-key = description for field.

lwa_line-info = sy-datum.

APPEND lwa_line TO lt_top_of_page.

CLEAR lwa_line.

lwa_line-typ = 'S'.

lwa_line-key = description for field.

lwa_line-info = sy-uname.

APPEND lwa_line TO lt_top_of_page.

ENDFORM. "COMMENT_BUILD

FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_list_top_of_page.

ENDFORM. "TOP_OF_PAGE

&----


*& Form LAYOUT_BUILD

&----


----


  • -->LS_LAYOUT for zebra pattern between records

----


FORM layout_build USING ls_layout TYPE slis_layout_alv.

ls_layout-zebra = 'X'.

ENDFORM. "LAYOUT_BUILD

&----


*& Form display

&----


  • text

----


FORM display.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = gs_layout

it_fieldcat = it_fieldcat

it_events = it_events[]

TABLES

t_outtab = lit_field

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.

ENDFORM. "display

In this lit_events internal table will store all the events and i am moving the form name (top of page) to lit_alv_event-form so that the top of page event will be trigerred. lt_top_of_page internal table will store the details about what you want to display in the top of page of the alv output.

Hope it will be easy to understand.