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

Web Transaction Programming

HELP.BCFESITSTRANPRO
G

Release 4.6B


Web Transaction Programming SAP AG

Copyright
©
Copyright 2000 SAP AG. All rights reserved.

No part of this brochure may be reproduced or transmitted in any form or for any purpose without
the express permission of SAP AG. The information contained herein may be changed without
prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software
components of other software vendors.
® ® ® ® ® ®
Microsoft , WINDOWS , NT , EXCEL , Word and SQL Server are registered trademarks of
Microsoft Corporation.
® ® ® ® ® ® ® ® ®
IBM , DB2 , OS/2 , DB2/6000 , Parallel Sysplex , MVS/ESA , RS/6000 , AIX , S/390 ,
® ® ®
AS/400 , OS/390 , and OS/400 are registered trademarks of IBM Corporation.
®
ORACLE is a registered trademark of ORACLE Corporation, California, USA.

® ® TM
INFORMIX -OnLine for SAP and Informix Dynamic Server are registered trademarks of
Informix Software Incorporated.
® ® ® ®
UNIX , X/Open , OSF/1 , and Motif are registered trademarks of The Open Group.
®
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C , World Wide
Web Consortium, Laboratory for Computer Science NE43-358, Massachusetts Institute of
Technology, 545 Technology Square, Cambridge, MA 02139.
®
JAVA is a registered trademark of Sun Microsystems, Inc. , 901 San Antonio Road, Palo Alto,
CA 94303 USA.
®
JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for
technology invented and implemented by Netscape.

SAP, SAP Logo, mySAP.com, mySAP.com Marketplace, mySAP.com Workplace, mySAP.com


Business Scenarios, mySAP.com Application Hosting, WebFlow, R/2, R/3, RIVA, ABAP, SAP
Business Workflow, SAP EarlyWatch, SAP ArchiveLink, BAPI, SAPPHIRE, Management
Cockpit, SEM, are trademarks or registered trademarks of SAP AG in Germany and in several
other countries all over the world. All other products mentioned are trademarks or registered
trademarks of their respective companies.

2 December 1999
SAP AG Web Transaction Programming

Icons

Icon Meaning
Caution

Example

Note

Recommendation

Syntax

Tip

December 1999 3
Web Transaction Programming SAP AG

Contents

Web Transaction Programming.........................................................................5


Web Transaction Programming ................................................................................................... 6
Programming the R/3 Transaction............................................................................................. 8
Quick Guide to ABAP Elements in HTML .................................................................................. 9
Implementing Menus ................................................................................................................ 11
Implementing Text Areas.......................................................................................................... 12
Implementing Checkboxes ....................................................................................................... 13
Implementing Radio Buttons .................................................................................................... 14
Implementing Step Loops......................................................................................................... 16
Implementing Table Controls ................................................................................................... 17
Implementing Dialog Boxes...................................................................................................... 25
Implementing Input Help........................................................................................................... 26
Creating the ITS Service ........................................................................................................... 29
ITS Service Description ............................................................................................................ 30
Themes..................................................................................................................................... 31
HTML Templates ...................................................................................................................... 32
Language Resource Files......................................................................................................... 34
Adapting the HTML Code.......................................................................................................... 35
Quick Guide to the HTML Generator........................................................................................ 38
Multiple Language Support ...................................................................................................... 41
Setting the Logon Language .................................................................................................... 42
Using Language-Independent Templates ................................................................................ 44
Using Language-Specific Templates........................................................................................ 45
Setting Placeholders in Language Resource Files .................................................................. 46
Web Transaction Programming Tools..................................................................................... 47
ITS Debugger ........................................................................................................................... 48
Setting Up the ITS Debugger .............................................................................................. 50
Starting an ITS Debugger Session...................................................................................... 51
Leaving an ITS Debugger Session ..................................................................................... 53
Troubleshooting................................................................................................................... 54
ITS Naming Conventions .......................................................................................................... 55

4 December 1999
SAP AG Web Transaction Programming
Web Transaction Programming

Web Transaction Programming

December 1999 5
Web Transaction Programming SAP AG
Web Transaction Programming

Web Transaction Programming


Web transactions are Internet-enabled R/3 dialog transactions that Internet and intranet users
can call from a Web browser as Internet Application Components (IACs).
The Web transactions programming model allows ABAP developers to use ABAP dialog
programs as a basis for developing IACs.
The link between the Web server and R/3 is provided by the Internet Transaction Server (ITS),
which acts as a generic CGI program. There are also other support interfaces such as the
Internet Server API (ISAPI) and the Netscape API (NSAPI).

Interaction Between the ITS and R/3


If you set up Web pages containing URLs, which link to the R/3 System, and a Web user makes
a request by selecting one of these links, the request is processed as follows.
1. Internet user starts a transaction in the Web browser.
2. Request passes to Web server.
3. The HTTP server forwards the request to the ITS.
4. The ITS establishes a connection with the R/3 System by DIAG, prepares the request, and
starts the relevant transaction. When communicating with R/3, the ITS functions as a normal
SAP GUI and thus uses the DIAG protocol as the transmission channel for data exchange.
5. R/3 sends screen output to the ITS, which converts the data to HTML format, and returns it
via the Web server to the Web browser, where it is displayed as an HTML page.

Web Transaction Implementation


To implement a Web transaction, you must:
• Create a transaction in R/3
• Enable the R/3 transaction for Internet use
To do this, you must create the necessary external components required by the ITS. These
components make up an ITS service and consist of:
- An ITS service description
- A set of HTML templates (one for each R/3 screen)
- Language resource files (optional)
- Graphics and other files (optional)
To create these components, you use the SAP@Web Studio [Ext.],
To generate HTML templates for the Web transaction screens, the ITS inserts additional
Business
HTML statements.
Business
HTML is an SAP-specific macro language for handling data transfer between R/3
screens and HTML pages. At runtime, the ITS executes these extra statements to create the
finished HTML pages to run the Web transaction.
Web transactions must satisfy special requirements regarding:
• Screen design

6 December 1999
SAP AG Web Transaction Programming
Web Transaction Programming

Since HTML (on the Internet side) and ABAP (on the R/3 side) offer different programming
features, some objects used in ABAP programs or on R/3 screens are not supported by
HTML, so you have to adapt the HTML code accordingly.
• User authorizations
• Use of BAPIs (Business Application Programming Interfaces) when applying precisely
defined methods to business objects.
Apart from exchanging data between the Internet and the R/3 System, and converting HTML
to R/3 screen data and vice versa, the ITS also performs system administration functions
such as user management, system resource management, and Web transaction
management.
For further information on Web transaction programming, see:
Programming the R/3 Transaction [Page 8]
Creating the ITS Service [Page 29]
Adapting the HTML Code [Page 35]
Multiple Language Support [Page 41]
Web Transaction Programming Tools [Page 47]
Web Transaction API [Ext.]
ITS Synchronization [Ext.]
ITS Naming Conventions [Page 55]
This documentation describes the Web transaction programming model. For information
about other programming models for implementing IACs, see:
WebRFC Programming [Ext.]
Web Reporting [Ext.]

