ALV Object Model
ALV Object Model
2.
3.
4.
5. 6.
ABAP Objects provides an advanced level of encapsulation that improves maintainability and stability of programs. ABAP Objects allows you to instantiate multiple instances of a single class. ABAP Objects greatly enhances code reuse through inheritance a key feature of OO . ABAP Objects is the only way to use new ABAP technology Web Dynpro ABAP etc. Explicit Event handling . Better Interfaces . Reference article on ABAP OO - http://www.sapdb.info/wpcontent/uploads/2008/09/why-abap-objects.pdf
CL_SALV_TABLE
Two Dimensional data display in ALV_GRID form . Object orientation (OO), or to be more precise, object-oriented programming . No screens to define , no field catalogs to create no PBO and PAI modules , standard menu bar can be used. More functionality for application development. Extremely fast delivery to users. A way to get used to what ABAP programming is trending towards. Only Available in ECC 6.0 and above .
CL_SALV_TABLE CL_SALV_FUNCTIONS CL_SALV_DISPLAY_SETTINGS CL_SALV_COLUMNS_TABLE and CL_SALV_COLUMN_TABLE CL_SALV_SORTS CL_SALV_AGGREGATIONS CL_SALV_FILTERS CL_SALV_LAYOUT CL_SALV_EVENTS_TABLE
CL_SALV_DISPLAY_SETTINGS
data: gr_display type ref to cl_salv_display_settings. gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ) .
Columns CL_SALV_COLUMNS_TABLE and CL_SALV_COLUMN_TABLE (make column settings old field catalog )
data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table. gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ). gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ).
and
class lcl_handle_events definition deferred. HOT SPOT EVENT data: gr_events type ref to lcl_handle_events. CLASS lcl_handle_events DEFINITION. PUBLIC SECTION. METHODS on_single_click FOR EVENT link_click OF cl_salv_events_table IMPORTING row column. ENDCLASS. "lcl_handle_events DEFINITION CLASS lcl_handle_events IMPLEMENTATION. METHOD on_single_click. PERFORM call_transaction USING row column . ENDMETHOD. "on_single_click ENDCLASS. "lcl_handle_events IMPLEMENTATION gr_column ?= gr_columns->get_column( 'EBELN' ). gr_column->set_cell_type( if_salv_c_cell_type=>hotspot ). data: lr_events type ref to cl_salv_events_table. lr_events = gr_table->get_event( ). create object gr_events. set handler gr_events->on_single_click for lr_events.
Resources
SE80 package SALV_OBJECTS ( SAP Demo Programs ) Test Programs (DEV ECC) - Z_BC_CL_SALV_TABLE1 Z_BC_CL_SALV_TABLE_FUNCTIONS Z_BC_CL_SALV_TABLE_LAYOUT https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b0e01-0010-0990-8530de4908a6 - ALV Object Model The Basics https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d -0e01-0010-90b2-c4e1f899ac01 - ALV Object Model Event Handling http://help.sap.com/saphelp_nw04/helpdata/en/5e/88d440e14f8431e10000 000a1550b0/frameset.htm - SAP Help - ALV Object Model https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/acdefb130701-0010-f1a2-8eeefa7d3780 - Utilizing the New ALV Object Model https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f6556c740e01-0010-aa99-b96b4316fed9 - FI report using the ALV OM https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5dc3e690 -0201-0010-1ebf-b85b3bed962d - SAP List Viewer The New
Columns Rows Span of Rows and Columns Alignment (left justified, right justified)
Nested layout of Grid and Flows possible (e.g. Grid in Grid, Flow in Grid)
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4d40e790-02010010-c695-e7ce17ff5908 - How to use ALV Form Elements for Events Test Program ( DEV ECC ) - Z_BC_CL_SALV_TABLE_LAYOUT
Reference Programs SE80 package SALV_OBJECTS ( SAP Demo Programs ) Test Program (DEV ECC) -> Z_BC_CL_SALV_TREE