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: 

REUSE_ALV_GRID_DISPLAY with EVENT TOP-OF-LIST

Former Member
0 Kudos

dear community,

i have a problem with my list output. i am unable to process the point top-of-list in my ALV_GRID.

my reports calls following class-method protokoll and it never gets to the subroutine COVER_SHEET. what am i doing wrong?

many thanks,

robert

*----


*

    • Methode Protokoll

*----


*

  • -> p_erwpr - Erweitertes Protokoll bei Echtlauf

  • -> p_testl - Testlauf

*----


*

METHOD protokoll.

  • Lokale Variablen

TYPE-POOLS: slis.

TYPES: BEGIN OF t_result,

pspnr TYPE zmi_ps_fbep-pspnr,

bukrs TYPE zmi_ps_fbep-bukrs,

frenr TYPE zmi_ps_fbep-frenr,

fkstl TYPE zmi_ps_fbep-fkstl,

prps_fkstl TYPE prps-fkstl,

hier TYPE zmi_ps_fbep-hier,

nokont TYPE zmi_ps_fbep-nokont,

END OF t_result.

DATA: ls_fbep TYPE t_fbep,

li_fcat TYPE slis_t_fieldcat_alv,

ls_fcat LIKE LINE OF li_fcat,

ls_layout TYPE slis_layout_alv,

l_choice TYPE c VALUE 'X',

lt_result TYPE STANDARD TABLE OF t_result,

ls_result LIKE LINE OF lt_result,

li_event TYPE slis_t_event,

ls_event LIKE LINE OF li_event.

CONSTANTS: true TYPE boolean VALUE 'X'.

FIELD-SYMBOLS: TYPE t_fbep_ref.

  • Spaltenüberschriften im Feldkatalog umschiessen

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_structure_name = 'ZMI_PS_KORR'(008)

CHANGING

ct_fieldcat = li_fcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

ENDIF.

ls_event-name = 'TOP-OF-LIST'.

ls_event-form = 'COVER_SHEET'.

APPEND ls_event TO li_event.

BREAK DB0E7E7.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_bypassing_buffer = true

i_callback_program = 'ZMI_PS_KORR_PRG'(016)

  • i_callback_top_of_page = 'COVER_SHEET'(017)

i_structure_name = 'ZMI_PS_KORR'(008)

is_layout = ls_layout

it_fieldcat = li_fcat

it_events = li_event

TABLES

t_outtab = lt_result.

ENDMETHOD. "protokoll

ENDCLASS. "lcl_main IMPLEMENTATION

*&----


*

*& Form cover_sheet

*&----


*

  • Ausgabe des Protokollkopfes

*----


*

FORM cover_sheet.

TYPES: BEGIN OF t_selopt,

type(2),

line LIKE raldb-infoline, " Zeile des Selektionsbildes

END OF t_selopt.

DATA: li_header TYPE slis_t_listheader,

ls_header LIKE LINE OF li_header,

ls_zeile LIKE LINE OF li_header,

li_selopt TYPE STANDARD TABLE OF t_selopt,

ls_selopt LIKE LINE OF li_selopt,

ld_hflag TYPE boolean,

ls_fbep TYPE t_fbep,

ld_count_hier TYPE i,

ld_count_nok TYPE i,

l_choice TYPE c VALUE 'X'.

BREAK DB0E7E7.

ENDFORM. "cover_sheet

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

In order to insert a report heading in to the ALV grid you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM

2. Create 'top-of-page' FORM


 call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            i_save                  = 'X'
       tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.
 
 
 
 
 
 
*-------------------------------------------------------------------*
* Form  TOP-OF-PAGE                                                 *
*-------------------------------------------------------------------*
* ALV Report Header                                                 *
*-------------------------------------------------------------------*
Form top-of-page.
*ALV Header declarations
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.
 
* Title
  wa_header-typ  = 'H'.
  wa_header-info = 'EKKO Table Report'.
  append wa_header to t_header.
  clear wa_header.
 
* Date
  wa_header-typ  = 'S'.
  wa_header-key = 'Date: '.
  CONCATENATE  sy-datum+6(2) '.'
               sy-datum+4(2) '.'
               sy-datum(4) INTO wa_header-info.   "todays date
  append wa_header to t_header.
  clear: wa_header.
 
* Total No. of Records Selected
  describe table it_ekko lines ld_lines.
  ld_linesc = ld_lines.
  concatenate 'Total No. of Records Selected: ' ld_linesc
                    into t_line separated by space.
  wa_header-typ  = 'A'.
  wa_header-info = t_line.
  append wa_header to t_header.
  clear: wa_header, t_line.
 
  call function 'REUSE_ALV_COMMENTARY_WRITE'
       exporting
            it_list_commentary = t_header.
*            i_logo             = 'Z_LOGO'.
endform.

2 REPLIES 2

Former Member
0 Kudos

Hi

The event should be <b>TOP_OF_LIST</b> not TOP-OF-LIST

Anyway u can try to use the event TOP_OF_PAGE instead of TOP_OF_LIST

Max

Former Member
0 Kudos

Hi

In order to insert a report heading in to the ALV grid you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM

2. Create 'top-of-page' FORM


 call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            i_save                  = 'X'
       tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.
 
 
 
 
 
 
*-------------------------------------------------------------------*
* Form  TOP-OF-PAGE                                                 *
*-------------------------------------------------------------------*
* ALV Report Header                                                 *
*-------------------------------------------------------------------*
Form top-of-page.
*ALV Header declarations
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.
 
* Title
  wa_header-typ  = 'H'.
  wa_header-info = 'EKKO Table Report'.
  append wa_header to t_header.
  clear wa_header.
 
* Date
  wa_header-typ  = 'S'.
  wa_header-key = 'Date: '.
  CONCATENATE  sy-datum+6(2) '.'
               sy-datum+4(2) '.'
               sy-datum(4) INTO wa_header-info.   "todays date
  append wa_header to t_header.
  clear: wa_header.
 
* Total No. of Records Selected
  describe table it_ekko lines ld_lines.
  ld_linesc = ld_lines.
  concatenate 'Total No. of Records Selected: ' ld_linesc
                    into t_line separated by space.
  wa_header-typ  = 'A'.
  wa_header-info = t_line.
  append wa_header to t_header.
  clear: wa_header, t_line.
 
  call function 'REUSE_ALV_COMMENTARY_WRITE'
       exporting
            it_list_commentary = t_header.
*            i_logo             = 'Z_LOGO'.
endform.