EVENTS IN ALV

Go down

EVENTS IN ALV

Post  govind on Wed Mar 07, 2012 4:58 pm

EVENTS in ALV:-
SAP has given standard events that can be used on reports. When you use display function modules like ‘REUSE_ALV_GRID_DISPLAY’ in that we have some parameters to handle events listed below.
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

If you want to use standard 17 events given by SAP then use Function module ‘REUSE_ALV_EVENTS_GET’. Declare an internal table of type ‘slis_alv_event’ and pass to the events function module. This structure has two fields NAME & FORM.



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



These are 17 event names which SAP provides and are stored into internal table. Let us consider you want to use user-command event then use the following code.

Code:

[color=black]data : it_events type table of slis_alv_event,
wa_events type slis_alv_event.


CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_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.

read table it_events into wa_events with key name = 'USER_COMMAND'.

wa_events-form = 'SUB_USER_COMMAND'.

modify it_events from wa_events index sy-tabix.
*&---------------------------------------------------------------------*
*& Form SUB_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form SUB_USER_COMMAND using v_ucomm type sy-ucomm
v_slis type slis_selfield.

" your code here

endform. "SUB_USER_COMMAND

Event handling in SAP is very interesting. If you want to use USER_COMMAND then change the form of that USER_COMMAND name as we have done above. And pass two parameters SY-UCOMM and SLIS_SELFIELD. If you use TOP_OF_PAGE this doesn’t require any parameters to be passed.
To upload LOGO into ALV use Function Module ‘REUSE_ALV_COMMENTRY_WRITE’. You can upload your own logo through tcode SE78.

govind
Admin

Posts : 54
Join date : 2012-01-31

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum