Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

Event "TOP-OF-PAGE" not getting trigerred

Former Member
0 Kudos

Hiee friends ,

Its a simple alv list report .The top-of-page event is not getting trigerred .

Any ideas how to solve it...

REPORT  zalv_list_event.

TYPE-POOLS : slis.
TABLES : spfli.
DATA : t_spfli LIKE STANDARD TABLE OF spfli,
       fs_spfli LIKE LINE OF t_spfli.

DATA : w_carrid TYPE spfli-carrid,
       w_prog LIKE sy-repid,
       t_fieldcat TYPE slis_t_fieldcat_alv,
       fs_fieldcat TYPE slis_fieldcat_alv,
       t_eventcat TYPE slis_t_event,
       w_eventcat LIKE LINE OF t_eventcat.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_carrid FOR w_carrid.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  SELECT * FROM spfli INTO
           TABLE t_spfli
           WHERE carrid IN s_carrid.

END-OF-SELECTION.
  w_prog = sy-repid.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
*       I_INTERFACE_CHECK              = ' '
*       I_BYPASSING_BUFFER             =
*       I_BUFFER_ACTIVE                = ' '
       i_callback_program             = w_prog
*       I_CALLBACK_PF_STATUS_SET       = ' '
*       i_callback_user_command        =
       i_structure_name               = 'SPFLI'
*       IS_LAYOUT                      =
*       IT_FIELDCAT                    =
*       IT_EXCLUDING                   =
*       IT_SPECIAL_GROUPS              =
*       IT_SORT                        =
*       IT_FILTER                      =
*       IS_SEL_HIDE                    =
*       I_DEFAULT                      = 'X'
*       I_SAVE                         = ' '
*       IS_VARIANT                     =
         it_events                      = t_eventcat
*       IT_EVENT_EXIT                  =
*       IS_PRINT                       =
*       IS_REPREP_ID                   =
*       I_SCREEN_START_COLUMN          = 0
*       I_SCREEN_START_LINE            = 0
*       I_SCREEN_END_COLUMN            = 0
*       I_SCREEN_END_LINE              = 0
*       IR_SALV_LIST_ADAPTER           =
*       IT_EXCEPT_QINFO                =
*       I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*     IMPORTING
*       E_EXIT_CAUSED_BY_CALLER        =
*       ES_EXIT_CAUSED_BY_USER         =
      TABLES
        t_outtab                       = t_spfli
     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  t_eventcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM t_eventcat .
  w_eventcat-name = 'TOP-OF-PAGE'.
  w_eventcat-form = 'TOP'.
  APPEND w_eventcat TO t_eventcat.
ENDFORM.                    "T_EVENTCAT

*&---------------------------------------------------------------------*
*&      Form  TOP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top.
*  READ TABLE t_spfli INTO fs_spfli INDEX 1.
*  WRITE:/ 'CARRIER ID:'(001),30 fs_spfli-carrid,
*        / 'CONNECTION NUMBER :'(002), 30 fs_spfli-connid.

  WRITE πŸ˜• 'ALV Report with TOP-OF-PAGE'.
ENDFORM.                    "TOP

1 ACCEPTED SOLUTION

Former Member
0 Kudos

first of all u have not called the subroutine t_eventcat before calling the FM .call that first using perform t_eventcat.

then change the name to 'TOP_OF_PAGE'

FORM t_eventcat .

w_eventcat-name = 'TOP-OF-PAGE'. 'TOP_OF_PAGE'

w_eventcat-form = 'TOP'.

APPEND w_eventcat TO t_eventcat.

ENDFORM.

8 REPLIES 8

former_member207020
Active Contributor
0 Kudos

hi,

FORM t_eventcat .
  w_eventcat-name = TOP_OF_PAGE'. "do the changes here------>'TOP-OF-PAGE'.
  w_eventcat-form = 'TOP'.
  APPEND w_eventcat TO t_eventcat.

Thanks & REgards

Former Member
0 Kudos

I made the changes . But the problem is still there .

