Sei sulla pagina 1di 2

method WDDOINIT . * Create component usage for alv component data lo_cmp_usage type ref to if_wd_component_usage.

lo_cmp_usage = wd_this->wd_cpuse_alv_test( ). if lo_cmp_usage->has_active_component( ) is initial. lo_cmp_usage->create_component( ). endif. * Get config model DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE . lo_INTERFACECONTROLLER = wd_this->wd_cpifc_alv_test( ). DATA lv_value TYPE ref to cl_salv_wd_config_table. * Class CL_SALV_WD_CONFIG_TABLE is the main class of the Web Dynpro ALV configuration model. * It is the root class in the hierarchy for the ALV object model: The m ost important metadata * with which you determine the appearance, range, and sort sequence of the ALV output, * for example, can be attained using methods from this class lv_value = lo_interfacecontroller->get_model( ). * set visible row count lv_value->if_salv_wd_table_settings~set_visible_row_count( '5' ). * Sort rows by seatsmax column in descending order DATA: lr_field TYPE REF TO cl_salv_wd_field. lr_field = lv_value->if_salv_wd_field_settings~get_field( 'SEATSMAX' ). lr_field->if_salv_wd_sort~create_sort_rule( sort_order = if_salv_wd_c_sort=>sort_order_descending ). * Disaply icon in column seatsocc DATA: lr_column TYPE REF TO cl_salv_wd_column, *Class CL_SALV_WD_COLUMN contains all the methods to determine the * position and appearance of a column. lr_image TYPE REF TO cl_salv_wd_uie_image, *Using class CL_SALV_WD_UIE_IMAGE, you make all the settings for *the image UI element, with which you can insert any graphics into the cells of the ALV output. lv_icon TYPE string. lr_column = lv_value>if_salv_wd_column_settings~get_column('SEATSOCC'). CREATE OBJECT lr_image. * set_source_fieldname : sets field with graphic label in cells lr_image->set_source_fieldname('STATUS'). * set_cell_editor: sets the UI elements that is displayed in the column cells lr_column->set_cell_editor( lr_image ). " display traffic light imag es in column SEATSOCC * IF_SALV_WD_COLUMN_SETTINGS Using these methods, * you manage the column objects of the ALV output.

* lv_value->if_salv_wd_column_settings~delete_column( 'STATUS' ). * delete_column : deletes the object of a column * set cell editor for input fields *The IF_SALV_WD_COLUMN_SETTINGS interface class contains methods for ma naging columns * in the ALV output. DATA:lr_column_settings TYPE REF TO if_salv_wd_column_settings, * With the CL_SALV_WD_UIE_INPUT_FIELD class you define all the settings for the input * field UI element, with which you can make entries to the ALV output. lr_input_field TYPE REF TO cl_salv_wd_uie_input_field. lr_column_settings ?= lv_value. * get_column: returns the object of a column lr_column = lr_column_settings->get_column( 'PRICE' ). CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'PRICE'. lr_column->set_cell_editor( lr_input_field ). * set read only mode to false (and display edit toolbar) data: lr_table_settings type ref to if_salv_wd_table_settings. * The IF_SALV_WD_TABLE_SETTINGS interface class contains all methods fo r the * settings that control the entire ALV output lr_table_settings ?= lv_value. * set_read_only method write protects the ALV output lr_table_settings->set_read_only( abap_false ). endmethod.

Potrebbero piacerti anche