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: 

ALV GRID HEADING

Former Member
0 Kudos
145

WHEN I AM EXECUTING THE CODE THE HEADER IS HAPPENING UP FOR THE GRID BUT NOTHING IS DISPLAYED IN THE HEDADER LIST.

FORM f_display_list .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = v_repid

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'

IS_LAYOUT = i_gs_layout

IT_FIELDCAT = i_gt_fieldcat[]

IT_EVENTS = lt_events[]

TABLES

T_OUTTAB = i_final

FORM f_list_header USING P_I_LISTHEADER.

DATA: lt_list_top_of_page TYPE slis_t_listheader,

lwa_list_top_of_page TYPE slis_listheader.

  • Prepare the header.

lwa_list_top_of_page-typ = 'H'.

lwa_list_top_of_page-info = 'SO report'.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

lwa_list_top_of_page-info = sy-uname.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = lt_list_top_of_page.

ENDFORM. " f_list_header

form TOP-OF-PAGE.

s_events-form = 'TOP_OF_PAGE'.

s_events-name = 'TOP_OF_PAGE'.

APPEND s_events TO lt_events.

endform.

10 REPLIES 10

Former Member
0 Kudos
118

u need to write the code in

form TOP-OF-PAGE

DATA: lt_list_top_of_page TYPE slis_t_listheader,

lwa_list_top_of_page TYPE slis_listheader.

  • Prepare the header.

lwa_list_top_of_page-typ = 'H'.

lwa_list_top_of_page-info = 'SO report'.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

lwa_list_top_of_page-info = sy-uname.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = lt_list_top_of_page.

endform.

check this ..

regards,

vijay

Former Member
0 Kudos
118
May be some problem with GUI

Execute the below program and checkout this


*&---------------------------------------------------------------------*
*& Report  Y_TOP_PAGE                                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  y_top_page                              .

TABLES : mara.
TYPE-POOLS: slis.

DATA : w_repid LIKE sy-repid.
  w_repid = sy-repid.

DATA : BEGIN OF it_mara OCCURS 0,
       matnr LIKE mara-matnr,
       END OF it_mara.

*layout
DATA: wa_layout           TYPE SLIS_LAYOUT_ALV.
*field catalog
DATA: it_fieldcat_wrt_off TYPE slis_t_fieldcat_alv,
      wa_fieldcat_wrt_off TYPE slis_fieldcat_alv.

START-OF-SELECTION.

  SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara.

END-OF-SELECTION.


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
     i_program_name               = w_repid
   I_INTERNAL_TABNAME           = 'IT_MARA'
*     i_structure_name             = 'IT_MARA'
*   I_CLIENT_NEVER_DISPLAY       = 'X'
   I_INCLNAME                   = w_repid
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = it_fieldcat_wrt_off[]
   EXCEPTIONS
     inconsistent_interface       = 1
     program_error                = 2
     OTHERS                       = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program     = w_repid
      i_callback_top_of_page = 'TOP-OF-PAGE'
      is_layout              = wa_layout
      it_fieldcat            = it_fieldcat_wrt_off
    TABLES
      t_outtab               = it_mara
    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                                                 *
*-------------------------------------------------------------------*
* 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 = 'CHANDU 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.                    "top-of-page

Former Member
0 Kudos
118

its not working on alv grid screen when i am pressing back button its showing in separate blanklayout of the username and the date, how to get the same things in the top of alv grid control.

0 Kudos
118

You might have written some write statement , remove that WRITE statement , it will work

0 Kudos
118

i hace not writeen any write statement but still its diplaying on other screen when i getting back from the alv grid control, when i press back button from the output alv grid control the list is shown next instead of selection screen.

Former Member
0 Kudos
118

just write this.

form TOP-OF-PAGE

DATA: it_list_top_of_page TYPE slis_t_listheader,

wa_list_top_of_page TYPE slis_listheader.

  • Prepare the header.

wa_list_top_of_page-typ = 'H'.

wa_list_top_of_page-info = 'top of page'.

APPEND wa_list_top_of_page TO it_list_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = it_list_top_of_page.

endform.

and delete the code below from your report

FORM f_list_header USING P_I_LISTHEADER.

DATA: lt_list_top_of_page TYPE slis_t_listheader,

lwa_list_top_of_page TYPE slis_listheader.

  • Prepare the header.

lwa_list_top_of_page-typ = 'H'.

lwa_list_top_of_page-info = 'SO report'.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

lwa_list_top_of_page-info = sy-uname.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = lt_list_top_of_page.

ENDFORM. " f_list_header

regards

shiba dutta

0 Kudos
118

do i need to place the top-of-page in the alv grid fm or in a event.

0 Kudos
118

i_callback_top_of_page = 'TOP-OF-PAGE' "in ur fm since it is this

i hope u r not getting confused with this .

<b>call back</b> top of page is handled by form routine . <b>you need not write a perform</b> to handle this .

just u need to put ur code in

form top-of-page

xxx

xxx

xxx

endform.

thats all .

regards,

vijay

Former Member
0 Kudos
118

Hi,

Try with this modified code.

FORM f_display_list .

s_events-form = 'TOP_OF_PAGE'.

s_events-name = 'TOP_OF_PAGE'.

APPEND s_events TO lt_events.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = v_repid

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'

IS_LAYOUT = i_gs_layout

IT_FIELDCAT = i_gt_fieldcat[]

IT_EVENTS = lt_events[]

TABLES

T_OUTTAB = i_final.

form TOP-OF-PAGE.

DATA: lt_list_top_of_page TYPE slis_t_listheader,

lwa_list_top_of_page TYPE slis_listheader.

  • Prepare the header.

lwa_list_top_of_page-typ = 'H'.

lwa_list_top_of_page-info = 'SO report'.

lwa_list_top_of_page-info = sy-uname.

APPEND lwa_list_top_of_page TO lt_list_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = lt_list_top_of_page.

endform.

Rgds,

Prakash

Former Member
0 Kudos
118

answered