cancel
Showing results for 
Search instead for 
Did you mean: 

How to include tool bar in alv table?

Former Member
0 Kudos

Dear All,

I want to know how to use tool bar in alv table? Is there any seperate interfaces available for it?

Thanks,

Gopi.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

hi,

thanks for ur response.

My requirement is i just want to use tool bar in my alv table. (customized tool bar)

How to use this IF_SALV_WD_FUNCTION_SETTINGS . Can u please explain me in detail.

Thanks,

Gopi.

Former Member
0 Kudos

Hi,

What do you want to have in custom toolbar.........

Former Member
0 Kudos

Hi,

My requirements are as follows:

I want to include,

1. insert line button and delete line button

2. input field in tool bar

3.link to action

4. link to url

Thanks,

Gopi.

Former Member
0 Kudos

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 -

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110&override...

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

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Answers (0)