Вы находитесь на странице: 1из 15

Business HTML

Compiled by: Seetharam Maddali

Embedding HTML-Business Expressions in HTML
HTML-Business expressions are embedded in HTML pages using the standard mechanism of the
<server> tag. A typical statement could look like this:
<h1> Order Status </h1>
<p> Customer Number: <server> VBCOM-KUNDE </server>
This causes the screen field VBCOM-KUNDE (VBCOM-CUSTOMER) to be included in the
Web page. HTML-Business expressions must always be enclosed in the <server> tag.
A problem arises if HTML-Business is inserted within an HTML tag. The following is not
possible in HTML:
<a href="<server> screenURL </server>"> Link </a>
HTML does not permit tags within tags, so <p <b>> is incorrect. HTML editors in particular
cannot cope with tags of this kind. For this reason an additional way of marking scripting
statements was introduced with JavaScript: the back tick (`). This character is used in the same
way as the <server> tag and can be used inside tags. The above hyperlink can therefore be written
<a href="`screenURL`"> Link </a>
If the back tick appears in an HTML page as an uninterpreted character, it must be inserted with
the code "&#96". The line
<p> The following is an HTML Business expression: &#96VBCOM-KUNDE&#96 </p>
is left uninterpreted in the Web page and generates the following output on the browser
The following is an HTML Business expression: 'VBCOM-KUNDE'
Using Comments in HTML-Business
You can use HTML comments for commenting on HTML-Business expressions. An HTML
commentary starts with "
<!--" and ends with "-->" (a commentary may not end with ">" alone).
HTML-Business expressions which occur inside an HTML comment appear as uninterpreted
output on the page. Therefore the line
<!-- `VBCOM-KUNDE` -->
is not interpreted.
Furthermore, you can add comments on parts of an HTML-Business expression, also using
HTML comments. The following line contains a valid HTML-Business expression:
`repeat with j from 1 to <!--stepLoop.dim --> 10`
Remember, HTML comments end with "-->". The character ">" alone does not indicate the end
of a comment.
Business HTML
Compiled by: Seetharam Maddali
Linking HTML-Business Statements
Just as in JavaScript or C, several HTML-Business statements can be linked using a semicolon.
The following format is correct:
<p> `for (j=0; j <= array.dim; j++)
j; write("="); array[j]; write (", ")
You could also write:
<p> `for (j=0; j <= array.dim; j++)`
`j` `write("=")` `array[j]` `write (", ")`
There must always be a semicolon or at least a single-character HTML code between successive
HTML-Business statements. In the above example, spaces fulfill this requirement. The following
sequence, however, would lead to an error:
<p> `for (j=0; j <= array.dim; j++)`
`j` `write("=")` `array[j]` `write (", ")`
These statements would be interpreted by SAPJulep as
for (j=0; j <= array.dim; j++)
j write("=") array[j] write (", ")
but this does not work because of the missing semicolons.
It is not necessary to have a semicolon before the key words "end", "else", "elsif" and "elseif" or
after statements which introduce a block. These are "for ()", "if ()", "elsif ()", "elseif ()"
and "repeat ".
Following this rule, the example below is correct:
`if (1)
for (i=j=1; i<=array.dim; i++)
write("array[i]="); <!-- this semicolon is mandatory -->
j=0; write ("This never occurs!")
if (j)` The impossible occurred! `End`
Business HTML
Compiled by: Seetharam Maddali
Variable Substitutions
The principal task of HTML-Business is to include values from R/3 screens in the Web page.
This is achieved by matching the names of the identifiers.
The following identifiers are available. Please note the syntax used in the table.
Nonterminal Derivation
___________ _________________________________________
field { ^ } identifier [ [ expression ] ] [ . attribute ]
attribute label |visSize |maxSize |dim |disabled |name |value
In HTML-Business, identifiers follow the same conventions as used in other programming
languages such as C or JavaScript. They must start with a letter (a...z, A...Z), an underscore (_) or
a tilde (~) and can consist of any number of these characters, including the digits 0-9 and hyphens
The following are valid identifiers:
If you want to use identifiers containing other characters, for example the multiplication sign (*),
you must enclose these identifiers in single quotes. This is also the case if an identifier has the
same name as a key word. For example:
You do not have to enclose identifiers such as VBCOM-KUNDE in single quotes
because of the hyphen. Simply write `VBCOM-KUNDE` instead of `'VBCOM-
However, if the expression "VBCOM minus KUNDE" is to be evaluated, there must be
at least one space after "VBCOM" and before the minus sign: `VBCOM - KUNDE`
To include the contents of the field VBCOM-KUNDE on the R/3 screen in the HTML page,
simply enclose it in <server> tags or in the equivalent back ticks:
<p> Customer number: `vbcom-kunde` </p>
Business HTML
Compiled by: Seetharam Maddali
The possible attributes are:
dim The number of values for a field (= dimension)
maxSize Maximum permitted number of characters the field can hold
visSize Maximum number of characters displayed by the field in the screen
disabled Is the screen field ready for input? (This attribute is not yet supported. In future it
will be possible to use it to determine whether a field is ready for input.)
label Text describing the input field of the same name
name Outputs the complete name and index of the field.
Value Outputs the current value of the field. This attribute provides no added
functionality. It is used for syntax consistency and has the same effect as
specifying the field name without the value attribute.
With the aid of the caret character "^", identifiers can be used as pointers. If, for example,
"field_name" has the value "vbcom-kunde", the following statement results in the field "vbcom-
kunde" being output:
<p> The value of the field 'Field_Name` is '^Field_Name` </p>
The following appears after this in the HTML page, for example:
<p> The value of the field VBCOM-KUNDE is 3100 </p>
Multiple indirections are possible, for example ^^^scarcely_practical[j]
maxSize and visSize
Nonterminal Derivation
_____________ ________________
attribute maxSize
attribute visSize
It is possible to access the maximum input length and the field's maximum visible length on the
screen. This can be done using the attributes maxSize and visSize, and can be activated as
<p>Please enter your customer number
<input type=text name="vbcom-kunde"
Nonterminal Derivation
_____________ ________________
attribute label
If an input field on the screen has a description with the same field name, it is possible to access
this description using the label attribute:
<p> `vbcom-kunde.label`: <input type=text name="vbcom-kunde">
Business HTML
Compiled by: Seetharam Maddali
In this way, in addition to the possibility of resource files (see also language resolution via source
files), it is possible to achieve language independence in HTML pages, for the R/3 logon
language then determines the texts in the HTML page.
Business HTML
Compiled by: Seetharam Maddali
Nonterminal Derivation
attribute dim
Dim is an important attribute. It indicates how many values a field has (dimension of a multi-
value field, array dimension). This is important for step loops on the screen which are represented
in multiple-value fields. For example, if the step loop has a column formed from the field
VBCOM-WGKEY with 20 rows, VBCOM-WGKEY.dim returns the value 20. For fields with
only one value, the value 1 is returned, and if a field is not defined, the value returned is 0.
Multiple-value fields are activated by specifying an additional index. This is added in square
brackets in the usual way and is defined using the values 1 to dim. If you wanted to activate the
second value of the field VBCOM-WGKEY for example, you would need the following
<p> Material group No. 2: `vbcom-kunde[2]` </p>
If a negative index is accessed, a runtime error occurs. Indices which are greater than the value
defined by dim lead to output of an empty string.
Name and Value
Nonterminal Derivation
attribute name
attribute value
The attributes name and value, when used together with HTML input tags, help to construct valid
field names.
The attribute value simply outputs the value of its field and does therefore not provide added
The attribute name outputs the complete name and index of the given field.
For example, to create an input tag for the multi-value field "vmcom-kunde", you could write
`repeat with I from 0 to vbcom-kunde.dim`
<input type=text name="vbcom-kunde[`I`]" value="`vbcom-kunde[I]`">
This results, for example, in the following output:
<input type=text name="vbcom-kunde[1]" value="4711">
<input type=text name="vbcom-kunde[2]" value="8523">
<input type=text name="vbcom-kunde[3]" value="1234">
As the previous example shows, the sequence of backticks and quotes might be confusing.
Instead, you could use the attributes .name and .value to write:
`repeat with I from 0 to vbcom-kunde.dim`
<input type=text name="`vbcom-kunde[I].name`" value="`vbcom-kunde[I].value`">
The output will be the same as in the example above, that is:
<input type=text name="vbcom-kunde[1]" value="4711">
<input type=text name="vbcom-kunde[2]" value="8523">
<input type=text name="vbcom-kunde[3]" value="1234">
Business HTML
Compiled by: Seetharam Maddali
Reserved Key Words
The following tokens are reserved as key words:
archiveURL assert by declare
define else elseif elsif
end for from if
imageURL in include mimeURL
repeat times to wgateURL
with write writeEnc
These key words cannot be used as identifiers. If an identifier with the same name is used, it must
be enclosed in simple ticks ('), e.g. `repeat with i from 'from' to 'to'`
In HTML-Business, expressions can be used in the same way as in C or JavaScript.
You can use the expressions shown in the table below. Please note the syntax used in the table.
Nonterminal Derivation
expression simpleexpr [compop simpleexpr]
simpleexpr term { addopr simpleexpr}
term factor { mulopr factor}
factor (! | ++ | --) factor( expression ) |function call |assignment |lvalue [++ | --]
function call internalfn ( argument {, argument} ) |externalfn ( expression {, expression} )
internalfn write | writeEnc | wgateURL | archiveURL | imageURL | mimeURL | assert
mulopr * / % &&
addopr + - & ||
compop == | != | > | < | >= | <=
Bracketing is supported if the evaluation sequence of the operators is to be broken.
Operators with identical weighting are grouped and are evaluated from left to right. The
following operators are permitted, listed in decreasing weighting:
Operator Semantics
! Not
++ Increment
-- Decrement
= Assignment
* Multiplication
/ Division
% Modulus
&& Logical and
Business HTML
Compiled by: Seetharam Maddali
+ Addition
- Subtraction
& Concatenation
|| Logical or
== Equal to
!= Not equal to
> Greater than
< Smaller than
>= Greater than or equal to
<= Smaller than or equal to
The following are examples of correct expressions:
nCustomers % 10
a > b*2+1
name != "Walt"&" "&"Whitman"
(x -y) * (a+b) & " US$"
cond1 && (cond2 || cond3) && cond4
HTML-Business provides the following useful standard functions for some transactions.
Please note the syntax used in the following tables.
HTML-Business contains a function "write()" which is similar to that in JavaScript. This permits
expressions to appear as output in the HTML page. In this process, the individual arguments are
included in direct succession in the HTML page; no field separators are added.
Nonterminal Derivation
function write ( expression {, expression} )
Two examples:
<p> `write (i, ". ", xlist-matnr)` </p>
<p> `write (j * 2, 123, j > 3)` </p>
Business HTML
Compiled by: Seetharam Maddali
"writeEnc()" behaves like "write()". However, in contrast to "write", the output is included in the
page URL coded (therefore "
Enc": "encoded"). All non-alphanumeric characters are converted into the relevant hexadecimal
coding. This may be necessary if a URL is to be set up which contains fields including special
characters or blanks.
Nonterminal Derivation
function writeEnc ( expression {, expression} )
The difference between write and writeEnc can be illustrated using the following example:
<a href="http://pn0208/scripts/any.dll?matbez=`write (matbez[j])`&quantity=1">
The least favorable expansion of the above code example is:
<a href="http://pn0208/scripts/any.dll?matbez=Grosse Stuehle&quantity=1">
Spaces, for example between "Grosse Stuehle" [large chairs], are not permitted in URLs.
However, if "writeEnc" is used:
<a href="http://pn0208/scripts/any.dll?matbez=`writeEnc(matbez[j])`&quantity=1">
the following is completely correct:
<a href="http://pn0208/scripts/any.dll?matbez=Grosse%20Stuehle&quantity=1">
In order to communicate with the ITS software as safely and simply as possible, the function
"wgateURL()" has been incorporated into HTML-Business. Using this it is possible to send
parameters to the servers without thinking about internal system information or coding a URL
into HTML templates permanently. In this way, templates are easily portable between servers.
Nonterminal Derivation
function wgateURL ( identifier = expression {, identifier = expression} )
The following example shows how this works:
`repeat with j from 1 to xlist-matnr.dim`
<a href="`wgateURL(matnr=xlist-matnr[j], quantity=xlist-
`xlist-matbez[j]` </a> </li>
This HTML template would be expanded as follows:
Business HTML
Compiled by: Seetharam Maddali
<a href="http://pn0208/scripts/wgate.dll/vw01?~State=4711&matnr=9132&quantity=2">
Microsoft Word Update </a> </li>
<a href="http://pn0208/scripts/wgate.dll/vw01?~State=4711&matnr=9133&quantity=1">
Microsoft Excel Update </a> </li>
Always ensure that the value of the attribute href is enclosed in double quotes (").
In addition to including system information such as the field "~State", the function also codes all
parameters in accordance with URL requirements (see also writeEnc ).
The URL used by "wgateURL()" is defined in the global service description "global.srvc" under
the name "~URLwgate" and can be adapted there for the appropriate server.
The parameter "~target" has a special meaning. This is explained in full in the Browser
Independence section.
Using the parameter "~anchor", an HTML anchor can be generated in the Wgate URL:
<form method="POST" action="`wgateURL(~anchor="footer")`">
This is expanded to:
<form method="POST" action="/scripts/wgate.dll/vw01#footer">
The function "archiveURL()" can be used in the same way as "wgateURL()" to access the iXOS
archive system.
archiveURL ( command, archiveID=expression, docID=expression)
The individual parameters should be taken from the product description of the accompanying
In order to implement this function, the relevant Archive-Web-Dll must first be installed correctly
on the Web server.
The URL used by "archiveURL()" is specified in the global service description "global.srvc"
under the name "~URLarchive".
As of Version 1.1 of the ITS and Version 3.1H of R/3, the imageURL function is
obsolete. New HTML templates should use the mimeURL function instead. However, the
imageURL function is still supported to ensure compatibility with existing HTML
Using the function "imageURL()" it is possible to access images which are stored directly in the
HTTP server's file system according to their language. This allows the management of multi-
lingual images.
Business HTML
Compiled by: Seetharam Maddali
imageURL ( ~type=expression [, ~theme=expression] [, ~language=expression] , ~
name=expression )
This function permits the images from Web sites to be activated according to language and
The URL generated depends on the following dimensions:
~URLimage (defined in global.srvc)
The image type (~type)
The current logon language (~language)
The current theme (~theme)
The name of the image (~name)
From these dimensions the basic directory structure results in:
The dimensions ~language and ~theme are initially obtained from the service description file, but
can be overwritten if explicit entries are made when imageURL() is called up.
Values which are not defined or which are empty are removed from the directory structure.
Some examples (where ~language is "E" and ~theme is not defined):
<img src="`imageURL(~type="backgrounds", ~name="marmor.gif")`">
<img src="/sap/its/graphics/backgrounds/E/marmor.gif">
<img src="`imageURL(~language="", ~name="marmor.gif")`">
<img src="/sap/its/graphics/marmor.gif">
<img src="`imageURL(~theme="ides", ~name="marmor.gif")`">
<img src="/sap/its/graphics/E/ides/marmor.gif">
<img src="`imageURL(~type="backgrounds", ~theme="ides",
~language="D", ~name="marmor.gif")`">
<img src="/sap/its/graphics/backgrounds/D/ides/marmor.gif">
The function mimeURL() replaces the function imageURL() and should be used instead. It
provides more flexible and easier access to service, language and theme dependent files like
images, sounds and other multimedia data (hence the name mimeURL).
mimeURL ( [ [~service]=expression, ] [ [~theme]=expression,] [ [~language]=expression,]
[~name]=expression )
Business HTML
Compiled by: Seetharam Maddali
Parameter names can be omitted resulting in shorter but less comprehensible function calls. All
parameters except ~name are optional and will be derived from the current session context if not
already defined as an argument. If parameter names are omitted the default order is: ~service,
~theme, ~language, ~name
Similar to the imageURL() function, mimeURL() constructs a URL path into the web server's
document directory. The general structure of this path is:
Depending on the presence of certain function arguments parts of this path are omitted.
The parameters have the following meaning:
~service Specifies the name of the service; if omitted the name of the current service will
be used. Special service names are "global" - which should be used for all files that
are used by several servers - and "system" - which is used for the ITS system

~theme Specifies the theme to use; if omitted the current theme (defined in the service's
.srvc-file) is used. You can specify ~theme="" which will omit the whole theme-
part of the path constructed
~language .Specifies the language to use; if omitted the current language (defined in the
service's .srvc-file or using the login page) is used.You can omit the language-part
in the path constructed by specifying ~language="".
~name Defines the name (and optional subdirectories) of the file to be referenced.
Examples are "ok.gif" or "buttons/roundones/cancel.gif".
The following examples illustrate the use of mimeURL():
If ~URLmime is set to /sap/its/mimes, the current service is vw01, the current language is E and
the current theme is 99, calling mimeURL() will result in the following output:
<img src="`mimeURL(~name="ok.gif")`">
gives <img src="/sap/its/mimes/vw01/99/E/ok.gif">
<img src="`mimeURL(~service="global", ~name="ok.gif")`">
gives <img src="/sap/its/mimes/global/99/E/ok.gif">
<img src="`mimeURL("", ~name="buttons/ok.gif")`">
gives <img src="/sap/its/mimes/99/E/buttons/ok.gif">
<img src="`mimeURL("","buttons/roundones/ok.gif")`">
gives <img src="/sap/its/mimes/99/E/buttons/roundones/ok.gif">
<img src="`mimeURL("", 1, "buttons/roundones/ok.gif")`">
gives <img src="/sap/its/mimes/1/E/buttons/roundones/ok.gif">
Business HTML
Compiled by: Seetharam Maddali
<img src="`mimeURL("global", 1, "D", "buttons/roundones/ok.gif")`">
gives <img src="/sap/its/mimes/global/1/D/buttons/roundones/ok.gif">
<img src="`mimeURL(~service="system", ~name="ok.gif", 1, "")`">
gives <img src="/sap/its/mimes/system/1/ok.gif">
Using the function "assert()", error messages from the R/3 System can be reproduced collectively
in Web pages.
assert ( identifier )
If an error occurs in the R/3 System while user entries are being checked (for example, non-
acceptance of an entry), the present cursor position (focus) on the screen is used to determine
which field caused the error. The error message itself appears in the system field
When generating the HTML page, a check is made for each assert() statement, to see if the field
name given for assert matches the field in the screen on which the cursor is placed due to the
assert() then issues an appropriate error message. The default is: "@@ Error @@".
The output from assert() can be changed through definition of the system field "~ErrorMarker" in
the global service description "global.srvc". Any HTML code can be defined.
For example:
<form >

Material no <input type="text" name="matnr">`assert(matnr)`
Quantity <input type="text"

Conditional Substitutions
As the HTML-Business page exists only as a template and is not generated in a fully dynamic
form at runtime, a conditional substitution must be possible in order to react to the current
application status with different page construction.
For this purpose, the if-statement exists as an HTML-Business expression. It follows the syntax
and semantics of other common programming languages (C, JavaScript).
if ( expression ) htmlbusiness { [elsif | elseif] ( expression ) htmlbusiness }[else htmlbusiness
Nesting of any kind is possible for HTML-Business statements, i.e. HTML-Business can in turn
contain conditional or repeated statements.
Business HTML
Compiled by: Seetharam Maddali
The key words "elsif" and "elseif" can be used as alternatives.
The term 'expression' refers to any expression which evaluates to 0 (condition not met, FALSE)
or not equal to 0 (condition met, TRUE).
The following are examples of this kind of expression:
j % 3 == 0
j / (4 - 1) != a * (b + (c + 2))
s == "Walter" & " " & "Weissmann"
(x > 2 && x <99) || (s > "abc")
The following are examples of if-statements:
`if (VBCOM-KUNDE) VBCOM-KUNDE else` Undefined Customer Number `end`
`if (j % 3 == 0)` <TR> `else` <TD> `end`
`if (1) write("This is always true!")
elsif (0) write("This is never true!")
else write("The impossible occurred!") end`
`if (x > 0 && x < 100)`
x is greater than 0 and smaller than 100
`if (y > 0 && y < 100)`
y is greater than 0 and smaller than 100
`elsif (Y > 100)`
y is greater than 100
elsif (x <= 0)`
x is smaller than 0!
x is greater than 99!
Summary of HTML-Business Grammar
The following grammar and syntax are implemented with HTML-Business expressions.
Nonterminal Derivation
htmlbusiness ([ html | script[;] ] htmlbusiness)| eof
html bytestream
script (declaration |expression |conditional |loop)
declaration declare externalfn { , externalfn } in module
externalfn identifier
module constant
Business HTML
Compiled by: Seetharam Maddali
function funcname ( argument {, argument} )
argument [identifier =] expression
expression simpleexpr [compop simpleexpr]
simpleexpr term { addopr simpleexpr}
term factor { mulopr factor}
factor (! | ++ | --) factor( expression ) |assignment |lvalue [++ | --] |constant
function call internalfn ( argument {, argument} ) |externalfn ( expression {, expression} )
internalfn write | writeEnc | wgateURL | archiveURL | imageURL | mimeURL | assert
mulopr * / % &&
addopr + - & ||
compop == | != | > | < | >= | <=
lvalue field | register
field { ^ } identifier [ [ expression ] ] [ . attribute ]
attribute label |visSize |maxSize |dim |disabled |name |value
assignment lvalue = expression
conditional if ( expression ) htmlbusiness{ (elsif | elseif) ( expression ) htmlbusiness }[else
htmlbusiness ]
loop repeat expression times htmlbusiness end |repeat with register in field
htmlbusiness end |repeat with register from expression to expression by expression
htmlbusiness end |for ( expression ; expression ; expression ) htmlbusiness end
register identifier
identifier { ~ | _ | - } char { char | digit | _ | ~ | - } |
constant digit {digit} |" bytestream "#identifier
char a..z | A..Z