Skip to Content

1001 mistake in BSP programing: #2 Almost valid XML

code, pre {font-size:100%;}

pre h4, pre h5
font-size: 100%;
font-family: sans-serif, arial;
border-bottom: 1px solid black;
padding: 3px;
margin: 0px;
pre h4 {background-color: #fcc;}
pre h5 {background-color: #cfc;}

.sapTxtSml {font-size:x-small;}


The BSP extensions[1] mechanism is based on the XML syntax. Actually it is not “The XML” as described on W3C, but some basic rules must be conformed.

Valid nesting

The very basic rule, which everybody knows, says: “For all other elements, if the start-tag is in the content of another element, the end-tag is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other.”

The compiler checks this when activating the BSP page, but there is the possibility to insert ABAP code which can ruin all the XML consistance in the run-time.

The most obvious example:




is skipped – the application opens one object and tries to close another one.

Valid attributes

There are almost no restrictions for the element attributes except you cannot use the XML comments[2] within. However I have some style recomendations:

    • Within attributes use as less code as possible



Valid comments

There are actually 3 types of comments in the BSP.

    1. BSP comments:

<%– Comment goes here –%>

    1. XML[2] comments:

<!– Comment goes here –!>

    1. ABAP[3] comments:

Comment to the end of string

All of them have different meaning. However the visual result of the commenting is the same. This may lead to incorrect use of the commenting.

Compare the following examples:

The HTMLB element will be rendered!

      <!– XML comments
      <htmlb:button       text = “Press Me”
                          onClick = “myClickHandler” />

The HTMLB element will not be rendered

      +<%– BSP comments
      <htmlb:button       text = “Press Me”
                          onClick = “myClickHandler” />
In both cases above we won’t see the button on the page, but in first case all the button rendering funñtions will be executed and all output will be placed within HTML<sup>[<a href=#a2>2</a>]</sup> comments.<br><br>
From my practice I have seen following commenting style:

Why not? If it works…

</code> works only if it stays at the first line position, so I’d recomment do use <code>”</code> instead of <code></code> to avoid possible class generation errors.</li>

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