December 1999 7
Web Transaction Programming SAP AG
Programming the R/3 Transaction

Programming the R/3 Transaction


From an ABAP coding point of view, Web transactions started from a Web browser are no
different from transactions started in the R/3 System.
However, since the graphical user interface available in HTML is more restricted than the
SAPgui, some of the graphical elements present on R/3 screens are not supported by HTML,
and must be removed from IAC screens, or handled differently. This means that you have to
modify HTML templates accordingly.
For a brief comparison of features in ABAP and HTML, see:
Quick Guide to ABAP Elements in HTML [Page 9]
For implementation of specific features, see:
Implementing Menus [Page 11]
Implementing Text Areas [Page 12]
Implementing Checkboxes [Page 13]
Implementing Radio Buttons [Page 14]
Implementing Step Loops [Page 16]
Implementing Table Controls [Page 17]
Implementing Dialog Boxes [Page 25]
Implementing Input Help [Page 26]

8 December 1999
SAP AG Web Transaction Programming
Quick Guide to ABAP Elements in HTML

Quick Guide to ABAP Elements in HTML


The following table summarizes graphical elements available in SAPgui and indicates their usage
in HTML:

ABAP vs. HTML

R/3 Source ABAP HTML Usage


Element
GUI status Function keys Can be used, but not supported. Can use F21, F23 for
scrolling. Otherwise, define
as pushbuttons.
Menus Can be used, but not supported Web browsers contain only
browser-specific functions.
You cannot merge menu
options from an R/3
transaction. Use
pushbuttons instead.
R/3 screen I/O fields OK. Converted, no problem
Text fields OK. Converted, no problem.
Text areas Can be used. Require manual changes to
HTML template.
Checkboxes Can be used. Require manual changes to
HTML template.
Radio buttons Can be used. Require manual changes to
HTML template.
Pushbuttons OK. Converted.
Step loops OK. Some problems exist.
See Implementing Step
Loops [Page 16].
Table Can be used. Require manual changes to
controls HTML template.
Tabstrip Do not use.
controls
Dropdown Do not use.
boxes
Business
Icons Do not use. Instead, use the HTML
function mimeURL to
embed icons in HTML
template manually.

December 1999 9
Web Transaction Programming SAP AG
Quick Guide to ABAP Elements in HTML

Subscreens Can be used. Require manual changes to


HTML template.
A subscreen corresponds to
an HTML frame.
A screen containing
subscreens corresponds to
an HTML frameset.
Group boxes Can be used, but not displayed Instead, use the label
in HTML. function (for example,
Box1.label).
ABAP Dialog boxes Can be used, but not supported Requires setting of service
module in HTML. file parameter ∼popups.
Field help Do not use.
(F1)
Input help Can be used, but not supported Requires manual changes to
(F4) by HTML. HTML template.

10 December 1999
SAP AG Web Transaction Programming
Implementing Menus

Implementing Menus
The Web browser has a menu that contains browser-specific functions, but there are no other
menus available in individual HTML pages, and it is not possible to merge individual menu
options into the existing menu.
For this reason, Web transactions do not support menus, so user input must come through
pushbuttons.

December 1999 11
Web Transaction Programming SAP AG
Implementing Text Areas

Implementing Text Areas


In addition to the usual one-line input fields, HTML also supports multiple line text areas.
To implement an application allowing the user to enter a short message in ABAP, you could
define an appropriate internal table.
To define an equivalent text box, you need to specify the following code in HTML:
<textarea name=“message_text[]“ cols=“46“ rows=“10“></textarea>

For an example, see lesson 4 of the Tutorial.

12 December 1999
SAP AG Web Transaction Programming
Implementing Checkboxes

Implementing Checkboxes
At present, the DIAG protocol does not allow you to activate checkboxes (or radio buttons)
directly from an ABAP program in HTML. However, you can still use checkboxes in Web
transaction by means of a workaround.
To implement checkboxes in Web transactions, you identify them in HTML templates by the
names assigned in the Screen Painter. A checkbox field is always mapped to a character field
with a length of 1. The value of this field is either blank or you assign a value like ‘X’.
The handling of checkboxes by Web browsers can cause problems:
• If a checkbox is checked, the Web browser transmits the state of the checkbox to the Web
server.
• If a checkbox is not checked, the Web browser transmits nothing to the Web server when
the form is posted, so the Internet Transaction Server (ITS) receives no value and the called
program has no knowledge of the checkbox variable.
To reset a checkbox to blank, you can use a hidden HTML field and assign the value ‘ ‘ to the
checkbox field name. Since hidden HTML fields are always sent by the Web browser, the ITS
receives the value ‘ ‘, which resets the checkbox on the R/3 screen.
Although the HTML contains the hidden HTML field, the value ‘X’ is transferred to the ITS if the
checkbox is set and if it is specified after the hidden HTML form input field, because it takes
precedence over the hidden HTML field.
To find out the current state of a checkbox on the R/3 screen, you can use the checked
attribute in HTML. If the checkbox is set on the screen, the name assigned in the Screen Painter
Business
contains ‘X’. You can use the HTML statement if to set the checked attribute of the
checkbox depending on the value of the R/3 screen field.

<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>

<INPUT TYPE=“HIDDEN“ NAME=“OPTION_1“ VALUE=“ “>


<INPUT TYPE=“CHECKBOX“ NAME=“OPTION_1“ VALUE=“X“
`if ( OPTION_1 == “X“ )` checked `end` >

<INPUT TYPE=“HIDDEN“ NAME=“OPTION_2“ VALUE=“ “>


<INPUT TYPE=“CHECKBOX“ NAME=“OPTION_2“ VALUE=“X“
`if ( OPTION_2 == “X“ )` checked `end` >

<INPUT TYPE=“HIDDEN“ NAME=“OPTION_3“ VALUE=“ “>


<INPUT TYPE=“CHECKBOX“ NAME=“OPTION_3“ VALUE=“X“
`if ( OPTION_3 == “X“ )` checked `end` >

</FORM>

December 1999 13
Web Transaction Programming SAP AG
Implementing Radio Buttons

Implementing Radio Buttons


At present, the DIAG protocol does not allow you to activate radio buttons (or checkboxes)
directly from an ABAP program in HTML. However, you can still use radio buttons in Web
transaction by means of a workaround.
To implement radio buttons in Web transactions, you identify them in HTML templates by
specifying the same name as in the ABAP program. You need to create a character input field of
the appropriate length and edit the template accordingly to use <input type=radio instead of the
generated text.
By doing this, you can place any one of a mutually exclusive set of values into an input field.
In HTML, you must group radio buttons together by giving them the same HTML name. If a
particular radio button is set, the Web browser assigns the value of that radio button to the group
name. If the value corresponds to the name of a radio button field on the screen in R/3, the radio
button is set there.

HTML

<input type="radio" name=”


OPTIONS" value="RB_OPTION1" >
<input type="radio" name=”
OPTIONS" value="RB_OPTION2" >
<input type="radio" name=”
OPTIONS" value="RB_OPTION3" >

OPTIONS = “RB_OPTION2”

R/3 Screen

R/3 fields
RB_OPTION1
RB_OPTION2
RB_OPTION3

