Skip to Content
avatar image
Former Member

How to add new button to web ui view?

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 12, 2010 at 02:18 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 12, 2010 at 03:41 PM

    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!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2010 at 07:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2010 at 12:10 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2010 at 01:11 PM

    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 %>"

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 13, 2010 at 01:22 PM

    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 :P

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2012 at 05:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded