on 01-24-2009 5:32 AM
Hi All,
I am working with the tray ui lement in weddynpro. I inserted 4 select options( cancel,check..buttons) in tray using the component wdr_select_options.My doubt is how to provide actions for those buttons.Can anybody help me regarding this.....
Thanks in Advance.
Hi,
I am new to webdynpro.i am unable to understand the component usage,how can we give the actions in the used component ie wdr_select_options.In how to provide actions in our component for the buttons of the used component.Can u please give me the steps for this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have used the standard component u2018salv_wd_tableu2019 in my application and will be able to give example on the same.
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( ).
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( 'PTRM_WEB_UI/EMPLOYEELIST' ).
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 ).
Delete functions if exist (Required in showing emp list the seconde time)
DATA: lr_functions TYPE REF TO if_salv_wd_function_settings.
lr_functions ?= wd_this->mr_table.
lr_functions->delete_function( 'ADD_EMPLOYEE' ).
lr_functions->delete_function( 'REMOVE_EMPLOYEE' ).
lr_functions->delete_function( 'FPB_PERS' ).
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.
wd_this->m_seltype = get_pers_type( ).
CASE wd_this->m_seltype .
WHEN 'P'. " Personalization by Personal list
lr_function = lr_functions->create_function( 'ADD_EMPLOYEE' ).
CREATE OBJECT lr_fe_button.
l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'PTRM_WEB_UI/ADD_EMPLOYEE' ).
lr_fe_button->set_text( l_btn_text ).
" lr_fe_button->set_tooltip( l_btn_text ).
lr_function->set_editor( lr_fe_button ).
lr_function = lr_functions->create_function( 'REMOVE_EMPLOYEE' ).
CREATE OBJECT lr_fe_button.
l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'PTRM_WEB_UI/REMOVE_EMPLOYEE' ).
lr_fe_button->set_text( l_btn_text ).
lr_fe_button->set_enabled( abap_false ).
" lr_fe_button->set_tooltip( l_btn_text ).
lr_function->set_editor( lr_fe_button ).
ENDCASE.
After defining the buttons 'ADD_EMPLOYEE' and 'REMOVE_EMPLOYEE', 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 'ADD_EMPLOYEE'.
add_employee_to_list( ).
when 'REMOVE_EMPLOYEE'.
delete_employee_to_list( ).
endcase.
endmethod.
Thanks,
Rajkumar.S
Hi ,
For all the buttons that you have added, there should be some events for the corresponding buttons. For the particular button UI element you can see property named onAction, there you can define your own methods and build the logic for the same.
Thanks,
Rajkumar.S
Edited by: Rajkumar S on Jan 24, 2009 7:07 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I had the similar requirement and just constructed my own table with the toolbar buttons that will take care of insert, delete and check functionalities. It again depends upon your requirement, if you just need a table with the above functionalities then you could follow the above.
Thanks,
Rajkumar.S
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.