Hi Vishnu,
There are multiple ways to create buttons on toolbar or on view. First identify the component by using F2 on the component. Now open the component in Txn BSP_WD_CMPWB. One of the mothods to created the button is putting the logic in method DO_PREPARE_OUTPUT.
Write the below logic:
DATA: ls_button type crmt_thtmlb_button.
If gt_button is not initial.
ls_button-type = cl_thtml_util=>gc_icon_edit.
ls_button-enabled = abap_true.
ls_button-on_click = 'EDIT'.
append ls_button to gt_button.
endif.
Then Go to HTM page.
<thtmlb:toolbar id = "HeaderToolbar"
buttons = "<%= controller->gt_button %>"
maxButtonNumber = "15"
foreignUse = "TRUE" />
Then in order to trigger any event on it right click on event handler and create a new event.
Now the name of this event should be 'EDIT' determined in logic in DO_PREPARE_OUTPUT.
Now go to the event in event handler and write logic to process whatever your requirement is.
Thanks,
Ravi