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: 

Replacement for i_grid_title in REUSE_ALV_GRID_DISPLAY in SALV

rainer_hbenthal
Active Contributor
0 Kudos

Hi,

im looking for an replacement for I_grid_title the the FM REUSE_ALV_GRID_DISPLAY:


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

      i_callback_program = alv_report_id

    i_grid_title      = tmp_title

      is_layout          = alv_layout

      is_print          = alv_print

      it_fieldcat        = it_fcat

      i_save            = 'A'

      it_sort            = it_alv_sort

      is_variant        = alv_variant

I tried


salv_display_settings->set_list_header( 'Userlist' ).

and


  create object salv_header.

  salv_label = salv_header->create_label( row = 1 column = 1 ).

  salv_label->set_text('Title for the ALV').

  salv->set_top_of_list( salv_header ).

But both are not an replacement for the I_grid_title parameter as the position and look&feel is completely different.

11 REPLIES 11

Former Member
0 Kudos

hi,

try this piece of code for fm reuse grid display.

TYPES: BEGIN OF GRID,

         TITLE TYPE CHAR70,

     END OF GRID.


MOVE 'Report For Items' TO I_GRID-TITLE.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

     I_CALLBACK_PROGRAM                = sy-repid

    I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'

    I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'

      I_GRID_TITLE                      = I_GRID-TITLE

       IS_LAYOUT                         = G_LAYOUT

      IT_FIELDCAT                       = IT_FCAT[]

       I_SAVE                            = 'A'

      IS_VARIANT                        = LS_VARIANT

     TABLES

       T_OUTTAB                          = IT_OUTPUT4

* 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.

0 Kudos

Better read my question again *sigh*

0 Kudos

<chuckles>

rainer_hbenthal
Active Contributor
0 Kudos

Just wondering if there is really no replacement for this parameter in the OOPS variant

0 Kudos

Hi Rainer,

There is a replacement. Please check the quick example I have put together.

That leads to the Output:

Hope this is what you're looking for.

Regards

Oliver

0 Kudos

Why didn't you read my question more carefully? I definitely said that I tried the label/header stuff and that this is NOT a replacement as it looks different.

Worthless to ask here.

0 Kudos

Exactly - it looks better and gives more flexibility. Worthless to reply here.

0 Kudos

The worm must be tasty for the fish, and not for the fisherman. So if you think it looks better that's okay, but please allow others to have another opinion.

0 Kudos

Hi Rainer,

SALV OM encapsulates the different flavours of tabular ALV - list, fullscreen grid, container grid. I just put a breakpoint in REUSE_ALV_GRID_DISPLAY & executed the SALV OM.

BR,

Suhas

0 Kudos

If you want it to look the same, create splitter container. Put the SALV in the bottom one and in the top a document or HTML container - then you can play with the formatting to your heart's content and even make it look as it did old school.

former_member182915
Active Contributor
0 Kudos

Hi Rainer,

Simply make a program and check and share the output.

Each and Every thing of alv is handle more properly in OM model of ALV.

*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*

DATA: gt_makt TYPE TABLE OF makt.

DATA: gr_table TYPE REF TO cl_salv_table.

DATA: gr_display TYPE REF TO cl_salv_display_settings.

*&---------------------------------------------------------------------*
*& Start-of-Selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.

  SELECT * UP TO 10 ROWS FROM makt INTO TABLE gt_makt.

*Generate an instance of the ALV table object
  CALL METHOD cl_salv_table=>factory

  IMPORTING

  r_salv_table = gr_table

  CHANGING

  t_table = gt_makt.

*Get the reference to the settings of the table

  gr_display = gr_table->get_display_settings( ).
*Set the striped pattern (ZEBRA pattern)
  gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
*Set the heading

  gr_display->set_list_header( 'Heading for ALV Demo Program' ).

*Remove horizontal lines of the grid
  gr_display->set_horizontal_lines( if_salv_c_bool_sap=>false ).
*Remove vertical lines of the grid

  gr_display->set_vertical_lines( if_salv_c_bool_sap=>false ).

*Display the ALV table.
  gr_table->display( ).

Some time some property are overwritten because of wrong coding.