Monday, July 7, 2008

Display ICON in ALV top of page

By Joyjit Ghosh,
Kolkata, India.



*&---------------------------------------------------------------------*
*& Report Z_ALV_ICON *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT Z_ALV_ICON .


***********************************************************************
* TYPE-POOLS *
***********************************************************************
TYPE-POOLS: slis,
icon.


***********************************************************************
* INTERNAL TABLES/WORK AREAS/VARIABLES *
***********************************************************************
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_event type standard table of slis_alv_event,
w_event type slis_alv_event,
w_field TYPE slis_fieldcat_alv,
i_mara type standard table of mara.

***********************************************************************
* SELECTION SCREEN *
***********************************************************************
PARAMETERS: lines(5) TYPE n obligatory.

***********************************************************************
* START-OF-SELECTION *
***********************************************************************
START-OF-SELECTION.

select * from mara
into table i_mara
up to lines rows.

check sy-subrc = 0.

* Populate top-of-page event
w_event-name = slis_ev_top_of_page.
W_EVENT-FORM = slis_ev_top_of_page.
append w_event to i_event.

* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = 'MARA'
i_callback_pf_status_set = 'SET_PF_STATUS'
IT_EVENTS = i_event
TABLES
t_outtab = i_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.

IF sy-subrc <> 0.


ENDIF.


*&--------------------------------------------------------------------*
*& Form TOP_OF_PAGE
*&--------------------------------------------------------------------*
* Top of page for ALV
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE.

skip.

uline.
format COLOR 7 on.
write:/ ICON_LED_GREEN as icon,
'Table name :', 'MARA'.
format COLOR 7 off.

format COLOR 3 on.
write:/ ICON_OO_OBJECT as icon,
'No. of records selected :', lines.
format COLOR 3 off.

uline.
skip.


ENDFORM. "TOP-OF-PAGE

Input:



Output:

No comments: