refer to this example.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_ DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
* I_CALLBACK_PF_ STATUS_SET = 'STATUS'
I_CALLBACK_TOP_ OF_PAGE = 'TOP-OF-PAGE_ CCODE' "see FORM
I_CALLBACK_USER_ COMMAND = 'USER_COMMAND_ CCODE'
IT_FIELDCAT = FIELDCATALOG[ ]
I_SAVE = 'X'
IS_VARIANT = G_VARIANT
TABLES
T_OUTTAB = IT_FINAL_CCODE
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.
*----------- --------- --------- --------- --------- --------- --------- -----*
* Form TOP-OF-PAGE *
*----------- --------- --------- --------- --------- --------- --------- --*
* ALV Report Header *
*----------- --------- --------- --------- --------- --------- --------- --*
FORM TOP-OF-PAGE_ CCODE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE WA_HEADER-INFO,
LD_LINES TYPE I,
LD_LINESC(10) TYPE C.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Student Fees Due'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+4(2) '.'
SY-DATUM+6(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'For Company Code'.
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
LOOP AT S_CCD.
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = ''.
WA_HEADER-INFO = S_CCD-LOW.
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_COMMENTA RY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "TOP-OF-PAGE_ CCODE
On 4/9/2010 12:23 PM, Rajcoomar, Suresh (ZA - Johannesburg) wrote: