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

event

Former Member
0 Likes
641

what is the function of resue-alv-events-get?plzz tell

4 REPLIES 4
Read only

abdulazeez12
Active Contributor
0 Likes
614

Hi,

Check out this code,

data: ist_fcat TYPE slis_t_fieldcat_alv, "fieldcat table

g_layout type slis_layout_alv, "layout work area

events type slis_t_event,

event type slis_alv_event,

heading type slis_t_listheader,

hline type slis_listheader,

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_INTERFACE_CHECK = ' '

I_BYPASSING_BUFFER = ' '

I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

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 =

I_GRID_SETTINGS =

IS_LAYOUT = g_layout

it_fieldcat = ist_fcat[]

IT_EXCLUDING =

IT_SPECIAL_GROUPS =

IT_SORT =

IT_FILTER =

IS_SEL_HIDE =

I_DEFAULT = 'X'

i_save = 'X'

is_variant = variant

it_events = 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

I_HTML_HEIGHT_TOP = 0

I_HTML_HEIGHT_END = 0

IT_ALV_GRAPHICS =

IT_HYPERLINK =

IT_ADD_FIELDCAT =

IT_EXCEPT_QINFO =

IR_SALV_FULLSCREEN_ADAPTER =

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = ist_main[]

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.

fill the heading part in the top of page.

FORM build_comments .

DATA: text(50).

CLEAR hline.

hline-typ = 'H'.

hline-info = 'S&OP'.

APPEND hline TO heading.

CLEAR: hline,text.

hline-typ = 'S'.

WRITE: 'Date :' TO text.

WRITE: p_endda TO text+10.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_pernr-low IS NOT INITIAL.

WRITE: 'Sal Code:' TO text.

WRITE: s_pernr-low TO text+15.

ENDIF.

IF s_pernr-high IS NOT INITIAL.

WRITE: 'to' TO text+25.

WRITE: s_pernr-high TO text+28.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_bukrs-low IS NOT INITIAL.

WRITE: 'Company Code:' TO text.

WRITE: s_bukrs-low TO text+15.

ENDIF.

IF s_bukrs-high IS NOT INITIAL.

WRITE: 'to' TO text+23.

WRITE: s_bukrs-high TO text+26.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_werks-low IS NOT INITIAL.

WRITE: 'Personal area:' TO text.

WRITE: s_werks-low TO text+15.

ENDIF.

IF s_werks-high IS NOT INITIAL.

WRITE: 'to' TO text+23.

WRITE: s_werks-high TO text+26.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_ansvh-low IS NOT INITIAL.

WRITE: 'Work contract:' TO text.

WRITE: s_ansvh-low TO text+15.

ENDIF.

IF s_ansvh-high IS NOT INITIAL.

WRITE: 'to' TO text+23.

WRITE: s_ansvh-high TO text+26.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_btrtl-low IS NOT INITIAL.

WRITE: 'Personnel subarea:' TO text.

WRITE: s_btrtl-low TO text+20.

ENDIF.

IF s_btrtl-high IS NOT INITIAL.

WRITE: 'to' TO text+26.

WRITE: s_btrtl-high TO text+30.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_persg-low IS NOT INITIAL.

WRITE: 'Employee group:' TO text.

WRITE: s_persg-low TO text+17.

ENDIF.

IF s_persg-high IS NOT INITIAL.

WRITE: 'to' TO text+23.

WRITE: s_persg-high TO text+26.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

CLEAR: hline,text.

IF s_persk-low IS NOT INITIAL.

WRITE: 'Employee subgroup:' TO text.

WRITE: s_persk-low TO text+20.

ENDIF.

IF s_persk-high IS NOT INITIAL.

WRITE: 'to' TO text+26.

WRITE: s_persk-high TO text+30.

ENDIF.

hline-typ = 'S'.

hline-info = text.

APPEND hline TO heading.

Fill the event part.

FORM get_events .

CLEAR event.

event-name = slis_ev_top_of_page.

event-form = form_name "subroutine name ie . top_of_page.

APPEND event TO events.

ENDFORM. " get_events

FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = heading[]

I_LOGO =

I_END_OF_LIST_GRID =

I_ALV_FORM =

.

ENDFORM. "TOP_OF_PAGE

Read only

Former Member
0 Likes
614

the FM returns an internal table I_EVENTS with the possible events, you can make use of the to write interactive reports.

