Take a look at this alv-sample-code. It defines the event TOP-OF-PAGE in which you can print anything you want, including SO_...-low to SO_...-high, which you can insert at *()*
Code:
REPORT ZALV_SAMPLE.
* NO STANDARD PAGE HEADING
* LINE-COUNT 58
* LINE-SIZE 220.
TYPE-POOLS: SLIS. "for 'REUSE_ALV...list&grids'
*----------------------------------------------------------------------*
* TABLES *
*----------------------------------------------------------------------*
TABLES: KNA1. "General Data in Customer Master
.
*----------------------------------------------------------------------*
* Internal data *
*----------------------------------------------------------------------*
DATA: BEGIN OF LT_ALVTABLE OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
NAME2 LIKE KNA1-NAME2,
STRAS LIKE KNA1-STRAS,
PSTLZ LIKE KNA1-PSTLZ,
ORT01 LIKE KNA1-ORT01,
UMSA1 LIKE KNA1-UMSA1,
KTOKD LIKE KNA1-KTOKD,
END OF LT_ALVTABLE.
* data-statements that are necessary for the use of the ALV-grid
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: XS_EVENT TYPE SLIS_ALV_EVENT.
DATA: REPID TYPE SY-REPID.
DATA: ZTA_PRINT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: LO_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: LO_ITABNAME TYPE SLIS_TABNAME.
DATA: LS_VARIANT TYPE DISVARIANT.
*----------------------------------------------------------------------*
* Initialization *
*----------------------------------------------------------------------*
INITIALIZATION.
*----------------------------------------------------------------------*
* Parameters and select-options *
*----------------------------------------------------------------------*
SELECT-OPTIONS SO_KUNNR FOR KNA1-KUNNR DEFAULT '2000' TO '2300'.
SELECT-OPTIONS SO_NAME FOR KNA1-NAME1.
PARAMETERS: PA_PSTCD AS CHECKBOX DEFAULT 'X'.
PARAMETERS: PA_VAR AS CHECKBOX DEFAULT 'X'.
*----------------------------------------------------------------------*
* Start of main program *
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM SELECT_RECORDS.
PERFORM PRINT_ALVLIST.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form select_records
*&---------------------------------------------------------------------*
FORM SELECT_RECORDS.
SELECT * FROM KNA1 INTO CORRESPONDING FIELDS OF LT_ALVTABLE
WHERE KUNNR IN SO_KUNNR
AND NAME1 IN SO_NAME.
APPEND LT_ALVTABLE.
ENDSELECT.
ENDFORM. " select_records
*&--------------------------------------------------------------------*
*& Form print_alvlist
*&--------------------------------------------------------------------*
FORM PRINT_ALVLIST.
REPID = SY-REPID.
LO_ITABNAME = 'LT_ALVTABLE'. "NB: ONLY USE CAPITALS HERE!
* Fill the variables of the ALV-grid.
PERFORM SET_LAYOUT USING LO_LAYOUT. "Change layout-settings
PERFORM SET_EVENTS USING GT_XEVENTS."Set the events (top-page etc)
PERFORM FILL_STRUCTURE. "Read the structure of the itab
PERFORM MODIFY_STRUCTURE. "Modify itab's field-properties
* Sort the table
SORT LT_ALVTABLE BY KUNNR.
* Present the table using the ALV-grid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = ZTA_PRINT[]
IS_LAYOUT = LO_LAYOUT
IT_EVENTS = GT_XEVENTS
I_SAVE = 'A'
IS_VARIANT = LS_VARIANT
TABLES
T_OUTTAB = LT_ALVTABLE.
ENDFORM. " print_alvlist
*&---------------------------------------------------------------------*
*& Form SET_LAYOUT
*&---------------------------------------------------------------------*
FORM SET_LAYOUT USING PA_LAYOUT TYPE SLIS_LAYOUT_ALV.
* Minimize the columnwidth
PA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
* Give the table a striped pattern
PA_LAYOUT-ZEBRA = 'X'.
* Set the text of the line with totals
PA_LAYOUT-TOTALS_TEXT = 'Total:'.
* Set the text of the line with subtotals
PA_LAYOUT-SUBTOTALS_TEXT = 'Subtotal:'.
* Set the variant, as requested via the checkbox
IF PA_VAR = 'X'.
LS_VARIANT-VARIANT = '/ZLAYOUT'.
ELSE.
CLEAR LS_VARIANT-VARIANT.
ENDIF.
ENDFORM. " SET_LAYOUT
*&--------------------------------------------------------------------
*& Form Set_events
*&--------------------------------------------------------------------
* Appends the values of the events to the events-variable that is
* used by REUSE_ALV_LIST_DISPLAY
*&--------------------------------------------------------------------
FORM SET_EVENTS USING PA_EVENTS TYPE SLIS_T_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'XTOP_OF_LIST'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'XEND_OF_LIST'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'XTOP_OF_PAGE'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'XEND_OF_PAGE'.
APPEND XS_EVENT TO PA_EVENTS.
ENDFORM.
*&--------------------------------------------------------------------*
*& Form XTOP_OF_LIST
*&--------------------------------------------------------------------*
FORM XTOP_OF_LIST.
DATA LO_DATE(8).
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM+2(2)
INTO LO_DATE.
WRITE: AT 1 'Report:'(T01), 20 'Reportname'(T02).
WRITE: AT 50 'Date:'(T03), LO_DATE.
NEW-LINE.
WRITE: AT 1 'Abap-name report: '(T04), SY-REPID.
WRITE: AT 50 'Page:'(T05), SY-CPAGE.
ENDFORM. "xtop_of_list
*&--------------------------------------------------------------------*
*& Form XEND_OF_LIST
*&--------------------------------------------------------------------*
FORM XEND_OF_LIST.
WRITE: 'Footer of the list'(002).
ENDFORM. "xend_of_list
*&---------------------------------------------------------------------*
*& Form XTOP_OF_PAGE
*&---------------------------------------------------------------------*
FORM XTOP_OF_PAGE.
WRITE:/ 'Top of the page.'(003).
*()*Here your selection-criteria can be printed
ENDFORM. "xtop-of-page
*&---------------------------------------------------------------------*
*& Form XEND_OF_PAGE
*&---------------------------------------------------------------------*
FORM XEND_OF_PAGE.
WRITE:/ 'End of the page.'(004).
ENDFORM. "xtop-of-page
*&---------------------------------------------------------------------*
*& Form FILL_STRUCTURE
*&---------------------------------------------------------------------*
FORM FILL_STRUCTURE.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = REPID
I_INTERNAL_TABNAME = LO_ITABNAME
I_INCLNAME = 'ZALV_SAMPLE'
CHANGING
CT_FIELDCAT = ZTA_PRINT[].
ENDFORM. " FILL_STRUCTURE
*&--------------------------------------------------------------------*
*& Form MODIFY_STRUCTURE
*&--------------------------------------------------------------------*
* Set the fieldproperties to your wishes
*&--------------------------------------------------------------------*
FORM MODIFY_STRUCTURE.
LOOP AT ZTA_PRINT.
CLEAR ZTA_PRINT-KEY.
CASE ZTA_PRINT-FIELDNAME.
WHEN 'KUNNR'. "Klantnummer
ZTA_PRINT-COL_POS = 0.
ZTA_PRINT-SELTEXT_S = 'Cstm'(H01).
ZTA_PRINT-SELTEXT_M = 'Customer'(H01).
ZTA_PRINT-SELTEXT_L = 'Customer is king'(H01).
WHEN 'NAME1'. "Name1
ZTA_PRINT-COL_POS = 1.
WHEN 'NAME2'. "Name 2 (now set to invisible)
ZTA_PRINT-COL_POS = 2.
ZTA_PRINT-NO_OUT = 'X'.
WHEN 'STRAS'. "Month
ZTA_PRINT-COL_POS = 3.
WHEN 'PSTLZ'. "Postcode
ZTA_PRINT-COL_POS = 4.
IF PA_PSTCD = ''.
ZTA_PRINT-NO_OUT = 'X'.
ELSE.
CLEAR ZTA_PRINT-NO_OUT.
ENDIF.
WHEN 'ORT01'. "Stad
ZTA_PRINT-COL_POS = 5.
WHEN 'UMSA1'. "Annual sales
ZTA_PRINT-COL_POS = 6.
WHEN 'KTOKD'. "
ZTA_PRINT-COL_POS = 7.
* when others. "set all other fields to invisible
* zta_print-no_out = 'X'.
ENDCASE.
MODIFY ZTA_PRINT.
ENDLOOP.
ENDFORM. " modify_structure