You should ensure that the radio button group name is not the name of a valid R/3 screen.

14 December 1999
SAP AG Web Transaction Programming
Implementing Radio Buttons

December 1999 15
Web Transaction Programming SAP AG
Implementing Step Loops

Implementing Step Loops


In the R/3 System, step loops require special instructions in the flow logic. Furthermore, all the
fields of a column have identical names, which makes it more difficult to convert them to HTML.
A further problem is caused by limiting the number of table lines provided by the R/3 System.
Only the number of lines defined in the screen is provided, even if it is a variable loop.
You should therefore design the Web transaction so that it is possible to scroll through the
dataset in the HTML document using either pushbuttons or a scroll bar.

16 December 1999
SAP AG Web Transaction Programming
Implementing Table Controls

Implementing Table Controls


To implement table controls in Web transactions, you need to transfer screen field names from
R/3 to the Web browser via the DIAG protocol.

Table Data
Business
The data displayed in table control fields is made available to the HTML interpreter via the
field names used on the screen, as shown in the following graphic:

Account Number Account Description

Account Number[5]

Account Description[7]

The field index starts with 1 and increments up to the maximum number of lines of the dataset
displayed in the table control.

Table Control Attributes


Business
In HTML , a table control is identified by the name assigned in the Screen Painter. The
attributes contain information about the table control, as shown in the following table:

Attribute Name Meaning


FirstVisible Line number of the first visible record in the dataset displayed by the table
control. Numbering starts with 1.
LastVisible Line number of the last visible record in the dataset displayed by the table
control. Numbering starts with 1.
RowCount Number of records in the dataset displayed by the table control.
ColumnCount Number of columns in the table control.

December 1999 17
Web Transaction Programming SAP AG
Implementing Table Controls

The following example shows the different attributes of the table control TABLE:

The name of the table control assigned in the Screen Painter is TABLE.

TABLE.columnCount = 8

TABLE.firstVisible = 6

TABLE.rowCount = 20

TABLE.lastVisible = 18

Table Control Navigation


To navigate to the place in the table where the user scrolls, you need to be able to position the
table control slider box accordingly.
Previously, only function codes (OK codes) could be sent back to R/3. However, since there can
now be more than one table control on a screen, you need to be able to communicate with a
Business
particular object on the screen. In the HTML template, you therefore specify the object with
which you want to communicate and the particular action you want to perform.
In accordance with the standard terminology for user interfaces, you raise a particular event on a
particular control:
• The term event refers to the action performed
• The term control refers to the object on the screen with which you want to communicate
For the the control type “Table Control”, the following events are defined:

Event Action
TopPage Displays first page of dataset displayed by the table control.
This sets .firstVisible to 1.
LastPage Displays last page of dataset displayed by the table control.
This sets .lastVisible to the number of records of the dataset
displayed by the table control
PrevPage Displays previous page of dataset displayed by the table control.
This decreases .firstVisible and .lastVisible by the number of
visible lines of the table control.
NextPage Displays next page of dataset displayed by the table control.
This increases .firstVisible and .lastVisible by the number of visible
lines of the table control.

18 December 1999
SAP AG Web Transaction Programming
Implementing Table Controls

