SALV Table 6 – Display Settings

By | September 26, 2008 | SALV Table, SALV Tutorial, Tutorials | 37,213 | 1

In the series of the SALV Simple Model, we will see how we can set the Display Settings to the entire ALV. You can find the previous discussions in this blog series at Tutorials > SALV Table Display

To set the display settings, we need to use the reference of the class CL_SALV_DISPLAY_SETTINGS. We will ask the reference of the Display settings from our ALV object created using the CL_SALV_TABLE. By using the display settings, we can set the Zebra style, Title of the ALV etc.

Here is the code snippet to which provides the ADD-ON code to our Base program. The base program can be found in the SALV Model 1: Normal ALV Table Display .

UML diagram for this example is like:

Code Snippet

*$*$*.....CODE_ADD_1 - Begin..................................1..*$*$*
*
*    In this section we will define the private methods which can
*      be implemented to set the properties of the ALV and can be
*      called in the
*
  PRIVATE SECTION.
    METHODS:
      set_display_setting
        CHANGING
          co_alv TYPE REF TO cl_salv_table.
*$*$*.....CODE_ADD_1 - End....................................1..*$*$*
*
*$*$*.....CODE_ADD_2 - Begin..................................2..*$*$*
*
*    In this area we will call the methods which will set the
*      different properties to the ALV
    CALL METHOD set_display_setting
      CHANGING
        co_alv o_alv.
*$*$*.....CODE_ADD_2 - End....................................2..*$*$*
*
*$*$*.....CODE_ADD_3 - Begin..................................3..*$*$*
*
*    In this area we will implement the methods which are defined in
*      the class definition
*
  METHOD set_display_setting.
*
    DATAlo_display TYPE REF TO cl_salv_display_settings.
*
*   get display object
    lo_display co_alv->get_display_settings).
*
*   set ZEBRA pattern
    lo_display->set_striped_pattern'X' ).
*
*   Title to ALV
    lo_display->set_list_header'ALV Test for Display Settings' ).
*
  ENDMETHOD.                    "SET_DISPLAY_SETTING
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*

This code will generate the output like this:

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{274 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 274 articles.

Load comments

1 Comment

  • Anonymous

    too good

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.