on 06-08-2007 4:38 PM
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.
Hi Vinodman,
The problem is in the fourth line of your code below:
l_model TYPE REF TO cl_salv_wd_config_table
Since you have defined it inside the OnInit method, once the control goes out of this method, this variable is lost. So, declare in this 'l_model' in the attributes section of the view (it is the sixth tab on the right pane when you double click on your view name in the left pane of SE80 transaction).
This will for sure solve your problem. Please post back in case you face further issues.
Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinod,
I analysed your code and found the following: The data model has not been set for the ALV.
The ALV generally picks up the data from the context node that is assigned to it. However, in your code, you have missed to do so. The sample code for assigning the context node to your ALV is as follows:
data lo_nd_node_name type ref to if_wd_context_node.
* navigate from <CONTEXT> to <NODE_NAME> via lead selection
lo_nd_node_name = wd_context->get_child_node( name = wd_this->wdctx_node_name ).
l_ref_interfacecontroller->set_data(
r_node_data = lo_nd_node_name ).
Place the above code just before the 'set_model' method call.
Please modify the names as per your requirement. Let me know in case you face further issues.
Regards,
Ram
Note: I have edited the above code to replace "lo_interfacecontroller" with "l_ref_interfacecontroller" - just to keep up with the naming convention in your code.
Message was edited by:
Ramalingam Krishnan
Hi Ram,
I'm still getting the same error at the same place. Below is the latest changes to the code as per your advice..
You could reach me at damasta2k@gmail.com/ damasta2k@yahoo.com. Please.
I'll make sure i hit on the points buttons after you help me with this problem. I reall y appreciate your help.
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_interface 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_interface = wd_this->wd_cpifc_multi_alv( ).
DATA:
node_mdoc TYPE REF TO if_wd_context_node,
elem_mdoc TYPE REF TO if_wd_context_element.
navigate from <CONTEXT> to <MDOC> via lead selection
node_mdoc = wd_context->get_child_node( name = if_create_mass_entry=>wdctx_mdoc ).
l_interface->set_data( r_node_data = node_mdoc ).
*Map the model
wd_this->l_model = l_interface->get_model( ).
*Map the columns
lt_columns = wd_this->l_model->if_salv_wd_column_settings~t_columns.
*Map the fields
lt_fields = wd_this->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 = wd_this->l_model
allowed = abap_false ). " try abap_true.
........as per the codes in previous posting.
Hi Vinod,
I compared your code with an application that i have written myself. There is only one difference related to the code. I'm highlighting the changes you need to do:
The problem seems to be in the following block:
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_interface = wd_this->wd_cpifc_multi_alv( ).
Replace the above code with the following code:
l_ref_cmp_usage = wd_this->wd_cpuse_main_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
*Map the interface.
l_interface = wd_this->wd_cpifc_main_alv( ).
If this does not solve your problem, then please check the following:
1. have you mapped the context node used here from the component controller to this particular view?
2. have you activated your component controller?
Please let me know if this solves your problem.
Regards,
Ram
Note: The change is that 'multi' is replaced by 'main'. 'multi' is used only in case of more than one usage of the grid (which i guess is not your case).
Message was edited by:
Ramalingam Krishnan
Hi guys......I'm checking this thread.....every few minute for the pass 2 hours.....if someone knows the problem and the solution to it ...please post.....i'm stuck and cant proceed with out figuring out this problem.
Thank you very much
Vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.