The table structure contains the fields:

I_EVENTS-NAME: Name of the Callback event.

I_EVENTS-FORM: Name of the form routine that should be called in the calling program at the event.

This event table (I_EVENTS) is now checked with the desired constants. If the desired constant is found, then the corresponding field for the FORM NAME is populated with the name of the routine containing the corresponding event.

Reward points if uesful.

Read only

Former Member
0 Likes
614

Hi,

This FM used get all the Standard events to one internal table.

Then u can assign corresponding FORM names to this internal table and pass this internal table to FM REUSE_ALV_GRID_DISPLAY.

Now u can create those those forms in ur program and system will excute those forms whenever the corresponding event triggers.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = gt_events

EXCEPTIONS

list_type_wrong = 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.

*---Pass the subroutine name to the eventtab

READ TABLE gt_events INTO ls_events WITH

KEY name = slis_ev_top_of_page.

IF sy-subrc = 0.

ls_events-form = 'TOP_OF_PAGE'.

MODIFY gt_events FROM ls_events TRANSPORTING form

WHERE name = slis_ev_top_of_page.

ENDIF.

READ TABLE gt_events INTO ls_events WITH

KEY name = slis_ev_user_command.

IF sy-subrc = 0.

ls_events-form = 'USER_COMMAND'.

MODIFY gt_events FROM ls_events TRANSPORTING form

WHERE name = slis_ev_user_command.

ENDIF.

Rewards points if helpful.

Regards,

Srinivas ch

Read only

Former Member
0 Likes
614

hi srinath,

With this function we can handle event. The way to handle is

first you must call function “REUSE_ALV_EVENTS_GET” with input parameter of I_LIST_TYPE with value :

a. 0 : Simple List (default)

b. 1 : Hierarchy – sequential List

c. 2 : Simple Block List

d. 3 : Hierarchy – sequential block list

NB: I still don’t know what the differences for each type

and Output parameter of ET_EVENTS with table which has type SLIS_T_EVENT.

Here is the constants for Event Constants.

CONSTANTS:

  • Events

SLIS_EV_ITEM_DATA_EXPAND TYPE SLIS_FORMNAME VALUE 'ITEM_DATA_EXPAND',

SLIS_EV_CALLER_EXIT_AT_START TYPE SLIS_FORMNAME VALUE 'CALLER_EXIT',

SLIS_EV_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',

SLIS_EV_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

SLIS_EV_TOP_OF_COVERPAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_COVERPAGE',

SLIS_EV_END_OF_COVERPAGE TYPE SLIS_FORMNAME VALUE 'END_OF_COVERPAGE',

SLIS_EV_FOREIGN_TOP_OF_PAGE TYPE SLIS_FORMNAME

VALUE 'FOREIGN_TOP_OF_PAGE',

SLIS_EV_FOREIGN_END_OF_PAGE TYPE SLIS_FORMNAME

VALUE 'FOREIGN_END_OF_PAGE',

SLIS_EV_PF_STATUS_SET TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',

SLIS_EV_LIST_MODIFY TYPE SLIS_FORMNAME VALUE 'LIST_MODIFY',

SLIS_EV_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',

SLIS_EV_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE',

SLIS_EV_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',

SLIS_EV_AFTER_LINE_OUTPUT TYPE SLIS_FORMNAME VALUE 'AFTER_LINE_OUTPUT',

SLIS_EV_BEFORE_LINE_OUTPUT TYPE SLIS_FORMNAME VALUE 'BEFORE_LINE_OUTPUT'.

Below is Structure of SLIS_T_EVENT.

*--- Structure for event handling

TYPES: BEGIN OF SLIS_ALV_EVENT,

NAME(30),

FORM(30),

END OF SLIS_ALV_EVENT.

TYPES: SLIS_T_EVENT TYPE SLIS_ALV_EVENT OCCURS 0.

Then you can check what events has occured. by Check the SLIS_ALV_EVENT-NAME with event – constants. Check the code below.

FORM EVENTTAB_BUILD.

DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = GT_EVENTS

EXCEPTIONS

LIST_TYPE_WRONG = 1

OTHERS = 2.

  • check what event has occured.

READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO LS_EVENT.

  • if event occured.

IF SY-SUBRC = 0.

MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.

APPEND LS_EVENT TO GT_EVENTS.

ENDIF.

ENDFORM.

regards,

sravanthi