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 dispaly 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 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. * DATA: lo_display TYPE REF TO cl_salv_display_settings. * * get display object lo_display = o_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:
No comments:
Post a Comment