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: 

Reg: Top_Of_List Events in ALV GRID Display

Former Member
0 Kudos

Hi ,

How can i use the the the Top_of_list Event Alv grid Disply.

I have passed Events table with event name and form name to GRID FM it_events.

Form details:-

T_LISTHEADER header deatils table with data. .

FORM TOP_OF_LIST.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_LISTHEADER.

ENDFORM.

But still its not calling the form and also end_of list is working with same coding but top_of_list is not working can u give solution for this.

Regards,

raj

11 REPLIES 11

Former Member
0 Kudos

is it come out when you print the ALV report?

Regards,

Abraham

0 Kudos

Hi,

No. Its generating Report without Header Details.

Regards,

Raja.

Edited by: Rajviji on Jan 15, 2009 9:02 AM

0 Kudos

Hi,

When you are appending the It_events table that time also you have to append TOP_OF_PAGE.


wa_events-name = 'TOP_OF_PAGE'.
wa_events-form = 'TOP_OF_PAGE'.
APPEND wa_events TO it_events.

Regards

Sandipan

Former Member
0 Kudos

Hi,

Use TOP_OF_PAGE instead of TOP_OF_LIST



FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LISTHEADER.

ENDFORM.

Regards

Sandipan

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Raj,

Can you share your coding with us? May be then we will be able to give some pointers.

BR,

Suhas

Former Member
0 Kudos

hi Suhas,

My coding Here


 *&---------------------------------------------------------------------*
*& Report  ZR2K9_ALV008
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  alv_top_of_list

TABLES : t001.
TYPE-POOLS: slis.

DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
        INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.

DATA: T_EVENTS  TYPE slis_t_event.


DATA: WA_EVENTS   TYPE slis_alv_event .


DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat TYPE slis_fieldcat_alv.

DATA : it_comp TYPE TABLE OF ty_comp.

INITIALIZATION.
  w_repid = sy-repid.

wa_events-name = 'TOP_OF_LIST'.
wa_events-form = 'TOP_OF_LIST'.
APPEND wa_events TO t_events.


START-OF-SELECTION.

  SELECT * FROM t001 INTO TABLE it_comp up to 20 rows.

END-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = w_repid
      i_internal_tabname     = 'IT_COMP'
      I_STRUCTURE_NAME       = 't001'
      i_inclname             = w_repid
    CHANGING
      ct_fieldcat            = it_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = w_repid
      it_fieldcat                 = it_fieldcat[]
      IT_EVENTS                    = T_EVENTS
    TABLES
      t_outtab                    = it_comp
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.


FORM TOP_OF_LIST.
DATA: T_LISTHEADER   TYPE SLIS_T_LISTHEADER.
DATA: LS_LISTHEADER TYPE SLIS_LISTHEADER.

CLEAR LS_LISTHEADER.
LS_LISTHEADER-TYP  = 'S'.
LS_LISTHEADER-KEY  = 'Po Heder Details :-'.

APPEND LS_LISTHEADER  TO T_LISTHEADER.


CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
 EXPORTING
  IT_LIST_COMMENTARY = T_LISTHEADER.


ENDFORM.

Former Member
0 Kudos

Hi Rajviji,

Please change the coding to below :-



 *&---------------------------------------------------------------------*
*& Report  ZR2K9_ALV008
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  alv_top_of_list
 
TABLES : t001.
TYPE-POOLS: slis.
 
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
        INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
 
DATA: T_EVENTS  TYPE slis_t_event.
 
 
DATA: WA_EVENTS   TYPE slis_alv_event .
 
 
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat TYPE slis_fieldcat_alv.
 
DATA : it_comp TYPE TABLE OF ty_comp.
 
INITIALIZATION.
  w_repid = sy-repid.
*Need to change here 
wa_events-name = 'TOP_OF_PAGE'.       "Instead of TOP_OF_LIST
wa_events-form = 'TOP_OF_PAGE'.
APPEND wa_events TO t_events.
 
 
START-OF-SELECTION.
 
  SELECT * FROM t001 INTO TABLE it_comp up to 20 rows.
 
END-OF-SELECTION.
 
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = w_repid
      i_internal_tabname     = 'IT_COMP'
      I_STRUCTURE_NAME       = 't001'
      i_inclname             = w_repid
    CHANGING
      ct_fieldcat            = it_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = w_repid
      it_fieldcat                 = it_fieldcat[]
      IT_EVENTS                    = T_EVENTS
    TABLES
      t_outtab                    = it_comp
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
 
 
FORM TOP_OF_PAGE.             "Form Name Changed
DATA: T_LISTHEADER   TYPE SLIS_T_LISTHEADER.
DATA: LS_LISTHEADER TYPE SLIS_LISTHEADER.
 
CLEAR LS_LISTHEADER.
LS_LISTHEADER-TYP  = 'S'.
LS_LISTHEADER-KEY  = 'Po Heder Details :-'.
 
APPEND LS_LISTHEADER  TO T_LISTHEADER.
 
 
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
 EXPORTING
  IT_LIST_COMMENTARY = T_LISTHEADER.
 
 
ENDFORM.

Regards

Sandipan

Former Member
0 Kudos

Hi Sandipan,

Thanks For ur reply . I Know Top_of_page is working for this .

But i want how can i use top_of_list ? why its not working?

And also same top_of_list working for alv list display .

Thanks and Regards,

Raj

Former Member
0 Kudos

Hi,

Top of List works for ALV list display only.

Regards

Sandipan

I355602
Advisor
Advisor
0 Kudos

Hi,

Use top of page instead of using top of list.

Use this code, its working:-


*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
       wa_top TYPE slis_listheader.

*&---------------------------------------------------------------------*
*          DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program                = sy-repid "report id
      i_callback_top_of_page            = 'TOP' "for top of page
      it_fieldcat                       = it_field "field catalog
      it_sort                           = it_sort "sort records info
   TABLES
      t_outtab                          = it_ekpo
   EXCEPTIONS
      program_error                     = 1
      OTHERS                            = 2.

  IF sy-subrc <> 0.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  top
*&---------------------------------------------------------------------*
*       TO WRITE THE HEADER
*----------------------------------------------------------------------*
FORM top.

  REFRESH it_top.
  wa_top-typ = 'S'.
  wa_top-key = text-001. "text to be printed at top of page
  wa_top-info = sy-repid.  "text
  APPEND wa_top TO it_top.
  CLEAR wa_top.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = it_top
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .
ENDFORM.                    "top

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos

Hi,

Check out this link.

http://www.sapdev.co.uk/reporting/alv/alvgrid_rephead.htm

Hope it was useful.

Regards,

Deepthi.