Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

regarding end of page event in ALV

Hi All,

After displaying the entire list in ALV i want to display values of two variables like

programs : no of records = ' '

functions : no of functions = ' '

now iam working on 4.0B server.

can u please give me piece of code how to do that.

thanks in advance.

Former Member
Former Member replied

Hi!

The sample is for list, but the same is the method for grid also...

REPORT  ZTEST_ALV_CHECK        .
 
 
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      L_LAYOUT type slis_layout_alv,
      x_events type slis_alv_event,
      it_events type SLIS_T_EVENT.
 
DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      POSNR LIKE VBAP-POSNR,
     END OF ITAB.
 
SELECT VBELN
       POSNR
       FROM VBAP
       UP TO 20 ROWS
       INTO TABLE ITAB.
 
 
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
 
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
 
 
  x_events-NAME = SLIS_EV_END_OF_PAGE.
  x_events-FORM = 'END_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
  x_events-NAME = SLIS_EV_TOP_OF_PAGE.
  x_events-FORM = 'TOP_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
 
  x_events-NAME = slis_ev_end_of_list.
  x_events-FORM = 'END_OF_LIST'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
 
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = SY-REPID
    IS_LAYOUT                = L_LAYOUT
    IT_FIELDCAT              = IT_FIELDCAT
    it_events                = it_events
  TABLES
    T_OUTTAB                 = ITAB
  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.
* BREAK-POINT.
  WRITE: / 'TOP_OF_PAGE'.
ENDFORM.
FORM END_OF_LIST.
* BREAK-POINT.
"here you can use this for footer
  WRITE: / 'FOR FOOTER'.
ENDFORM.
FORM END_OF_PAGE.
* BREAK-POINT.
  WRITE: / 'END_OF_PAGE'.
ENDFORM.

Regards

Tamá

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question