Business
To raise an event on a particular control, you use the HTML command wgateUrl() and
specify the two parameters ~control and ~event, as follows:
wgateUrl(~event=”EventName” ~control=”TableName”

The following example shows how to display the table control data in an HTML page and how to
scroll through the table control using two pushbuttons:

<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>


<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to Table.lastVisible`
<TR>
<TD>`ACCOUNT-NUMBER[i]`</TD>
<TD>`ACCOUNT-DESCR[i]`</TD>
</TR>
`end`
<INPUT TYPE=“SUBMIT”
NAME=”~Event=PrevPage, ~Control=Table”
VALUE=”Previous Page”>
<INPUT TYPE=“SUBMIT”
NAME=”~Event=NextPage, ~Control=Table”
VALUE=”Next Page”>
<TABLE>
</FORM>

The following example shows the same functionality using two hypertext links:

<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to Table.lastVisible`
<TR>
<TD>`ACCOUNT-NUMBER[i]`</TD>
<TD>`ACCOUNT-DESCR[i]`</TD>
</TR>
`end`
<A HREF=“wgateUrl(~Event=PrevPage, ~Control=Table)“
Previous Page“ </A>
<A HREF=“wgateUrl(~Event=NextPage, ~Control=Table)“
Next Page“ </A>
</TABLE>

Posting Data to a Table Control


To post data to a table control, you use HTML text fields with names assigned in the Screen
Painter, and an index. The index is equal to the absolute number of the record of the dataset
displayed by the table control. See the following example:

December 1999 19
Web Transaction Programming SAP AG
Implementing Table Controls

<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>


<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to Table.lastVisible`
<TR>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-NUMBER[`i`]”
VALUE=”ACCOUNT-NUMBER[`i`]”</TD>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-DESCR[`i`]”
VALUE=”ACCOUNT-DESCR[`i`]”</TD>
</TR>
`end`
<INPUT TYPE=“SUBMIT”
NAME=”~Event=PrevPage, ~Control=Table”
VALUE=”Previous Page”>
<INPUT TYPE=“SUBMIT”
NAME=”~Event=NextPage, ~Control=Table”
VALUE=”Next Page”>
<TABLE>
</FORM>

Automatic Repositioning and Resynchronization


When a user scrolls through the dataset displayed in a table control, not all the data is always
visible. Since only visible fields can be ready for input, an HTML page should allow data input
only for those fields currently visible in the table control.
To enforce this, you present only those fields between the lines Table.firstVisible and
Table.lastVisible (as shown in the example above).
The following example shows how to transfer data from an HTML page to R/3:

Web Browser
Next Page

1 110-1 Detail 1 5 110-5 Detail 5


2 110-2 Detail 2 6 110-6 Detail 6
3 110-3 Detail 3 7 110-7 Detail 7
4 110-4 Detail 4 8 110-8 Detail 8

Screen Screen

1 110-1 Detail 1 5 110-5 Detail 5


2 110-2 Detail 2 6 110-6 Detail 6
3 110-3 Detail 3 7 110-7 Detail 7
4 110-4 Detail 4 8 110-8 Detail 8
R/3

20 December 1999
SAP AG Web Transaction Programming
Implementing Table Controls

Unfortunately, using the Web browser’s Back button may result in HTML pages being pulled out
of the browser’s page cache, so that the data displayed in the Web browser is not visible on the
R/3 transaction screen.

Web Browser
Back

5 110-5 Detail 5 1 110-1 Detail 1


6 110-6 Detail 6 2 110-2 Detail 2
7 110-7 Detail 7 3 110-3 Detail 3
8 110-8 Detail 8 4 110-4 Detail 4

wrong fields!

Screen Screen

5 110-5 Detail 5 5 110-5 Detail 5


6 110-6 Detail 6 6 110-6 Detail 6
7 110-7 Detail 7 7 110-7 Detail 7
8 110-8 Detail 8 8 110-8 Detail 8

R/3

To resolve this problem, the ITS:


• Repositions the scroll bar of the table control, so that the first field posted from the Web is
displayed in the first line of the table control
• Posts the data to the R/3 application.

1 110-1 Detail 1
2 110-2 Detail 2
STEP 2: 3 110-3 Detail 3
Post data 4 110-4 Detail 4

Screen Screen

5 110-5 Detail 5 1 110-1 Detail 1


6 110-6 Detail 6 2 110-2 Detail 2
7 110-7 Detail 7 3 110-3 Detail 3
8 110-8 Detail 8 4 110-4 Detail 4

STEP 1:
Reposition scroll bar

December 1999 21
Web Transaction Programming SAP AG
Implementing Table Controls

This method works, unless:


• The number of lines in the table control has changed
• The order of the lines in the table control has changed
If in doubt, use the switch ~syncBehaviour NoResync in your service file. In this case, the
ITS detects when the Back button in the Web browser has been used, and displays a warning
message. This method safeguards against data loss, but the user loses the ability to use the
Back button.

Automatic Scrolling
Although the functionality of table controls and step loops is similar, table controls do not support
the automatic scrolling possible with step loops.

22 December 1999
SAP AG Web Transaction Programming
Implementing Table Controls

Table Row Selection


To select a particular row of the dataset displayed by a table control, you can use the name
<TC>-ROWSELECT, where TC stands for the name of the table control assigned in the Screen
Painter. At present, it is not possible to use the name of the line selection variable assigned in the
Screen Painter.
To determine whether a particular line of the table control is currently selected, you can use the
attribute TC-ROWSELECT.selected:
Example:
<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>
<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to Table.lastVisible`
<TR>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-NUMBER[`i`]”
VALUE=”ACCOUNT-NUMBER[`i`]”</TD>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-DESCR[`i`]”
VALUE=”ACCOUNT-DESCR[`i`]”</TD>
</TR>
`end`
<INPUT TYPE=“SUBMIT”
NAME=”~Event=PrevPage, ~Control=Table”
VALUE=”Previous Page”>
<INPUT TYPE=“SUBMIT”
NAME=”~Event=NextPage, ~Control=Table”
VALUE=”Next Page”>
<TABLE>
</FORM>

Table Column Attributes


The identifier <TC>-COLUMN[i] contains information about the column number i of the table
control TC.
The only attribute currently available is.title which contains the column title.
Example:
<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>
<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to Table.lastVisible`
<TR>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-NUMBER[`i`]”
VALUE=”ACCOUNT-NUMBER[`i`]”</TD>
<TD><INPUT TYPE=”TEXT”
NAME=”ACCOUNT-DESCR[`i`]”
VALUE=”ACCOUNT-DESCR[`i`]”</TD>

December 1999 23
Web Transaction Programming SAP AG
Implementing Table Controls
</TR>
`end`
<INPUT TYPE=“SUBMIT”
NAME=”~Event=PrevPage, ~Control=Table”
VALUE=”Previous Page”>
<INPUT TYPE=“SUBMIT”
NAME=”~Event=NextPage, ~Control=Table”
VALUE=”Next Page”>
<TABLE>
</FORM>

Restrictions
Until R/3 Release 4.0A, no field names were transferred for table controls, so Release 4.0B is the
first R/3 release where table controls are fully supported. If you write a transaction that could be
downported to R/3 releases earlier than 4.0B, please do not use table controls. Use step loops
instead.

24 December 1999
SAP AG Web Transaction Programming
Implementing Dialog Boxes

Implementing Dialog Boxes


To implement dialog boxes in Web transactions, you can use the service setting ~popups.
• In HTML, the current standard supports only one form of representation for HTML pages,
which are always displayed completely in the Web browser. There are no dialog boxes.
• In R/3 transactions, dialog boxes are used frequently for input help, some error message
types, security prompts and confirmations.
Previously, it was not possible to implement dialog boxes in Web transactions, because they
were always suppressed by sending an automatic OK code “\0” . This default behavior is not
always desirable, especially if the dialog box contains important information, or cannot be closed
with the OK code.
To facilitate implementation of dialog boxes, set the service file setting ~popups accordingly:

Service Setting
~popups
Value Meaning
0 Dialog boxes are suppressed (default).
1 Dialog boxes are supported.

In this case, the ITS generates a template for


the screen currently displayed in the dialog box.

December 1999 25
Web Transaction Programming SAP AG
Implementing Input Help

Implementing Input Help


To implement field-specific input help, you need to find values that match certain selection criteria
specified by the user.
The input help supported by the Internet Transaction Server (ITS) in Web transactions is similar
to the input help in R/3, because it is an HTML version of the input help available in R/3. In both
R/3 and HTML, the availability of input help for a particular field is evident from the presence of a
pushbutton on the right of the field.
To implement input help for a field in a Web transaction, you must modify the HTML template to
display a possible entries pushbutton next to that field. To do this, you can use the macro
searchhelp.

Syntax
searchhelp(~fieldname=expression)
Parameter Description
~fieldname Specifies the Screen Painter name of
the screen field for which input help is
requested.

<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>


`RMMG1-MATNR.label`
<INPUT TYPE=“TEXT“ NAME=“RMMG1-MATNR“ VALUE=“`RMMG1-MATNR`“>
`searchhelp(~fieldname=“RMMG1-MATNR“)`
</FORM>

This code looks like this in the Web browser:

The input help window looks like this:

26 December 1999
SAP AG Web Transaction Programming
Implementing Input Help

To display input help values, the ITS uses a system template called searchhelp.html:

HTML System Template


searchhelp.html
System Field Description
~searchhelpfield Name of field for which input help is provided.
~searchhelpdialogpagenumber[I] Number of elementary input help dialog.
~searchhelpdialogpagetext[I] Name of elementary input help dialog.
~searchhelpactivedialogpage Currently active elementary input help.
~searchhelpcolumn[I] Result column field names.
~searchhelpdialogitemtext[I] Description of an input help filter option.
~searchhelpdialogitemid[I] Field ID of input help filter option.

The system administrator can modify this template according to the usual rules for modifying
system templates.

December 1999 27
Web Transaction Programming SAP AG
Implementing Input Help

The parameter names in the system template do not constitute a programming


interface and may change in future versions of ITS.

The ITS only supports input help for R/3 Release 4.5A or later.
For further information about input help, see Search Helps [Ext.] in the ABAP Dictionary
documentation.

28 December 1999
SAP AG Web Transaction Programming
Creating the ITS Service

Creating the ITS Service


To enable an R/3 transaction for Internet use, you need to create an ITS service – set of external
components needed by the ITS to call an R/3 transaction from the Internet
An ITS service consists of the following components:
• An ITS service description
• One or more themes
• One or more HTML templates
Some ITS services may also consist of the following components:
• Language resource files
• MIME files (graphics, images, sound, or video components)
Each service corresponds to a transaction in the R/3 System.
You create these components outside the R/3 System in the SAP@Web Studio [Ext.]. With the
exception of themes, all exist as ITS files. Once created, you can move these files from the
SAP@Web Studio to ITS source control, which stores the current versions in the R/3 System.
• Dynamic files such as service descriptions, HTML templates, and language resources are
stored in the appropriate ITS server directories
• Static files such as MIME files are stored in the Web server directory.
Both externally and in the R/3 System, a service is identified by the service name, not by the R/3
transaction code (although these may often be the same). When creating a service, you must
ensure that the service name conforms to the usual naming conventions applicable to customer
systems. From R/3 Release 3.1H onwards, service names must start with the letter y or z.
For further information, see:
ITS Service Description [Page 30]
HTML Templates [Page 32]
Language Resource Files [Page 34]
Themes [Page 31]

December 1999 29
Web Transaction Programming SAP AG
ITS Service Description

ITS Service Description


Each Web transaction must have one service description, which is the set of parameters that
define how the ITS service is run. The service description is stored in the relevant service file.
The main service parameters define essential information such as:
• R/3 System name and host
• R/3 transaction name
• Logon information (client, user name, password, and logon language)
You create the service description by defining a service in the SAP@Web Studio [Ext.]. After
creating the file, you can always edit the service description manually if required.
A service description is valid only for a specific Web transaction. However, every ITS server also
has a global service description, which is stored in the global service file global.srvc. The
parameter values defined in the global service file are used as defaults for every parameter not
specified in an individual service description. If a parameter is defined in both the service-specific
file and the global service file, the value in the service-specific file always overrides the default
value in the global service file.
The global service description is created when the ITS is installed, but you can change it
manually in the SAP@Web Studio.

30 December 1999
SAP AG Web Transaction Programming
Themes

Themes
An ITS service can also be sub-divided into themes, which are instances of the service that differ
only in their look and feel (that is, layout, graphics, or language). Each theme has its own set of
HTML templates and other service files, but the functionality of the service is the same for all
themes. Themes have 2-character names.
To define a theme for a service description, you create a subdirectory for the theme in the service
directory, using the SAP@Web Studio [Ext.].
You can also specify a default theme for a service by inserting a ~theme service parameter in
the service description. A service can have multiple themes, but only one ~theme parameter
should appear in the service description. You can override this parameter by supplying a different
theme value in the URL at runtime.
A default theme 99 is defined globally for all services in the global service file global.srvc. This
theme is provided by default at ITS installation, and is used when no other theme is specified for
the particular service.

December 1999 31
Web Transaction Programming SAP AG
HTML Templates

HTML Templates
HTML templates are the means by which an IAC is displayed in a Web browser. For each screen
in an R/3 transaction, the ITS generates exactly one HTML template.
Business Business
Each HTML template contains standard HTML code and HTML statements. HTML is
an SAP-specific macro language, which allows you to merge R/3 data into HTML files at runtime.
Business
HTML statements are not evaluated by Web browsers, but by the ITS, which:
• Inserts R/3 screen data and R/3 screen texts into the appropriate HTML template
• Translates non-R/3 texts into the relevant language (using language resource files)
The completed template is then passed to the Web browser.

Creating HTML Templates


When you create an ITS service, you must create an HTML template for each screen in the R/3
transaction. To do this, you can use the SAP@Web Studio [Ext.], which accesses R/3 screen
data and generates the corresponding HTML code.
An HTML template is assigned to exactly one service (or exactly one theme, if the service
contains more than one theme).

Changing HTML Templates


After generating an HTML template, you can change it manually to:
• Adapt it to your company’s graphic standard
• Modify the HTML code
There are several reasons you may want to modify the HTML generated by the SAP@Web
Studio, because the HTML generator cannot know how you want to use the R/3 data in your
HTML templates.
You may wish to use screen fields in different ways (for example, as radio buttons or
checkboxes), specify field values in URLs, reformat tables with URLs in a given column, and
so on. Also, if the Web transaction sends data over the RFC channel (using the FIELD_SET
or FIELD_TRANSPORT macros), you need to add HTML code to handle the data.
You can use any suitable HTML editor to modify HTML templates, but only the SAP@Web
Business
Studio can perform syntax checks on HTML statements.

32 December 1999
SAP AG Web Transaction Programming
HTML Templates

If you make changes to an R/3 screen, you may also need to modify the HTML
template. You can either modify the template manually or recreate it using the new
R/3 screen description. If you recreate it, remember that any manual changes you
made to the previous template will be lost, so it’s a good idea to make backups of all
HTML templates before re-generating them.

ITS System Templates


At runtime, the ITS uses system templates to generate Web browser pages that are not specific
to a given service. Such pages are needed when:
• An error occurs during the processing of a Web transaction
• The ITS requests the user to enter logon information
Predefined HTML templates have been developed for this purpose, and the ITS can use them to
create the required HTML pages. You cannot modify system templates.
See system templates.

December 1999 33
Web Transaction Programming SAP AG
Language Resource Files

Language Resource Files


The final HTML page derived from an R/3 transaction screen and displayed in the Web browser
can contain a mixture of texts. Some come from the R/3 System, while others are generated
outside R/3.
At runtime, the Internet Transaction Server (ITS) automatically receives ABAP text elements from
R/3 in the correct language. For non-R/3 text elements (such as those in graphics), the ITS must
take steps to generate the texts in the correct language.
The solution to this problem is provided by language resource files, which contain collections of
text elements in a particular language. A language resource file always consists of language
resource keys, and corresponding translated texts.
Language resources are used by the ITS to run a service in a particular language, and thus keep
HTML templates language-independent. Instead of hard-coding language-specific texts directly in
the HTML templates, you specify placeholders in the templates amd store the texts in the
relevant language resource file.
HTML templates use the language resource keys as placeholders for non-R/3 text elements. At
runtime, the ITS replaces the placeholders with the translated texts from the appropriate resource
file. The appropriate language resourec file is always the file that contains texts in the current
logon language.
You can create one or more language resource files for each service, since each file contains
texts for a single language. If you also use themes, you probably need to create a language
resource file for each theme in a service. If you create no language resource files, the ITS uses
your HTML templates without attempting any text translation.
You create and edit language resource files outside the R/3 System in the SAP@Web Studio
[Ext.], but you can transfer the files to the R/3 System later using the Studio’s source control
functions.

34 December 1999
SAP AG Web Transaction Programming
Adapting the HTML Code

Adapting the HTML Code


To merge R/3 screen data dynamically into HTML templates, SAP provides a macro language
Business
called HTML .
When an Internet user starts an IAC from a Web browser, this triggers an ITS service, which
corresponds to an R/3 transaction. For each R/3 transaction, there is an HTML template, which
contains standard HTML code and HTMLBusiness statements.
Business
At runtime, the Internet Transaction Server (ITS) replaces all HTML statements with R/3
data, R/3 texts, non-R/3 texts or graphics, dynamically generated URLs, R/3 error messages or
standard HTML source code. The complete HTML page is then sent to the Web browser via the
Web server.
Business
This section summarizes the main features of HTML such as:
Business
• Embedding HTML in standard HTML
• Field and array replacement
• if, repeat, and for statements
Business
• HTML functions
For further information, follow the links below or see HTML Business Language Reference [Ext.].

Embedding HTMLBusiness in HTML


Business
To enable the ITS to differentiate between HTML and standard HTML, you must enclose all
Business
HTML statements in special delimiters. These delimiters are either the server commands
<server> and </server>, or back quotes (`). The back quotes are needed for inserting
Business
HTML inside HTML tags.
The <server> … </server> container cannot be nested in another HTML tag. For example, the
following statement is invalid:
<a href=<server> … </server>>

