Showing results for 
Search instead for 
Did you mean: 

How to place an image on a button! (HTMLB)

Former Member
0 Kudos

I got it:

<htmlb:button id = "myButton14"

text =

"<img src='/sap/public/bsp/sap/public/bc/icons/s_s_okay.gif' border='0'>OK "

onClick = "myButtonClick"

encode = "FALSE" />

The size of the button changes. To prevent this just set the image height to 10.

Accepted Solutions (0)

Answers (1)

Answers (1)

Developer Advocate
Developer Advocate
0 Kudos

You can also do it this way if you want your image to come from the HTMLB library:

  data image type ref to cl_htmlb_image.
  data: image_string type string.
  create object image.
  image->id = `UserSelectionCancel2`.
  image->src = cl_bsp_mimes=>sap_icon( `ICON_CHECKED` ).
  image->tooltip = ``.
  clear image_string.
  image_string = image->IF_BSP_BEE~RENDER_TO_STRING( page_context ).
  <htmlb:button id  = "UserSelectionCancel"
            encode  = "FALSE"
              text  = "<%= image_string %> &nbsp <OTR>Text to go with the Image</OTR>" />

Message was edited by: Thomas Jung