cancel
Showing results for 
Search instead for 
Did you mean: 

How to add new button to web ui view?

Former Member
0 Kudos

Hello!

I'm working with CRM7.0 and now i have the requirement to run report from quotation view in web UI. For this purpose i need to create new button which will call my report. I've found that button can be created via BSP Component Workbench.

Who can guide me with creating?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you can create a button in do_prepare_output of the view

DATA: ls_button  TYPE crmt_thtmlb_button.

 IF gt_button IS INITIAL.

    ls_button-text     = 'TEST BUTTON'.
    ls_button-on_click = 'NEW'.
    ls_button-enabled = abap_true.
*    ls_button-tooltip = 'TEST BUTTON'
    APPEND ls_button TO gt_button.
    CLEAR ls_button.

  ENDIF.

I hope it will help you.

Regards,

Kamesh Bathla

Answers (6)

Answers (6)

Former Member
0 Kudos

If someone has problems with display button, try add

  actions               = "<%= controller->gt_button %>"

into your *.htm page in chtmlb tag. gt_button must be public.

Regards

Former Member
0 Kudos

For some reasons i can't post it the way i want to because of an error... here a bad looking part, but it works anyway 😛

Another way could be a seperate button somewhere on your view. For this you have to do some coding in the .htm too:

a thtmlb button with id, type, onClick and text

onclick is filled with the event and text contains the text on the button.

For the type, check the cl_thtmlb_util class for the available attributes for buttons (new, cancel, save, etc.) to change the appearance to your needs.

This coding can be placed anywhere in the .htm where you want to have your button. ontop of some fields, below or where ever you like.

There is also a way to add a button to the overviewpage-toolbar, but i don't think you will need it here.

I hope this guides you through your issue.

Regards

Dennis

Former Member
0 Kudos

Hi Olga,

as promised i give a short hint for 2 variants that I commonly use:

If you want to add a button to the toolbar of your view, you do the coding mentioned by Kamesh.

To display the button afterwards you have to insert some coding into the .htm of the view.

In general it's something like:

<hthmlb:areaFrameSetter  toolbarButtons = "<%= controller->gt_button %>" 
                         maxButtonNumber = "<number of buttons in the toolbar> " /> 

The entry after toolbarButtons is where you defined your gt_button.. in the example it would be defined in the component_controller.

If you defined it on your view, you can simply write

"<%= gt_button %>"

Former Member
0 Kudos

Thank you Dennis for your reply! Provide please your examples.

Former Member
0 Kudos

Hi Olga,

yes, you have to redifine this method.

The coding posted by kamesh will customize the appearance of your button ( text 'TEST BUTTON', Tooltip, type, etc. ) wich can be changed due to your needs.

You also have to define an event-hanlder wich name you have to enter in the ls_button-on_click.

As the name tolds you, this event-handler will then be called after clicking the button.

just to mention, you have to define the gt_button with type CRMT_THTMLB_BUTON_T on your view in the implementation class too (if it doesn't already exists).

Depending on where you want to place your button (toolbar, header of a table, somewhere on the view) you have different ways to implement them. If you have problems on this, i can give you some examples.

Regards

Dennis

Former Member
0 Kudos

Hello Friend,

In ur reply u Have mentioned

gt_button with type CRMT_THTMLB_BUTON_T

but type CRMT_THTMLB_BUTON_T is not there.

an error message is displayed that CRMT_THTMLB_BUTON_T is not available.

please tell where frm i will get it.

regards

Alsalfi

Former Member
0 Kudos

Hi,

Type of GT_BUTTONS is CRMT_THTMLB_BUTTON_T.

Regards,

Lakshmi.Y

Former Member
0 Kudos

Hi,

Please use CRMT_THTMLB_BUTTON_EXT_T instead. If still issue is not resolved then let us know which view you are trying to add a button.

Thanks,

Bhushan

0 Kudos

Hi,

Does anyone have a sample for Buttons to be placed in a view? Buttons need to be vertical one after another.

andreas_graeven
Explorer
0 Kudos

Hi Dennis, your post is a long time ago, but i need a solution to add buttons somewhere into a view. I try it with the setter getter methodes. But it´s not working with the gt_buttons. Please provide your examples. Thank you !

Former Member
0 Kudos

Do you mean that i need to redefine method DO_PREPARE_OUTPUT and to put there this code?

As i understand to begin with i need to draw my button(i don't know where) or not?

Thanks!