code, pre {font-size:100%;} pre code em 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;} hr .sapTxtSml {font-size:x-small;} </style>
Intro
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:
Wrong!
Correct
Wrong!
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
Bad
Better
Valid comments
There are actually 3 types of comments in the BSP.
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
<code>...</code>
+<%-- BSP comments
<htmlb:button text = "Press Me"
onClick = "myClickHandler" />
--%>+
<code>...</code>
</pre>
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:
<pre>
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> </ul>