Skip to Content
0
Former Member
Mar 12, 2009 at 05:43 AM

new button in alv tree

364 Views

Hello expert:

i added a new button in alv toolbar, but when i click the button , a system message always popup before executing subroutine. the message is ' select exactly one node'

who tell me why

your answer is appreciated

code is following

-


  • add Standard Button to toolbar (for Delete Subtree)

CALL METHOD mr_toolbar->add_button

EXPORTING

fcode = 'Delete'

icon = ICON_EXECUTE_OBJECT

butn_type = cntb_btype_button

text = ' Close PR'

quickinfo = 'Close PR'.

MODULE pai INPUT.

CASE ok_code.

WHEN 'EXIT' OR 'BACK' OR 'CANC'.

PERFORM exit_program.

WHEN OTHERS.

CALL METHOD cl_gui_cfw=>dispatch.

ENDCASE.

CLEAR ok_code.

CALL METHOD cl_gui_cfw=>flush.

ENDMODULE. " PAI INPUT

CLASS lcl_event_receiver IMPLEMENTATION.

  • delete, deselect all, select all function

METHOD function_selected.

CASE fcode.

WHEN 'DELETE'.

PERFORM close_pr.

WHEN 'UNSELALL'.

PERFORM unselect_all.

WHEN 'SELALL'.

PERFORM select_all.

ENDCASE.

ENDMETHOD.

  • doubleclick

METHOD function_doubleclick.

PERFORM link_me23n USING node_key fieldname.

ENDMETHOD.

ENDCLASS.

  • Register the event for toolbar

CREATE OBJECT go_receiver.

SET HANDLER go_receiver->function_selected FOR mr_toolbar.

SET HANDLER go_receiver->function_doubleclick FOR tree1.

Best Regards,

Kevin

i debuged the problem , when CALL METHOD cl_gui_cfw=>dispatch. execute , why program go into cl_gui_toolbar. why?

please do me a favor