on 06-22-2007 12:52 PM
Hi experts..
My requirement is to have a toggle button on alv toolbar..
That button should have the functionality to switch between change mode and display mode..
I also want to place an icon on that button..
Can u help me out with the toggle button fucntionality and the icon.
jagruti.
Hi Jagruti,
In the context node that you use to bind to the ALV table, add 2 more attibutes - IMAGE_SOURCE and FUNCTION_TEXT. You will bind these two attributes to the image_source and text properties of the button.
When you initialize the ALV settings, initialize the values for the attributes. Set the IMAGE_SOURCE attribute as ICON_DISPLAY or whatever icon you want. Set the function_text as 'Display'.
Firstly you need to create the button on your function in the ALV toolbar as below
data: lr_function TYPE REF TO cl_salv_wd_function,
lr_button type ref to cl_salv_wd_uie_button.
lr_function = lr_alv_model->if_salv_wd_function_settings~create_function( id = 'DISPCHNG' ).
create object lr_button.
lr_button->set_image_source_fieldname( 'IMAGE_SOURCE' ).
lr_button->set_text_fieldname( 'FUNCTION_TEXT' ).
lr_function->set_editor( lr_button ).
When you do a set_text_fieldname or set_image_source_fieldname, it means that the text and image properties are bound to the specific context attributes. This is similar to the static binding you would do for a normal table.
You will create an event handler for the ON_FUNCTION event of the ALV model. In your event handler, check for r_param-ID = DISPCHNG. In addition to that, read the context attribute FUNCTION_TEXT and do your processing. This is because your function ID is constant and only the button text and image changes.
Now if image_source = icon_display, you do a set_attribute as icon_change. And set_attribute of the function_text as Change. When you call bind_elements, it will get changed in the table.
I hope I was clear enough. Please award points if it solves your problem.
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
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.