For more information see:


Embedding HTML-Business in HTML [Ext.].
Embedding Multiple HTML-Business Statements [Ext.]

Field and Array Replacement


Replacing Fields
Business
With the exception of reserved keywords, each HTML expression is treated as the name of
a screen field, and replaced with the value of that field. If the field cannot be found, the ITS
generates a runtime error. You can also:
• Use field contents in simple expressions
Example: VBCOM-KUNDE >= 1000
• Limit the number of characters transferred
Example: VBCOM-KUNDE:2
• Find out attributes of the R/3 field

December 1999 35
Web Transaction Programming SAP AG
Adapting the HTML Code

Example: array.dim
For further information, see Referring to R/3 Fields [Ext.].

Replacing Arrays
The ITS also processes arrays. On the R/3 side, the arrays are either step loops on the screen or
tables sent from the screen to the ITS via RFC. You can access individual elements in an array
by specifying an index (in angle brackets) after the field name.
Example: array[j]
This assignment is valid for step loop fields in either direction. For further information, see
Referring to R/3 Arrays [Ext.].

IF, REPEAT, and FOR Statements


Business
If you want to replace a field repeatedly, or only under certain conditions, HTML provides
the following statements:
• if
• repeat

• for

if Statement
Depending on some condition, you may want ITS to insert varying hyperlinks, suppress empty
fields or change the arrangement of fields on the screen.
Examples of if statement syntax are:
• if (expr) statements1 else statements2 end

