Monday 18 August 2014

Object Oriented ALV (OO ALV) tutorials in detail using CL_SALV_TABLE class

Following are the tutorials relating to  Object Oriented ALV (OO ALV) using CL_SALV_TABLE class .  CL_SALV_TABLE  provides very powerful methods that will do magic just by calling those methods.

1.Object Oriented ALV (OO ALV) using simple report
To display ALV using OO , you just need to do two things :
1.One prepare the final internal table that you want to display.
2.Call two methods factory and display of class cl_salv_table ...

2.Activate All Generic ALV Functions(Sort , total , subtotal , excel etc) in
 application toolbar using Object Oriented ALV(OO ALV) in SAP ABAP 
The purpose of ALV(SAP List Viewer) is that it offer the following functionalities as standard in the application
 toolbar, so that you do not need to implement them yourself :
• 1.Details: Displays the data for the selected row in a dialog box.
• 2.Sort ascending/descending: Displays the selected column or columns in a sorted way.
• 3.Search: Users can specify search terms and search order (columns or rows).
• 4.Set filter: Restricts the display based on any filter criteria the user chooses...

3.Adding user-defined button in PF status in Object oriented ALV (OO ALV) 
Many times in ALV it is required that after the ALV is displayed we need to do some user defined
 functionality for example on of my client requirement was to make the delivery quantity field editable
 in the ALV and after user update the delivery quantity value and click the user defined button ,
 it should save the delivery quantity against that particular delivery...

4.Display custom column name in Object Oriented ALV (OO ALV) in SAP ABAP 
Many time it is required to display custom column name , for example the user wants to display 
a table in the ALV whose structure has some field of elementary type i.e. data element is not maintained
 for these fields . For example the structure of the table is as follows :..

5.How to remove functions or icons in ALV toolbar in CL_SALV_TABLE using
 factory method in SAP ABAP. 
In my previous posts , we have shown you how to activate all generic ALV functionality Activate all generic 
functionalities in OO ALV . Today , I will show you how to add / remove functions / icons in ALV toolbar ,
 suppose the output of the ALV is something like that , see the previous link...
6.Add header / top of page in Object Oriented ALV (OO ALV) using cl_salv_table in SAP ABAP 
Many time we come across a requirement where we have to display message logs and along with it we also need
 to display the top of page / header . Please refer to the below source codes ...

7.Set title and zebra/stripped pattern in Object Oriented ALV ( OO ALV ) 

8.Optimize column width in Object Oriented ALV ( OO ALV ) 

9.Fix / Freeze the key fields in Object Oriented ALV ( OO ALV )

10.Hide / visible a particular column / columns in Object Oriented ALV ( OO ALV ) 
Many time it is required to show or hide particular column / columns , depending upon the display requirement
 or layout. Class cl_salv_column_table provides a powerful methodset_visible , which can make column visble
 is value is true and invisible if value is set to false.
By default value is set to true.
In this example , we are hiding the column 'MATNR' ...

11.Add save layout / change layout / choose layout button in 
Object Oriented ALV ( OO alv ) 
The developer who like to develop ALV using cl_salv_table might have notice that the Select layout and
 Save layout buttons are not visible even by using the set_all( ) method of class cl_salv_functions_list as
 shown in the below image...

12.Color the particular column / columns in Object Oriented ALV ( OO alv )
Many time it is required to color the entire column to highlight the informartion.
Color is one of the property of column , you can call the set_color( ) method of class cl_salv_column_table 
to change the color of the column . The value to pass in the set_color( ) method will be a work area 'ls_color' of type lvc_s_colo ...

13.Color the entire row / rows in Object Oriented ALV ( OO alv )
Many time it is required to color the entire row to highlight the informartion.For example one of our client was 
having the requirement to display the particular rows in red , yellow and green if no of days delayed in delivery
 fields value is greater then equal to 15 , less then 15 and greater then 0 , less then equal to 0...

