Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Functionality of button as insert

Former Member
0 Kudos

Hello all,

Can any one tell i have hide all the buttons on a standard alv in ALV webdynpro.

Now i have added my own button by name INSERT

how can i get the functionality of standard button insert row in ALV to this button INSERT.

Can we change the tesxt of the standard button?

How can we add image to the standard button.

thanx,

Badri

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

Hi,

When you are adding your button on application toolbar, assing function code of standard INSERT function to it.


"class definition
methods: handle_toolbar_ins FOR EVENT toolbar OF cl_gui_alv_grid
                     IMPORTING e_object e_interactive,

"class implementation
method handle_toolbar_ins.

    DATA: ls_toolbar TYPE stb_button.
" append an icon to show booking table
    CLEAR ls_toolbar.
    MOVE cl_gui_alv_grid=>MC_FC_LOC_INSERT_ROW to ls_toolbar-function. "<- this will provide standard function code to your custom button
    MOVE icon_change_password TO ls_toolbar-icon.
    MOVE text-tl3 TO ls_toolbar-quickinfo.
    MOVE text-tl4 TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
endmethod.

Can we change the tesxt of the standard button?

How can we add image to the standard button.

I don't think we can.

Regards

Marcin

3 REPLIES 3

MarcinPciak
Active Contributor
0 Kudos

Hi,

When you are adding your button on application toolbar, assing function code of standard INSERT function to it.


"class definition
methods: handle_toolbar_ins FOR EVENT toolbar OF cl_gui_alv_grid
                     IMPORTING e_object e_interactive,

"class implementation
method handle_toolbar_ins.

    DATA: ls_toolbar TYPE stb_button.
" append an icon to show booking table
    CLEAR ls_toolbar.
    MOVE cl_gui_alv_grid=>MC_FC_LOC_INSERT_ROW to ls_toolbar-function. "<- this will provide standard function code to your custom button
    MOVE icon_change_password TO ls_toolbar-icon.
    MOVE text-tl3 TO ls_toolbar-quickinfo.
    MOVE text-tl4 TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
endmethod.

Can we change the tesxt of the standard button?

How can we add image to the standard button.

I don't think we can.

Regards

Marcin

Former Member
0 Kudos

Hi,

U need to add another element to the already existing element set to the node which is bound to the table UI Element.

Try this.

Put the code below inside the INSERT action method.

*{table is the node which is bound to the table UI element }

data lo_nd_table type ref to if_wd_context_node.

data lo_el_table type ref to if_wd_context_element.

data lt_el_table type wdr_context_element_set.

data ls_table type wd_this->element_table.

data lt_table type wd_this->elements_table.

lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

lt_el_table = lo_nd_table->get_elements( ).

loop at lt_el_table into lo_el_table.

lo_el_table->get_static_attributes(

importing

static_attributes = ls_table ).

append ls_table to lt_table.

endloop.

lo_nd_table->bind_table( lt_table ).

I hope this helps.

Thanks,

Abhishek

Former Member
0 Kudos

thanx u r answe is appreciated