on 11-16-2009 9:54 AM
Dear All,
I want to know how to use tool bar in alv table? Is there any seperate interfaces available for it?
Thanks,
Gopi.
Hi,
Please check this class cl_salv_wd_config_table..
do you want to use the standard toolbar functions or custom ones...
check for this interface IF_SALV_WD_FUNCTION_SETTINGS for custom ones...
If you want to add any custom buttons in the ALV tool bar then the above interface methods are used..
Please elaborate your requriement.
Regards,
Lekha.
Edited by: Lekha on Nov 16, 2009 3:29 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
first you need to disable all the standard toolbar options becasue the INSERT & ADD are already there ....
If you want to have the custom ones...
Refer these Links -
In the above link Input feilds are used...
You can use CL_SALV_WD_FE_LINK_TO_ACTION(Linktoaction), CL_SALV_WD_FE_LINK_TO_URL(link to url), button(CL_SALV_WD_FE_button) classes to create the custom ones....
Regards,
Lekha.
Edited by: Lekha on Nov 16, 2009 4:12 PM
Hi,
1.To deactivate the Standard buttons:
Data: lr_config_table TYPE REF TO cl_salv_wd_config_table,
lo_value = lo_interfacecontroller->get_model( ).
lr_config_table ?= lo_value .
Wd_this->lr_config_table ?= lo_value .
lr_config_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
lr_config_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
lr_config_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
2.To create the customized buttons:
Create the a method initilaze_buttons.
Data:lv_function_add_record_sap TYPE REF TO cl_salv_wd_function,
lv_button_add_record_sap TYPE REF TO cl_salv_wd_fe_button,
R_ALV_TABLE_COMP type ref to CL_SALV_WD_CONFIG_TABLE.
r_alv_table_comp = wd_this->lr_config_table.
Generate Function Objects
lv_function_add_record_sap = wd_this->lr_config_table->if_salv_wd_function_settings~create_function( 'ADD_RECORD_SAP' ).
Generate Buttons
CREATE OBJECT lv_button_add_record_sap.
lv_button_add_record_sap->set_image_source( 'ICON_INSERT_ROW' ).
lv_button_add_record_sap->set_text( 'Add Record' ).
Assign Buttons to Functions
lv_function_add_record_sap->set_editor( lv_button_add_record_sap ).
Set positions of the buttons
lv_function_add_record_sap->set_position( value = 1 ).
Set Alignment of the buttons
lv_function_add_record_sap->set_alignment( value = if_salv_wd_c_function_settings=>align_left ).
Call this method initilaze_buttons in WDDOINIT .
3.To find out which button is clicked an dhandling that function
A)Go to methods tab.
B)give the name of the method as on_button select the method type as Eventhandler.
In the event coulmn select the event ON_FUNCTION of the ALV comp.
METHOD on_button .
DATA index TYPE i.
index = wd_this->sort_index .
CASE r_param->id."r_param->id is importing paramter which comes automatically once u use the event handler
WHEN 'DELETE_ROW'. "Delete row
wd_this->delete_row( )."methods you need to create and call them here.(your own customized button functionality
WHEN 'ADD_RECORD_SAP'.
wd_this->add_record_sap( ).
ENDCASE.
r_param->id holds the value which button is clicked.
Priya
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
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.