• if (expr1) statements1
if (expr2) statements2
elsif (expr3) statements3
end
elsif (expr4) statements4
else statements1
end

For further information, see if Statement [Ext.].

repeat and for Statements


When processing fields that contain several values (such as step loops and internal tables), you
must ask the ITS to perform multiple replacements. The repeat and for commands execute a
specific sequence of statements several times.
Examples of syntax are:
• repeat expr times statement end

• repeat with register in field statement end

• repeat with indexfield from expr1 to expr2 [by expr3]


statement end

• for( expr1 ; expr2 ; expr3) statement end

For further information, see repeat and for Statements [Ext.].

36 December 1999
SAP AG Web Transaction Programming
Adapting the HTML Code

Expression Evaluation
Business
You can code standard expressions in HTML . The ITS evaluates these expressions when
executing your if, repeat, and for statements.
For information on expression syntax, see Expressions [Ext.].

HTMLBusiness Functions
HTML templates with hardcoded URLs or path names to graphics files may not always work
Business
correctly when transferred to other systems. HTML provides functions that generate URLs
and other HTML texts dynamically. You must use these functions to ensure that your templates
are correct, regardless of Web server or ITS configuration.
• assert [Ext.]
The assert function gets error messages from R/3. If an error is triggered during an R/3
transaction, R/3 determines the field responsible and passes a standard error text to the ITS.
The ITS replaces the assert statement with this message text.
• write [Ext.] and writeENC [Ext.]
The write function writes field contents and other information to the HTML document.The
only difference between write and simple replacement is that write adds no spaces for
separating individual values.
The writeENC function works similarly, except that the output is coded according to URL
requirements, so that spaces and special characters are replaced with their hexadecimal
code. This function lets you construct URLs correctly from fields that contain spaces and
special characters.
• wgateURL [Ext.]
This wgateURL function ensures browser independence by generating URLs that
dynamically take the location of the Web server into account.
• mimeURL [Ext.] and imageURL [Ext.]
The mimeURL function specifies links to static files (for example, graphics and help files) that
are to be incorporated in the HTML template at runtime. These files are not stored in the ITS
directory but in the HTTP server directory.
The imageURL function is an older version of mimeURL.
• archiveURL [Ext.]
The archiveURL function allows you to access functions in the iXOS archive. You choose the
appropriate function using the Command, ArchiveID and DocID parameters. You can find
further information about the iXOS archive in the appropriate product documentation.

December 1999 37
Web Transaction Programming SAP AG
Quick Guide to the HTML Generator

Quick Guide to the HTML Generator


When you create HTML templates, the SAP@Web Studio generates HTML code that mimics
your R/3 screens in an HTML page. The generated code consists of standard HTML code and
Business
HTML statements.
Of course, the HTML generator cannot always know exactly what logic you require for your
template, so you must modify the generated code to suit your requirements.
Business
The following table summarizes the HTML statements required to implement various
screen or ABAP elements in R/3:

R/3 Element HTML


Function keys Not supported, but you can use the function keys F21 to F24 to
implement scrolling.
Menus Not supported.
I/O fields <input type=text name=”R/3-field-name”
value=”`R/3-field`”
maxlength=” ” size=” ”>

Text fields <p> `textfield.label` </p>

Text areas
Checkboxes <input type=”hidden” name=”option_1”
value=” ”>
<input type=”checkbox” name=”option_1”
value=”X”
`if ( option_1 == “X” )` checked `end` >

Radio buttons <input type=”radio” name=”options”


value=”rb_option1”>
<input type=”radio” name=”options”
value=”rb_option2”>
<input type=”radio” name=”options”
value=”rb_option3”>

options=“rb_option2”

Pushbuttons <input type=submit name=”~OkCode=(R/3FctCode)”


value=”`R/3-buttonname.label`”>

Step loops <table>


`repeat with i from 1 to 'EMPLOY-ENAME'.dim`
<tr>
<td>`EMPLOY-TEL01 [i]` </td>
<td>`EMPLOY-TEL02 [i]` </td>
<td>`EMPLOY-GEBNR [i]` </td>
<td>`EMPLOY-ZIMNR [i]` </td>
</tr>
`end`
</table>

38 December 1999
SAP AG Web Transaction Programming
Quick Guide to the HTML Generator

Table controls To specify table control to be processed:


