Skip to Content
author's profile photo
Former Member

BSP Extensions: method implementation

Hello together,

I am currently trying to implement custom BSP Extensions (taglibs). Almost everything works, I can use my element, it is also shown in the Tag browser in SE80, but I really have no idea on how to implement the rendering.

The documentation exactly leaves out the part on how to actually draw the custom HTML, I can only find info on how to manipulate the element's given content within the BSP. So far, I have overriden (redefined?) the methods DO_AT_BEGINNING and DO_AT_END and somewhere I found that M_OUT attrib. When calling m_out->print_string( 'Hello' ), nothing happens 😕

Has anyone some example coding on how to do the actual drawing of the component? I have taken a look on the standard BSP extensions in HTMLB (like button and so), but could nowhere find the actual rendering stuff.

Please help me 😊

Thanks in advance for any hints or samples.

Greetings, Timo

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Aug 06, 2004 at 09:37 AM

    This is a good topic, comes back often I think 😉

    Here are some links you should check out...

    BSP Element - Dynamic tableView with Internal Table

    <a href="/people/brian.mckellar/blog/2004/07/28/bsp-programming-writing-composite-elements">BSP Programming: Writing Composite Elements</a>

    And of course the basics...

    <a href="/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">BSP Trouble Shooting: Getting Help</a>

    <a href="/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator">BSP Programming: HTMLB TableView Iterator</a>

    Here is a code sample of doing something in the <b>IF_BSP_ELEMENT~DO_AT_BEGINNING</b>

    DATA: txt TYPE REF TO CL_HTMLB_TEXTVIEW.
    
    txt ?= cl_htmlb_textView=>factory( text = tmp ).
    
    while m_page_context->element_process( element = txt ) =
    co_element_continue.
    endwhile.
    
    

    The Weblogs were a great help to me when I got started. I've since created about 20 or so BSP Extension/Elements.

    Add comment
    10|10000 characters needed characters exceeded

    • Let me answer for you the final part of the puzzle.

      You write:

      <i><% extension ...%>, the elements got printed, otherwise</i>

      When we have a BSP page, we can have actually XML on the page. So the pre-processor sees something such as this:

         <myLib:myTag a1 = "v1">
         </myLib:myTag>

      It is going to say, aha, here we have some nice XML code coming down the pipe. Good for you. This XML is now placed as a string (what more is XML than a string?) and send to the browser. So if you do a view source in the browser, you should see your XML.

      In summary, we aim to please, and XML is high on our list things we like.

      So what is a man to do? You must write onto the page:

      <%@extension name="myFirstLib" prefix="myLib"%>

      This line the pre-compiler eats. And then after a moment of silence, it accepts that you don't like XML. Anything that now just looks like "<myLib:*>" is immediately understood to be a tag. Thus the compiler is informed, and it will generate the correct ABAP code to call this tag.

      And this pre-compiler believes in perfection: mylib is NOT equal to myLib. It is case sensitive!

      In summary: one slip of the finger, and you tag gets seen as XML and rendered out as raw string.

      (With a syntax check step, and not a compile step, you will also get a warning about this. Just to be a little helpful.)