on 02-26-2009 11:36 AM
hi all,
i am using input field in alv table . i want to handle ON ENTER event .
I tryed all the events. But it not working.
ON_AFTER_CONFIG
ON_CELL_ACTION
ON_CLICK
ON_DATA_CHECK
ON_FUNCTION
ON_LEAD_SELECT
is thee some other thing to be added.
Thanx
Vivekananthan.S
Edited by: vivekananthan sellavel on Feb 26, 2009 12:37 PM
hi,
I can give example for one of the ALV action 'ON_FUNCTIONu2019.The one i marked in bold will help achieving your requirement.
I have used the standard component u2018salv_wd_tableu2019 in my application and will be able to give example by adding a button named 'NEW__BUTTON' .
In the WDDOINIT method of the component controller, use the following code to define column name, your own buttons, visible column for the same component usage.
DATA:
lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
*Check ALV component usage
lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
lr_salv_wd_table_usage->create_component( ).
ELSE.
lr_salv_wd_table_usage->delete_component( ).
lr_salv_wd_table_usage->create_component( ).
ENDIF.
*Get ALV component
lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
wd_this->mr_table type ref to CL_SALV_WD_CONFIG_TABLE.
*Get ConfigurationModel from ALV Component
wd_this->mr_table = lr_salv_wd_table->get_model( ).
*Set table settings
DATA:
lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= wd_this->mr_table .
lr_table_settings->set_visible_row_count( '5' ).
lr_table_settings->set_width( '100%' ).
DATA:
lr_header TYPE REF TO cl_salv_wd_header,
l_header_text TYPE string.
lr_header = lr_table_settings->get_header( ).
l_header_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
lr_header->set_text( l_header_text ).
lr_header->set_tooltip( l_header_text ).
"lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).
*Set functions
IF wd_this->mb_no_maintain NE abap_true.
DATA:
lr_function TYPE REF TO cl_salv_wd_function,
lr_fe_button TYPE REF TO cl_salv_wd_fe_button,
l_btn_text TYPE string.
*Add the button here for validation on the top of the ALV
*This is where you add the buttons on the same ROW.
lr_function = lr_functions->create_function( 'NEW__BUTTON' ).
CREATE OBJECT lr_fe_button.
l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
lr_fe_button->set_text( l_btn_text ).
lr_fe_button->set_tooltip( l_btn_text ).
lr_function->set_editor( lr_fe_button ).
After defining the buttons 'NEW__BUTTON' , handle the actions for the same using the method u2018LIST_ACTIONu2019 which should have the event as u2018ON_FUNCTIONu2019, controller as u2018interface controlleru2019 and component use as the name you have given say u2018ALVu2019.
In the method u2018LIST_ACTIONu2019, handle the actions as below. This method will have the following importing parameters.
WDEVENT Importing CL_WD_CUSTOM_EVENT
R_PARAM Importing IF_SALV_WD_TABLE_FUNCTION
method list_action .
case r_param->id .
when 'NEW__BUTTON'.
"Do the validation here-"
endcase.
endmethod.
Thanks,
Rajkumar.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
ON_DATA_CHECK:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
You could also consider ON_CELL_ACTION:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi thomas,
i explain u what i did .
1.Called ALV Configuration.method in init( ) .
Read ALV NODE ********************************************
DATA lo_nd_hdr_itm TYPE REF TO if_wd_context_node.
lo_nd_hdr_itm = wd_context->get_child_node( name = wd_this->wdctx_hdr_itm ).
DATA: node_info TYPE REF TO if_wd_context_node_info,
lt_str TYPE wdr_context_attr_info_map,
wa_str TYPE LINE OF wdr_context_attr_info_map
.
**********************************************************************
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
l_interface TYPE REF TO iwci_salv_wd_table,
lr_table TYPE REF TO cl_salv_wd_config_table,
lr_col TYPE REF TO cl_salv_wd_column ,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_image TYPE REF TO cl_salv_wd_uie_image,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
clss TYPE REF TO CL_WD_INPUT_FIELD,
itc_table TYPE r IF_SALV_WD_C_TABLE_SETTINGS.
IF_SALV_WD_C_TABLE_SETTINGS~DATA_CHECK_ON_CELL_EVENT
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv_item( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ELSE.
lo_cmp_usage->DELETE_COMPONENT( ).
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv_item( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model( ).
lr_if_controller = wd_this->wd_cpifc_alv_item( ).
wd_this->gv_doc_append_btn = lr_if_controller->get_model( ).
*get config models
l_interface = wd_this->wd_cpifc_alv_item( ).
lr_table = l_interface->get_model( ).
wd_this->gv_table_setting ?= lr_table.
lr_column_settings ?= lr_table.
*to remove the print button
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_export_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_edit_insert_rows_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_column_selection_allowed( abap_false ).
wd_this->gv_doc_append_btn->if_salv_wd_std_functions~set_edit_check_available( abap_false ).
node_info = lo_nd_hdr_itm->get_node_info( ).
lt_str = node_info->get_attributes( ).
wd_this->gv_table_setting->set_read_only( abap_false ).
To make ALV Editable **********************************
IF wd_this->gc_action EQ 'D' OR wd_this->gc_roadmap EQ 'STEP2' .
lr_col = lr_column_settings->get_column( 'STATUSICON' ).
CREATE OBJECT lr_image.
lr_image->set_source_fieldname( 'STATUSICON' ).
lr_col->set_cell_editor( lr_image ) .
ELSE.
LOOP AT lt_str INTO wa_str .
IF wa_str-name EQ 'STATUSICON' .
lr_col = lr_column_settings->get_column( wa_str-name ).
CREATE OBJECT lr_image.
lr_image->set_source_fieldname( 'STATUSICON' ).
lr_col->set_cell_editor( lr_image ) .
ELSE.
lr_col = lr_column_settings->get_column( wa_str-name ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = wa_str-name.
lr_col->set_cell_editor( lr_input_field ) .
2. In the view controller called all the event
1 ON_CELL_ACTION
2.ON_CLICK
3.ON_DATA_CHECK
4.ON_FUNCTION
5.ON_LEAD_SELECT
6.ON_STD_FUNCTION_AFTE
7.ON_STD_FUNCTION_BEFO
3. For testing in all the events i wrote
l_msg->report_success( "TEST ").
4.if i give ENTER in input field. Message should be populated.
But event is not fireing. Event i keep the break point .its not stoping
4.ON_FUNCTION
. ON_LEAD_SELECT
is working fine. but if i give enter it not working
give ur Suggestion.
Thax.
Edited by: vivekananthan sellavel on Feb 27, 2009 6:25 AM
Hi,
Had you checked with this.
calss name:CL_WD_INPUT_FIELD
method name:NEW_INPUT_FIELD
Parameter name: ON_ENTER
Check once with this.
Regards,
sarath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.