Skip to Content

Writing a Test Example

<!code>  <%@extension name=”htmlb” prefix=”htmlb”%>

<!code>  <%@extension name=”phtmlb” prefix=”phtmlb”%>

<!code>   

<!code>  <htmlb:content design=”design2003″>

<!code>   <htmlb:page>

<!code>    <htmlb:form>

<!code>   

<!code>       …body comes here…

<!code>   

<!code>      <phtmlb:horizontalDivider hasRule          = “TRUE”

<!code>                                separationHeight = “LARGE” />

<!code>   

<!code>      <phtmlb:matrix width = “100%” >

<!code>   

<!code>        <phtmlb:matrixCell hAlign = “RIGHT” />

<!code>   

<!code>          <htmlb:button       text          = “Page In-1”

<!code>                              design        = “PREVIOUS”

<!code>                              onClick       = “pageIn-1.htm” />

<!code>   

<!code>          <htmlb:button       text          = “Page In+1”

<!code>                              design        = “NEXT”

<!code>                              onClick       = “pageIn+1.htm” />

<!code>   

<!code>      </phtmlb:matrix>

<!code>   

<!code>    </htmlb:form>

<!code>   </htmlb:page>

<!code

Designing a New Composite Element

The goal is to replace this entire navigation rendering with one simple element. The expected code on each BSP page would be:

<!code>  <%@extension name=”htmlb”   prefix=”htmlb”%>

<!code>  <%@extension name=”bcm_sdn” prefix=”sdn”%>

<!code>   

<!code>  <htmlb:content design=”design2003″>

<!code>   <htmlb:page>

<!code>    <htmlb:form>

<!code>   

<!code>       …body comes here…

<!code>   

<!code

<!code>    </htmlb:form>

<!code>   </htmlb:page>

<!code>  </htmlb:content>

<!code>   

We want one element that takes a previous and/or next attribute with the text to display. As we are (slightly) lazy, we assume that pages are named

exactly the same as the descriptive text, just without spaces, and terminated with our typical ‘.bsp’ extension. (Note that most people use .htm as

the page extension. The use of .bsp is a trait mostly used in our small group.)

The definition in the workbench (transaction SE80) of the new BSP element is quickly done. It has only two string attributes. Once this BSP element

has been defined and activated, the above example BSP page will actually compile and run. It will just not yet render any output.

!https://weblogs.sdn.sap.com/weblogs/images/164/BP_WCE_002.GIF|height=0 width=488 height=268 |width=0 width=488 height=268 |src=https://weblogs.sdn.sap.com/weblogs/images/164/BP_WCE_002.GIF|border=0 width=488 height=268 !</body>

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Christopher McNeil
    I believe that you can simply call the IF_BSP_BEE~RENDER method in situations where there is no need to include any body content within the tag.  This method processes the element as you described, but does not afford the opportunity to add anything inside the loop.
    (0) 
    1. Brian McKellar Post author
      Correct. The IF_BSP_BEE interface is implemented in the base class CL_BSP_ELEMENT that is below all tags, and is effectively the loop packaged to use one tag as a bee for custom rendering. But still, the interesting part is not understand not the case on N=1, but the more complex one, as with that you can really do some interesting things! And this is what makes it worthwhile to actually look at the reasons and thoughts that went into the construction on that one very unusual loop construct.
      (0) 

Leave a Reply