wgateUrl(~event=”EventName” ~control=”TableName”

To display table control data in an HTML page and page through using
two pushbuttons:
<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>
<TABLE>
<THEAD>
<TD>Account Number</TD>
<TD>Account Description</TD>
</THEAD>
`repeat with i from Table.firstVisible to
Table.lastVisible`
<TR>
<TD>`ACCOUNT-NUMBER[i]`</TD>
<TD>`ACCOUNT-DESCR[i]`</TD>
</TR>
`end`
<INPUT TYPE=“SUBMIT”
NAME=”~Event=PrevPage, ~Control=Table”
VALUE=”Previous Page”>
<INPUT TYPE=“SUBMIT”
NAME=”~Event=NextPage, ~Control=Table”
VALUE=”Next Page”>
<TABLE>
</FORM>

See also Implementing Table Controls [Page 17].


Tabstrip controls Not supported.
Dropdown boxes Input help for example.
Icons Use the mimeURL function to embed icons in HTML templates manually
Subscreens In the main screen, code declaring subscreens could be:
<frameset>
<frame name="SUBSCREEN1"
src="`wgateURL(~FrameName="SUBSCREEN1")`"
scrolling="auto">
<frame name="SUBSCREEN2"
src="`wgateURL(~FrameName="SUBSCREEN2")`"
scrolling="auto">
</frameset>

In the subscreen, the HTML generator produces:


<FORM ACTION="`wgateURL()`" METHOD="post">

To specify the target frame, you must manually add a target parameter to
the wgateURL call, for example: ~target=SUBSCREEN1.

December 1999 39
Web Transaction Programming SAP AG
Quick Guide to the HTML Generator

Group boxes OK to use, but the generated HTML depends on the R/3 release:
• In releases prior to 4.0, a group box in an R/3 screen signalled a
subscreen frame. For each R/3 group box, the HTML generator
produced a frame in the base HTML template.
• From Release 4.0, a group box in an R/3 screen has no equivalent in
HTML, so no group box is generated.
Dialog boxes Not supported. To implement dialog boxes, you need to set the service
file parameter ~popups.
Field help (F1) Not supported.
Input help (F4) To implement input help for a field, modify standard HTML using the
searchhelp macro
<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>
`RMMG1-MATNR.label`
<INPUT TYPE=“TEXT“ NAME=“RMMG1-MATNR“
VALUE=“`RMMG1-MATNR`“>
`searchhelp(~fieldname=“RMMG1-MATNR“)`
</FORM>

40 December 1999
SAP AG Web Transaction Programming
Multiple Language Support

Multiple Language Support


Like transactions in the R/3 System, Web transactions support multiple languages.
• When you run a transaction in R/3, language-specific table entries are found and displayed in
the current logon language. The R/3 System also delivers the correct field names on each
screen and the appropriate translations of numbered text elements.
• When you run a Web transaction, the same applies. At runtime, the Internet Transaction
Server (ITS) automatically receives ABAP text elements from R/3 in the correct language and
displays them in the HTML templates that corresponding to R/3 screens.
However, the R/3 System cannot provide translations for external objects such as pushbutton
graphics, or texts that are hard-coded in HTML templates. Therefore, the Internet Transaction
Server (ITS) must use another solution to generate these texts in the correct language.
It is possible to create an HTML template for each language, but this considerably increases the
maintenance overhead when changes are required.
In most cases, it is best to create templates that refer to a set of language resource files.
Language-specific trempates are required only when you require supprt for lanagues that do not
follow the Western „left-to-right, top-to-bottom“ word order (e.g. Chinese).
For further information, see:
How the Logon Language is Set [Page 42]
Using Language-Independent Templates [Page 44]
Using Language-Specific Templates [Page 45]
Setting Placeholders in Resource Files [Page 46]

December 1999 41
Web Transaction Programming SAP AG
Setting the Logon Language

Setting the Logon Language


Since the R/3 System supports multiple languages, a language must be specified as part of the
logon procedure.
When you log on to the R/3 System via the SAP GUI for Windows, you usually have to enter your
user name, password, and a logon language.
When you access the R/3 System by clicking on a URL in a Web browser, you have to provide
similar logon information, including a logon language.
If you start a Web transaction, the ITS determines the logon language from any of the following
sources:
• In the global service description
You can specify a logon language in the global service description using the ~language
parameter. This value applies to all services unless specifically overridden in a service
file.
A service description specifying English, for example, would contain the following
expression:
− ~language=EN

• In the service description for the current service


You can specify a logon language in the service description for the current service using
the ~language parameter. If you do this, the user cannot choose any other language at
runtime. Values in the service file override any value in the global service file, even
balnak values.
A service description specifying English, for example, would contain the following
expression:
− ~language=EN

• In the URL
Sometimes the ITS is unable to determine a logon language from either the global
service description or the service description for the current service. This can happen in
the following cases:
− Neither contains a value for the ~language parameter
− The global service description specifies a value for the ~language parameter, but this is
overridden by a blank value in the service description for the current service.
If this happens, the ITS tries two other sources. First, it looks in the URL for a
~language=EN specification.

• Through the user


If the language cannot be found in any of the above sources, the ITS prompts the user to
enter a language on the logon page.
Regardless of whether the service description specifies a language or not, the ITS always uses a
valid language.

42 December 1999
SAP AG Web Transaction Programming
Setting the Logon Language
Business
The language used when the ITS logs on to R/3 is the same language used for all HTML
templates belonging to a service. However, you can change this behavior if you wish.

December 1999 43
Web Transaction Programming SAP AG
Using Language-Independent Templates

Using Language-Independent Templates


Language-independent HTML templates work together with language resource files.
Whenever possible, HTML templates should be language-independent, because this reduces the
maintenance overhead when you have to make changes. This means that they should contain no
language-specific elements such as hard-coded texts or URLs for language-specific objects.
Language-specific elements should be stored in the appropriate language resource files. You can
then insert placeholders known as resource keys in the HTML template. At runtime, the Internet
Transaction Server (ITS) replaces the placeholders with a translation text taken from the
language resource file for the logon language. You can use these placeholders for nearly all
HTML objects (simple text, URLs, field names, and so on).
The file name of a language-independent HTML template contains no language indicator. For
example:
sapmaww1_100.html

The file name of a language-specific HTML template contains a language indicator for the
relevant language. For example, if the language is English, the file name would be:
sapmaww1_100e.html

Language resource files for a service always have language indicators. For example, the name
of the English language resource file for the service aww1 would be:
aww1_e.htrc
When executing a transaction, the ITS must determine how to handle the language texts for the
HTML template. To do this, it:
1. Searches for an HTML template with the relevant language extension in the file name.
If such a template exists, the ITS uses it without a language resource file.
2. Searches for a template with no language extension in the file name, and a language
resource file for the current logon language.
Here, the ITS uses language-independent HTML templates in this and all subsequent
procedures.
3. Uses HTML templates with no language extension, and no language resource file.
In this case, the ITS assumes that the HTML templates have no texts needing
translation.
For further information about ITS naming conventions, see ITS Naming Conventions [Page 55].

44 December 1999
SAP AG Web Transaction Programming
Using Language-Specific Templates

Using Language-Specific Templates


Language-specific HTML templates can contain any language-specific objects. This includes any
hard-coded texts in a specific language, or URLs to objects in that language.
The file name of a language-specific HTML template contains a language indicator for the
relevant language. For example, if the language is English, the file name would be:
sapmaww1_100e.html

The file name of a language-independent HTML template contains no language indicator. For
example:
sapmaww1_100.html

A service can contain both language-specific and language-independent templates. For


information on how the ITS decides between them, when you have both, see: Using Language-
Independent Templates [Page 44].
For further information about ITS naming conventions, see ITS Naming Conventions [Page 55].

December 1999 45
Web Transaction Programming SAP AG
Setting Placeholders in Language Resource Files

Setting Placeholders in Language Resource Files


Objects are stored in language resource files as name-value pairs called resource keys:
• The name part specifies the name of the key
• The value part specifies the translated text for the key in the given language
You can maintain language resource files in the SAP@Web Studio or in any ASCII editor.
You use resource keys in HTML templates by inserting the key name as a placeholder for the
desired text. To differentiate between a normal field reference and a resource key, the resource
keys (placeholders) are always prefixed with the character #:

The following are valid placeholders in HTML templates for the resource keys
CustomerName, Street, 1, Name:
`#CustomerName`
`#Street`
`#1`
`#Name`

46 December 1999
SAP AG Web Transaction Programming
Web Transaction Programming Tools

Web Transaction Programming Tools


To support the implementation of Web transactions, the Internet Transaction Server (ITS)
provides the following tools:
• SAP@Web Studio
Business
• HTML
• ITS Debugger

SAP@Web Studio
The SAP@Web Studio is a PC tool for creating and maintaining the external components
required by the ITS to run a Web transaction. These external components include:
• Service description
• HTML templates
Business
The Studio’s HTML editor recognizes and compiles HTML code, which is the HTML
extension language provided by SAP to merge HTML templates with R/3 screen data.
• Language resource files.
Although the SAP@Web Studio runs outside the R/3 System on your PC, it is connected to both
R/3 and the Web server, so you can also use it to:
• Publish finished files to the ITS server directory
• Transfer the finished files to ITS source control in the R/3 System
For further information, see SAP@Web Studio [Ext.].

HTMLBusiness
HTML templates in Web transactions correspond to screens in R/3 transactions. These
Business
templates contain both standard HTML code and HTML code.
Business
HTML is an SAP’s own extension of standard HTML for handling data transfer between R/3
screens and HTML templates. It allows you to merge the data dynamically from an R/3 screen
with fields in the corresponding HTML template.
For further information, see HTMLBusiness Language Reference [Ext.].

ITS Debugger
The ITS debugger is a tool for analyzing errors in Web transactions. It allows you to establish a
parallel connection between a Web transaction and a normal SAPgui. This means that you can
display the transaction in the Web browser and the SAPgui simultaneously. You can thus
activate the ITS debugger in the SAPgui and use it to analyze the current Web transaction.
For further information, see ITS Debugger [Page 48].

December 1999 47
Web Transaction Programming SAP AG
ITS Debugger

ITS Debugger
When you have created or modified all the external components required by the Internet
Transaction Server (ITS) to run a Web transaction, you must test these components against the
corresponding R/3 transaction. Several errors can occur outside the R/3 System, and although a
transaction may work correctly in R/3, it may not work as a Web transaction.
To analyze errors in Web transactions, you can use the ITS debugger, which is not a separate
debugging tool, but an integration of existing R/3 debugging facilities into the ITS. This integration
is possible because Web transactions are implemented in R/3 using the ABAP Workbench, and
differ only slightly from standard R/3 transactions. For example, Web transactions do not use
some of the screen elements allowed in standard R/3 screens. Also, you must observe special
dialog control rules when programming Web transactions.
The ITS debugger allows you to establish a parallel connection between a Web transaction and
its corresponding R/3 transaction. This means that you can display the transaction
simultaneously in the Web browser and the SAPgui. Effectively, you activate the ABAP debugger
in R/3 and use it to analyze your Web transaction. This way, you can determine whether a Web
browser action has produced the desired result in the SAPgui.
When you create an ITS service, the ITS creates an HTML template for each screen in the R/3
transaction. These templates control how the contents of R/3 fields are converted to HTML and
determine how user entries are transferred from the Web browser to R/3 screen fields. The ITS
debugger allows you to monitor this transfer, both in the HTML page, and in the R/3 System.
You synchronize these two user interfaces by logging on to the ITS using the SAPgui. The ITS
then acts as a virtual application server. You can log on to ITS using SAPgui and SAPgui will
display the current screen of your web transaction (even though you started it from the web
browser).
When you execute an action in the Web browser that changes the transaction status, the ITS
immediately adapts the SAPgui transaction screen. The following graphic illustrates this process:

48 December 1999
SAP AG Web Transaction Programming
ITS Debugger

December 1999 49
Web Transaction Programming SAP AG
Setting Up the ITS Debugger

Setting Up the ITS Debugger


The capability for debugging Web transactions using the SAPgui is usually only active in ITS
development systems. In standard ITS installations, the ITS debugger is deactivated.
You activate the ITS debugger in the ITS Administration Tool.

Procedure
1. Log on to the ITS Administration Tool
2. In the Main frame, choose the relevant ITS instance.
3. In the frame for the ITS instance, choose Configuration.
4. In the Configuration frame, choose Debug.
5. If the value for Debug is set to OFF, choose Debug and select ON.
This activates the debugger.
6. Choose Save.
To run the ITS debugger, see Starting an ITS Debugger Session [Page 51].

50 December 1999
SAP AG Web Transaction Programming
Starting an ITS Debugger Session

Starting an ITS Debugger Session


Procedure
To start an ITS debugger session in the SAPgui:
1. Start the ITS service you want to debug in your Web browser.
2. Open the SAP Logon window and create a logon entry for the virtual ITS application
server.
To do this, enter the following information and use it to log on:
– A brief description
– The name of the application server.
– The system number
The default is 00. You can choose a different system number by setting the NT registry
entry HKEY_LOCAL_MACHINE\Software\SAP\ITS\Agate\SAPguiDebuggerPort. The
default is sapdp00.
The following figure shows an example logon.

December 1999 51
Web Transaction Programming SAP AG
Starting an ITS Debugger Session

3. Start an action in the Web browser.


The transaction screen appears, as shown in the following graphic:

4. Start the ABAP debugger by entering /h in the SAPgui command field.


The Web transaction is now in debugging mode, and a message stating that the debugger
has been activated appears in the Web browser.

5. Make an action in the Web browser.


In the SAPgui display, the ABAP debugger shows the current state of the transaction.

52 December 1999
SAP AG Web Transaction Programming
Leaving an ITS Debugger Session

Leaving an ITS Debugger Session


Procedure
To stop the ITS debugger and continue normal processing in the Web browser, deactivate the
ABAP debugger in the SAPgui.

Result
In the current ITS version, the SAPgui window closes only after you leave the ITS service in the
Web browser.

December 1999 53
Web Transaction Programming SAP AG
Troubleshooting

Troubleshooting
If you notice that the Web browser and SAPgui transaction screens are displaying different
information, you must determine whether the SAPgui is displaying the correct information:
• If the SAPgui transaction screen contains the required information, there is probably an error
in the HTML template.
• If the SAPgui transaction screen contains the wrong information, there is probably an error in
the R/3 transaction.

54 December 1999
SAP AG Web Transaction Programming
ITS Naming Conventions

ITS Naming Conventions


Objects stored in the local file system must observe certain naming conventions:
• If you create files in the SAP@Web Studio, the names are automatically correct
• If you create files outside the SAP@Web Studio, you must observe the accepted naming
conventions

When creating a service, service names must conform to the naming conventions
applicable to customer systems. From R/3 Release 3.1H, service names should start
with the letter y or z.
The following tables show the naming conventions applied to the various ITS file types:

Structure of ITS Object Names

File Contents Length


Service description Service name 1 - 14
HTML template Module pool name 8
Separator “_” 1
Screen number 3 or 4
Separator “_” 1
(optional)
Language 1
(optional)
Language resource Service name 1 - 14
Separator 1
“_”
Language 1
Binary data Any 12

December 1999 55

Вам также может понравиться