14.F4 help for layout in selection screen in Object Oriented ALV ( OO ALV ) using CL_SALV_TABLE class
In this tutorial I will show you how you can choose the layout from your selection screen and display the output accordingly . Layout or layout variant helps the user to display the output in a particular format such as sorted ,
 total , filter structure , column arrangement etc , layout stores these informations ...

15.Display traffic light ( Red , Green and Yellow ) in 
Object Oriented ALV ( OO ALV) using CL_SLAV_TABLE 
Many time it is required to display the output in such a way that the user can identify the particular records is
 having errors , warning or success. One of our client have the requirement to upload the values from 
a file and do the processing , those records which satisfies all the conditions will be displayed as
 Green (Success)  , those you partially meet the condition will be displayed as Yellow (Warning) and those
 records which does not satisfies any of the conditions will be displayed as red(Fail)...

16.Applying AGGREGATIONS in Object Oriented ALV ( OO ALV ) 
Aggregations are nothing but combinations of values of multiple rows in an ALV , where these multiple values
 are grouped together as input based on certain conditions to form a single value of more significant value. 
For example : Average value, sum value , count , minimum value , maximum value , median , mode etc. 
Similar to sorting , the user can do aggregations programmatically as well as using the ALV application toolbar functionality ...

18.Applying FILTERING in Object Oriented ALV ( OO ALV ) 
Filtering is very important functionality while reporting . Similar to sorting , the user can do aggregations
 programmatically as well as using the ALV application toolbar functionality .
Filtering in OO ALV will work similarly as putting the select-option or range in your final output table to display on a particular column or group of columns...

19.Enabling Selection Mode in Object Oriented ALV ( OO ALV ) : 
Object Oriented ALV using CL_SALV_TABLE also provide the factility to the programmer to determine whether and
 in which situation the user can select areas of the ALV output .it is possible to programmatically determine which
 area needs to be selected and which areas are not required to select. The user can select multiple columns and
 multiple rows in an Object Oriented ALV . ..

20.CHECKBOX IN Object Oriented ALV ( OO ALV ) IN SAP ABAP . 
In this SAP ABAP tutorial I will show you how to make editable checkbox in Object Oriented ALV ( OO ALV )
 using CL_SALV_TABLE.To achieve this functionality you need to call the method set_cell_type of classcl_salv_column_table and pass the value as if_salv_c_cell_type=>checkbox_hotspot .
 Now clicking on the checkbox will trigger the event LINK_CLICK , so we need to declare and event handler
 class here lcl_event_handler and declare a method m_link_click to handle the action . The LINK_CLICK
 event will give us the row and column value of the selected checkbox row , to we need to change the
value to ‘X’ or 1 to mark it as checked ...

20.HOTSPOT/SINGLE CLICK AREA IN Object Oriented ALV ( OO ALV ) 
IN SAP ABAP

In this SAP ABAP tutorial I will show you how to make hospot or single click area in Object Oriented ALV ( OO ALV ) using CL_SALV_TABLE.

To achieve this functionality you need to call the method set_cell_type of class cl_salv_column_table and
 pass the value as if_salv_c_cell_type=>hotspot . Now clicking on the checkbox will trigger the
 event LINK_CLICK , so we need to declare and event handler class here lcl_event_handler and declare 
a method m_link_click to handle the action . The LINK_CLICK event will give us the row and column value of the selected row , so that we can do further process based on the value of that field.

21.CHANGE TEXT ALIGNMENT OF COLUMN IN Object Oriented ALV ( OO ALV ) 
In this SAP ABAP tutorial I will show you how to  change the alignment of text of particular column or
 columns in Object Oriented ALV ( OO ALV ) .
Programmatically now you can change the text alignment on three possibilities :
1.Left aligned.
2.Centered.
3.Right aligned.
N.B : By default numericals values are right aligned and words are left aligned.Now , we can change
 this according to our own taste.

No comments:

Post a Comment