Hi DynPro Gurus,
I'm very new to ABAP WebDynpro, i could consider this would be my first program.
I'm not sure whats wrong with the code below but I'm getting the error as in the subject field.
Has anyone encountered this problem before? How can i resolve this problem? Please help.
Thank you.
*My code are below
METHOD wddoinit .
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_ref_interfacecontroller TYPE REF TO IWCI_SALV_WD_TABLE,
l_model TYPE REF TO cl_salv_wd_config_table, "Contains all characteristics of a table(collumns, fields, etc)
lt_columns TYPE salv_wd_t_column_ref, " Table type
lt_fields TYPE salv_wd_t_field_ref, " Table type
l_btn_ins TYPE REF TO cl_salv_wd_fe_button,
l_btn_del TYPE REF TO cl_salv_wd_fe_button,
l_btn_sell_all TYPE REF TO cl_salv_wd_fe_button,
l_btn_dell_all TYPE REF TO cl_salv_wd_fe_button,
l_btn_calc TYPE REF TO cl_salv_wd_fe_button,
l_btn_save TYPE REF TO cl_salv_wd_fe_button,
l_function TYPE REF TO cl_salv_wd_function.
l_ref_cmp_usage = wd_this->wd_cpuse_multi_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
*Map the interface.
l_ref_interfacecontroller = wd_this->wd_cpifc_multi_alv( ).
*Map the model
l_model = l_ref_interfacecontroller->get_model( ).
*Map the columns
lt_columns = l_model->if_salv_wd_column_settings~t_columns.
*Map the fields
lt_fields = l_model->if_salv_wd_field_settings~t_fields.
lt_fields = l_model->if_salv_wd_field_settings~t_fields.
cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
EXPORTING r_model = l_model
allowed = abap_false ). " try abap_true
----
*Enable or Disable the ALV desired outlook and design
----
l_model->if_salv_wd_table_settings~delete_header( ).
l_model->if_salv_wd_table_settings~set_selection_mode(
value = cl_wd_table=>e_selection_mode-multi ).
l_model->if_salv_wd_table_settings~set_width( value = '100%' ).
l_model->if_salv_wd_table_settings~set_visible_row_count( value = '10' ).
l_model->if_salv_wd_table_settings~set_read_only( value = abap_false ).
l_model->if_salv_wd_std_functions~set_filter_filterline_allowed( value = abap_true ).
l_model->if_salv_wd_std_functions~set_sort_headerclick_allowed( value = abap_true ).
l_model->if_salv_wd_std_functions~set_export_allowed( value = abap_false ).
----
*Adding functionalities to the ALV
CREATE OBJECT: l_btn_ins, l_btn_del, l_btn_sell_all, l_btn_dell_all, l_btn_calc, l_btn_save.
*'Insert Row' Button
l_btn_ins->set_text( 'Insert Row' ).
l_btn_ins->set_tooltip( 'To enter a new row' ).
l_btn_ins->set_image_source( value = 'ICON_INSERT_ROW' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).
l_function->set_position( value = '1' ).
l_function->set_editor( value = l_btn_ins ).
*'Delete Row' Button
l_btn_ins->set_text( 'Delete Row' ).
l_btn_ins->set_tooltip( 'Delete the selected row' ).
l_btn_ins->set_image_source( value = 'ICON_DELETE_ROW' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'DELETE' ).
l_function->set_position( value = '2' ).
l_function->set_editor( value = l_btn_del ).
*'Select All' Button
l_btn_ins->set_text( 'Select All' ).
l_btn_ins->set_tooltip( 'Select all entered record' ).
l_btn_ins->set_image_source( value = 'ICON_INSERT_ROW' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'SELECT' ).
l_function->set_position( value = '3' ).
l_function->set_editor( value = l_btn_sell_all ).
*'Deselect All' Button
l_btn_ins->set_text( 'Deselect All' ).
l_btn_ins->set_tooltip( 'Deselect all records selected' ).
l_btn_ins->set_image_source( value = 'ICON_DESELECT_ALL' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'DESELECT' ).
l_function->set_position( value = '4' ).
l_function->set_editor( value = l_btn_dell_all ).
*'Calculate' Button
l_btn_ins->set_text( 'Calculate Hours' ).
l_btn_ins->set_tooltip( 'Calculate hours of each record' ).
l_btn_ins->set_image_source( value = 'ICON_CALCULATION' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'CALC' ).
l_function->set_position( value = '5' ).
l_function->set_editor( value = l_btn_calc ).
*'Save' Button
l_btn_ins->set_text( 'Save' ).
l_btn_ins->set_tooltip( 'Save all' ).
l_btn_ins->set_image_source( value = 'ICON_SYSTEM_SAVE' ).
l_function = l_model->if_salv_wd_function_settings~create_function( id = 'SAVE' ).
l_function->set_position( value = '6' ).
l_function->set_editor( value = l_btn_save ).
ENDMETHOD.