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 Classical ALV

Former Member
0 Kudos
394

Hi,

I want to know the Purpose of using the below Events in Classical ALV (if possible with example).

1. CALLER_EXIT

2. REPREP_SEL_MODIFY

3. top_of_coverpage

4. END_OF_COVERPAGE

5. TOP_OF_FOREIGN_PAGE

6. END_OF_FOREIGN_PAGE

7.SUBTOTAL_TEXT

Thanks in Advance,

Sumi

1 ACCEPTED SOLUTION

Former Member
9 REPLIES 9

Former Member

jayanthi_jayaraman
Active Contributor
0 Kudos
176

Hi,


  
TOP_OF_PAGE          no USING parameter                          
Equivalent to the list processing TOP-OF-PAGE event                                                                                
END_OF_PAGE          no USING parameter                          
Not available for hierarchical-sequential lists. Information output at the end of a page. This is only called for printing.
CALLER_EXIT          USING RS_DATA                        
Is called at the beginning of the function module to make special settings. It is not usually used.                 

TOP_OF_COVERPAGE     no USING parameter                             
The selection information and list status are output together (if they exist) on a separate page by default.               

END_OF_COVERPAGE     no USING parameter                              
Analogously to TOP_OF_COVERPAGE the user can add other information to the information output by ALV (selection information, list status) at this event.                                                                                
FOREIGN_TOP_OF_PAGE no USING parameter                              
The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV). In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.                                                                                
FOREIGN_END_OF_PAGE  no USING parameter                              
The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).  In this case, end-of-page cannot be formatted by ALV analogously     
                                                                     
BEFORE_LINE_OUTPUT   USING RS_LINEINFO TYPE SLIS_LINEINFO      
Output information before each output line. Should only be used in justified cases because it costs a lot of performance.      
                                                               
AFTER_LINE_OUTPUT    USING RS_LINEINFO TYPE SLIS_LINEINFO      
Output information after each output line. Should only be used in justified cases because it costs a lot of performance.     

Former Member
0 Kudos
176

Hi,

TOP_OF_COVERPAGE no USING parameter

The selection information and list status are output together (if they exist) on a separate page by default.

Is called at the beginning of the function module to make special settings. It is not usually used.

The user can format the header area of the 'cover page' himself or herself by specifying a Callback routine for this event.

END_OF_COVERPAGE no USING parameter

Analogously to TOP_OF_COVERPAGE the user can add other information to the information output by ALV (selection information, list status) at this event.

FOREIGN_TOP_OF_PAGE no USING parameter

The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).

In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV.

When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.

Hope that helps.

Regards,

Anjali

jayanthi_jayaraman
Active Contributor
0 Kudos
176

Hi,

To be more specific ,

'CALLER_EXIT':
Is called at the beginning of the function module to make special settings. It is not usually used.

REPREP_SEL_MODIFY:
RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to       be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header that is to be expanded.
RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that    entries are not repeated in the item table.
RS_SELFIELD is initial in this case.
Top_of_coverpage:
The selection information and list status are output together (if they exist) on a separate page by default
'END_OF_COVERPAGE'.        
Analogously to TOP_OF_COVERPAGE the user can add other information
to the information output by ALV (selection information, list status) at this event.
'SUBTOTAL_TEXT'.                         
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.
To write a header, we use the function REUSE_ALV_COMMENTARY_WRITE. This function can be used to write headers or footers for reports. To this function we pass a table of the text that we want to be written in the report. It is of type slis_t_listheader. This is a table of rows, which can of three types, HEADER, STATUS or ACTION as defined in the type slis_listheader, which is a line item of slis_t_listheader. 

‘FOREIGN_TOP_OF_PAGE'.
The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. 
This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
'FOREIGN_END_OF_PAGE'.   
The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.

Former Member
0 Kudos
176

The I_EVENTS table returns with the following possible constants:

1. Slis_ev_item_data_expand TYPE slis_formname VALUE 'ITEM_DATA_EXPAND'.

Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT. Exit for passing item entries (ITEM table) for a header record that was expanded interactively by the user.

2. Slis_ev_reprep_sel_modify TYPE slis_formname VALUE 'REPREP_SEL_MODIFY'.

RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header that is to be expanded.

RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table.

RS_SELFIELD is initial in this case.

3. Slis_ev_caller_exit_at_start TYPE slis_formname VALUE 'CALLER_EXIT'.

Is called at the beginning of the function module to make special settings. It is not usually used.

4. Slis_ev_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

As this is a frequently-used Callback event, the form routine can also be passed directly in the interface by passing the user command in the IMPORTING parameter I_CALLBACK_USER_COMMAND.

5. Slis_ev_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

Equivalent to the list processing TOP-OF-PAGE event.

6. Slis_ev_top_of_coverpage TYPE slis_formname VALUE 'TOP_OF_COVERPAGE'.

The selection information and list status are output together (if they exist) on a separate page by default

7. Slis_ev_end_of_coverpage TYPE slis_formname VALUE 'END_OF_COVERPAGE'.

Analogously to TOP_OF_COVERPAGE the user can add other information

to the information output by ALV (selection information, list status) at this event.

8. Slis_ev_foreign_top_of_page TYPE slis_formname VALUE ‘FOREIGN_TOP_OF_PAGE'.

The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).

In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.

9. Slis_ev_foreign_end_of_page TYPE slis_formname VALUE 'FOREIGN_END_OF_PAGE'.

The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).

In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.

10. Slis_ev_pf_status_set TYPE slis_formname VALUE 'PF_STATUS_SET'.

If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).

The STANDARD status of the function group SALV should be used as a template for a user-specific status. As this is a frequently used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.

11. Slis_ev_list_modify TYPE slis_formname VALUE 'LIST_MODIFY'.

LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME

R_INDEX LIKE SY-TABIX

R_INDEX_ITEM LIKE SY-TABIX

R_INDEX_SUM LIKE SY-TABIX.

12. Slis_ev_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST'.

Information output at the start of the list

13. Slis_ev_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.

Information output at the end of a page. This is only called for printing.

14. Slis_ev_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.

Information output at the end of the list

15. Slis_ev_after_line_output TYPE slis_formname VALUE 'AFTER_LINE_OUTPUT'.

Output information after each output line. Should only be used in justified cases because it costs a lot of performance.

16. Slis_ev_before_line_output TYPE slis_formname VALUE 'BEFORE_LINE_OUTPUT'.

Output information before each output line. Should only be used in justified cases because it costs a lot of performance.

17. Slis_ev_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.

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.

Former Member
0 Kudos
176

Sample code :

FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE', FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_EVENTS.

READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO L_I_EVENT.

IF SY-SUBRC = 0.

MOVE FORMNAME_TOP_OF_PAGE TO L_I_EVENT-FORM.

APPEND L_I_EVENT TO I_EVENTS.

ENDIF.

READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE

INTO L_I_EVENT.

IF SY-SUBRC = 0.

MOVE FORMNAME_END_OF_PAGE TO L_I_EVENT-FORM.

APPEND L_I_EVENT TO I_EVENTS.

ENDIF.

CLEAR L_I_EVENT.

READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND

INTO L_I_EVENT.

IF SY-SUBRC = 0.

MOVE FORMNAME_USER_COMMAND TO L_I_EVENT-FORM.

APPEND L_I_EVENT TO I_EVENTS.

ENDIF.

Former Member
0 Kudos
176

If these are useful tips , do reward the appropriate people accordingly, also do search FORM , you will find many thread on this.