Application Development and Automation 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: 
Read only

Tile for alvgrid report

Former Member
0 Likes
570

Iam working with Reuse_alv_grid_display.

i want to show a title for this grid.

please tell me how to show this.

Thanks,

srik

4 REPLIES 4
Read only

dani_mn
Active Contributor
0 Likes
506

HI,

use the FM <b>'REUSE_ALV_COMMENTARY_WRITE</b>' into top-of-page event to write the title in grid.

check the following program.

REPORT ZWA_ALV_EDITABLE_FM .

type-pools: slis.

data it_fieldcat type slis_fieldcat_alv occurs 0 with header line.
data: gs_layout type slis_layout_alv.
data v_repid like sy-repid.

DATA: BEGIN OF itab OCCURS 0.
        INCLUDE STRUCTURE CSKT.
DATA: end of itab.


START-OF-SELECTION.

  v_repid = sy-repid.

*--- selection form cost center master table

  SELECT * FROM CSKT
  INTO TABLE itab.

  PERFORM field_catalog.




  call function 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program     = v_repid
            it_fieldcat            = it_fieldcat[]
            is_layout              = gs_layout
            i_callback_top_of_page = 'TOP-OF-PAGE1'
            i_grid_title           = 'xyz'
            i_default              = 'X'
            i_save                 = 'U'
       TABLES
            t_outtab               = itab.


*&---------------------------------------------------------------------*
*&      Form  field_catalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM field_catalog.

  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name     = v_repid
            i_internal_tabname = 'ITAB'
            i_inclname         = v_repid
       CHANGING
            ct_fieldcat        = it_fieldcat[].


ENDFORM.                    " field_catalog


*---------------------------------------------------------------------*
*       FORM top-of-page1                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form top-of-page1.
  data: header type slis_t_listheader,
  wa type slis_listheader.


  wa-typ = 'S'.
  wa-info = 'dd'.
  append wa to header.

  wa-typ = 'S'.
  write sy-datum to wa-info mm/dd/yyyy.
  concatenate 'abc' wa-info into wa-info separated by space.
  append wa to header.

  wa-typ = 'S'.
  concatenate 'cd' sy-uname into wa-info separated by space.
  append wa to header.

  wa-typ = 'S'.
  concatenate 'ee' sy-repid into wa-info separated by space.
  append wa to header.
<b>  call function 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
            it_list_commentary = header.</b>


ENDFORM.

REgards,

Read only

Former Member
0 Likes
506

If you just want a title on top of the grid, you can specify the title in the <b>I_GRID_TITLE</b> parameter of the function.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
506

Use the following code :

  • VARIABLES FOR ALV GRID

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

ls_fieldcat TYPE slis_fieldcat_alv,

gt_events TYPE slis_t_event,

gs_variant LIKE disvariant,

g_repid LIKE sy-repid.

CONSTANTS: gc_formname_top_of_page TYPE slis_formname VALUE

'TOP_OF_PAGE'.

DATA : lines(8) TYPE c.

                                                                                                                • Initialization

********************************************************

INITIALIZATION.

g_repid = sy-repid.

gs_variant-report = g_repid.

PERFORM initialize_fieldcat USING gt_fieldcat[].

PERFORM e03_eventtab_build USING gt_events[].

                                                                                                                • END of selection

********************************************************

END-OF-SELECTION.

FORM initialize_fieldcat USING l_fieldcat TYPE slis_t_fieldcat_alv.

ls_fieldcat-fieldname = 'VKBUR'.

ls_fieldcat-col_pos = 1.

ls_fieldcat-seltext_l = 'Sales Office'.

ls_fieldcat-fix_column = 'X'.

APPEND ls_fieldcat TO l_fieldcat.

CLEAR ls_fieldcat.

ENDFORM.

FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = e03_lt_events.

READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE gc_formname_top_of_page TO ls_event-form.

APPEND ls_event TO e03_lt_events.

ENDIF.

ENDFORM. " e03_eventtab_build

FORM top_of_page.

  • Total No. of Records Selected

DESCRIBE TABLE t_itab LINES lines.

SKIP 1.

NEW-LINE NO-SCROLLING.

WRITE:/ '----


'.

NEW-LINE NO-SCROLLING.

endform.

regards

Sandeep Josyula

*Reward if helpful

Read only

Former Member
0 Likes
506

Hi,

If it is single line title then

enable option I_GRID_TITLE and pass variable which will contain title for ALV.

It will then display proper title in ALV Grid

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

...

I_GRID_TITLE = <variable which contains title>

....