FORM t_eventcat .
  w_eventcat-name = 'TOP_OF_PAGE'.
  w_eventcat-form = 'TOP'.
  APPEND w_eventcat TO t_eventcat.
ENDFORM.                    "T_EVENTCAT

0 Kudos

hi,

TYPE-POOLS : slis.
TABLES : spfli.
DATA : t_spfli LIKE STANDARD TABLE OF spfli,
       fs_spfli LIKE LINE OF t_spfli.

DATA : w_carrid TYPE spfli-carrid,
       w_prog LIKE sy-repid,
       t_fieldcat TYPE slis_t_fieldcat_alv,
       fs_fieldcat TYPE slis_fieldcat_alv,
       t_eventcat TYPE slis_t_event,
       w_eventcat LIKE LINE OF t_eventcat.


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_carrid FOR w_carrid.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  SELECT * FROM spfli INTO
           TABLE t_spfli
           WHERE carrid IN s_carrid.
  PERFORM t_eventcat.

END-OF-SELECTION.
  w_prog = sy-repid.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
       i_callback_program             = w_prog
       i_structure_name               = 'SPFLI'
         it_events                      = t_eventcat
      TABLES
        t_outtab                       = t_spfli
     EXCEPTIONS
       program_error                  = 1
       OTHERS                         = 2         .
  IF sy-subrc NE  0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  t_eventcat
*&---------------------------------------------------------------------*
FORM t_eventcat .
  w_eventcat-name = 'TOP_OF_PAGE'.
  w_eventcat-form = 'TOP'.
  APPEND w_eventcat TO t_eventcat.
ENDFORM.                    "T_EVENTCAT


*&---------------------------------------------------------------------*
*&      Form  TOP
*&---------------------------------------------------------------------*
FORM top.
*  READ TABLE t_spfli INTO fs_spfli INDEX 1.
*  WRITE:/ 'CARRIER ID:'(001),30 fs_spfli-carrid,
*        / 'CONNECTION NUMBER :'(002), 30 fs_spfli-connid.
  DATA : w_comments TYPE slis_listheader.
  DATA : t1_comments TYPE slis_t_listheader.

  w_comments-typ ='H'.
  w_comments-info = 'ALV Report with TOP-OF-PAGE'.
  APPEND w_comments TO t1_comments.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t1_comments.

ENDFORM.                    "TOP

Thanks & Regards

Former Member
0 Kudos

first of all u have not called the subroutine t_eventcat before calling the FM .call that first using perform t_eventcat.

then change the name to 'TOP_OF_PAGE'

FORM t_eventcat .

w_eventcat-name = 'TOP-OF-PAGE'. 'TOP_OF_PAGE'

w_eventcat-form = 'TOP'.

APPEND w_eventcat TO t_eventcat.

ENDFORM.

faisal_altaf2
Active Contributor
0 Kudos

This message was moderated.

sujeet2918
Active Contributor
0 Kudos

hello lokesh,

you will have to pass your top-of-page manually like above.

but if you want to display directly then simply use alv grid display FM.

there you can pass directly your top-of-page.

Have a nice day.

Regards,

Sujeet

Former Member
0 Kudos

Thanks friends for all your replys .

Solved.

REPORT  zalv_list_event_layout.


TYPE-POOLS : slis.
TABLES : spfli.
DATA : t_spfli LIKE STANDARD TABLE OF spfli,
       fs_spfli LIKE LINE OF t_spfli.

DATA : w_carrid TYPE spfli-carrid,
       w_prog LIKE sy-repid,
       t_fieldcat TYPE slis_t_fieldcat_alv,
       fs_fieldcat TYPE slis_fieldcat_alv,
       t_eventcat TYPE slis_t_event,
       w_eventcat LIKE LINE OF t_eventcat.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_carrid FOR w_carrid.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  SELECT * FROM spfli INTO
           TABLE t_spfli
           WHERE carrid IN s_carrid.

