Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: Toolbar buttons on form view

$
0
0

Hi Girish,

 

To add Buttons to a View, You nee to Code in DO_PREPARE OUTPUT. To achieve this,

 

Add an Interface to Implementation Class of View IF_CRM_BUPA_UIU_OTYPE.

 

Create an Attribute in the Implementation Class of View

GT_BUTTON      Instance Attribute           Public    Type      CRMT_THTMLB_BUTTON_T       

Once this is done go to DO_PREPARE_OUTPUT of the view and add following code

  DATA: ls_button  TYPE crmt_thtmlb_button.

CALL METHOD super->do_prepare_output
EXPORTING
iv_first_time
= iv_first_time.

IF gt_button IS INITIAL.
*   here the name of the button and the event is determine
ls_button
-type     = cl_thtmlb_util=>gc_icon_new.
ls_button
-text     = 'CREATE COLLEGE'. "#EC NOTEXT
ls_button
-on_click = 'CREATE COLLEGE'.                      "#EC NOTEXT
ls_button
-enabled  = abap_true.
APPEND ls_button TO gt_button.
ENDIF.

 

After this go to the .htm page of view a nd do the following changes that are in bold

For View

<thtmlb:toolbar id = "HeaderToolbar"
buttons     =
"<%= controller->gt_button %>"
maxButtonNumber =
"15"
foreignUse       =
"TRUE" />

 

 

 

We do these coding in DO_PREPARE_OUTPUT so that it will be easy to add/remove button on any condition  or Disable/Enable buttons.

 

Regards,

Pratheek


Viewing all articles
Browse latest Browse all 7775

Trending Articles