END-OF-SELECTION.
  w_prog = sy-repid.

  PERFORM t_eventcat. "*Problem solved by adding this*

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
*       I_INTERFACE_CHECK              = ' '
*       I_BYPASSING_BUFFER             =
*       I_BUFFER_ACTIVE                = ' '
       i_callback_program             = w_prog
*       I_CALLBACK_PF_STATUS_SET       = ' '
*       i_callback_user_command        =
       i_structure_name               = 'SPFLI'
*       IS_LAYOUT                      =
*       IT_FIELDCAT                    =
*       IT_EXCLUDING                   =
*       IT_SPECIAL_GROUPS              =
*       IT_SORT                        =
*       IT_FILTER                      =
*       IS_SEL_HIDE                    =
*       I_DEFAULT                      = 'X'
*       I_SAVE                         = ' '
*       IS_VARIANT                     =
         it_events                      = t_eventcat
*       IT_EVENT_EXIT                  =
*       IS_PRINT                       =
*       IS_REPREP_ID                   =
*       I_SCREEN_START_COLUMN          = 0
*       I_SCREEN_START_LINE            = 0
*       I_SCREEN_END_COLUMN            = 0
*       I_SCREEN_END_LINE              = 0
*       IR_SALV_LIST_ADAPTER           =
*       IT_EXCEPT_QINFO                =
*       I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*     IMPORTING
*       E_EXIT_CAUSED_BY_CALLER        =
*       ES_EXIT_CAUSED_BY_USER         =
      TABLES
        t_outtab                       = t_spfli
     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  t_eventcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM t_eventcat .
  w_eventcat-name = 'TOP_OF_PAGE'.
  w_eventcat-form = 'TOP'.
  APPEND w_eventcat TO t_eventcat.
ENDFORM.                    "T_EVENTCAT

*&---------------------------------------------------------------------*
*&      Form  TOP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top.
  READ TABLE t_spfli INTO fs_spfli INDEX 1.
  WRITE:/ 'CARRIER ID:'(001),30 fs_spfli-carrid,
        / 'CONNECTION NUMBER :'(002), 30 fs_spfli-connid.

  WRITE πŸ˜• 'ALV Report with TOP-OF-PAGE'.
ENDFORM.                    "TOP

Former Member
0 Kudos

Hi,

Check out the below code.

For displaying Top_of_Page, u use the FM reuse_alv_commentary_write.

TYPE-POOLS : slis.

TABLES : spfli.

DATA : t_spfli LIKE STANDARD TABLE OF spfli,

fs_spfli LIKE LINE OF t_spfli.

DATA : w_carrid TYPE spfli-carrid,

w_prog LIKE sy-repid,

t_fieldcat TYPE slis_t_fieldcat_alv,

fs_fieldcat TYPE slis_fieldcat_alv,

t_eventcat TYPE slis_t_event,

w_eventcat LIKE LINE OF t_eventcat,

i_header TYPE slis_t_listheader,

w_header TYPE slis_listheader.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_carrid FOR w_carrid.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

SELECT * FROM spfli INTO

TABLE t_spfli

WHERE carrid IN s_carrid.

CLEAR w_header.

w_header-typ = 'H'.

w_header-info = 'ALV Report with TOP-OF-PAGE'.

APPEND w_header TO i_header.

PERFORM t_eventcat1 CHANGING t_eventcat.

  • end-of-selection.

w_prog = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = w_prog

  • I_CALLBACK_PF_STATUS_SET = ' '

  • i_callback_user_command =

i_structure_name = 'SPFLI'

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • i_save = 'A'

  • IS_VARIANT =

it_events = t_eventcat

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_spfli

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 t_eventcat1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM t_eventcat1 CHANGING t_eventcat TYPE slis_t_event.

w_eventcat-name = 'TOP_OF_PAGE'.

w_eventcat-form = 'TOP'.

APPEND w_eventcat TO t_eventcat.

ENDFORM. " t_eventcat1

&----


*& Form TOP

&----


  • text

----


FORM top.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_header

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM. "TOP

Regards.