55
Web Transaction Programming HELP.BCFESITSTRANPRO G Release 4.6B

Sap Web Transaction Programming

  • Upload
    bertj

  • View
    211

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Sap Web Transaction Programming

Web Transaction Programming

HE

LP

.BC

FE

SIT

ST

RA

NP

RO

G

Re lease 4 .6B

Page 2: Sap Web Transaction Programming

Web Transaction Programming SAP AG

2 December 1999

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 withoutthe express permission of SAP AG. The information contained herein may be changed withoutprior notice.

Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

Microsoft®, WINDOWS®, NT®, EXCEL®, Word® and SQL Server® are registered trademarks ofMicrosoft 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.

INFORMIX®-OnLine for SAP and Informix® Dynamic ServerTM

are registered trademarks ofInformix 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 WideWeb Consortium, Laboratory for Computer Science NE43-358, Massachusetts Institute ofTechnology, 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 fortechnology invented and implemented by Netscape.

SAP, SAP Logo, mySAP.com, mySAP.com Marketplace, mySAP.com Workplace, mySAP.comBusiness Scenarios, mySAP.com Application Hosting, WebFlow, R/2, R/3, RIVA, ABAP, SAPBusiness Workflow, SAP EarlyWatch, SAP ArchiveLink, BAPI, SAPPHIRE, ManagementCockpit, SEM, are trademarks or registered trademarks of SAP AG in Germany and in severalother countries all over the world. All other products mentioned are trademarks or registeredtrademarks of their respective companies.

Page 3: Sap Web Transaction Programming

SAP AG Web Transaction Programming

December 1999 3

Icons

Icon Meaning

Caution

Example

Note

Recommendation

Syntax

Tip

Page 4: Sap Web Transaction Programming

Web Transaction Programming SAP AG

4 December 1999

Contents

Web Transaction Programming.........................................................................5Web Transaction Programming ................................................................................................... 6Programming the R/3 Transaction............................................................................................. 8

Quick Guide to ABAP Elements in HTML .................................................................................. 9Implementing Menus ................................................................................................................ 11Implementing Text Areas.......................................................................................................... 12Implementing Checkboxes ....................................................................................................... 13Implementing Radio Buttons .................................................................................................... 14Implementing Step Loops......................................................................................................... 16Implementing Table Controls ................................................................................................... 17Implementing Dialog Boxes...................................................................................................... 25Implementing Input Help........................................................................................................... 26

Creating the ITS Service ........................................................................................................... 29ITS Service Description ............................................................................................................ 30Themes..................................................................................................................................... 31HTML Templates ...................................................................................................................... 32Language Resource Files......................................................................................................... 34

Adapting the HTML Code.......................................................................................................... 35Quick Guide to the HTML Generator........................................................................................ 38

Multiple Language Support ...................................................................................................... 41Setting the Logon Language .................................................................................................... 42Using Language-Independent Templates ................................................................................ 44Using Language-Specific Templates........................................................................................ 45Setting Placeholders in Language Resource Files .................................................................. 46

Web Transaction Programming Tools..................................................................................... 47ITS Debugger ........................................................................................................................... 48

Setting Up the ITS Debugger .............................................................................................. 50Starting an ITS Debugger Session...................................................................................... 51Leaving an ITS Debugger Session ..................................................................................... 53Troubleshooting................................................................................................................... 54

ITS Naming Conventions .......................................................................................................... 55

Page 5: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Web Transaction Programming

December 1999 5

Web Transaction Programming

Page 6: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Web Transaction Programming

6 December 1999

Web Transaction ProgrammingWeb transactions are Internet-enabled R/3 dialog transactions that Internet and intranet userscan call from a Web browser as Internet Application Components (IACs).

The Web transactions programming model allows ABAP developers to use ABAP dialogprograms 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 theInternet Server API (ISAPI) and the Netscape API (NSAPI).

Interaction Between the ITS and R/3If you set up Web pages containing URLs, which link to the R/3 System, and a Web user makesa 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, andstarts the relevant transaction. When communicating with R/3, the ITS functions as a normalSAP 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 itvia the Web server to the Web browser, where it is displayed as an HTML page.

Web Transaction ImplementationTo 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. Thesecomponents 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 additionalHTMLBusiness statements.HTMLBusiness is an SAP-specific macro language for handling data transfer between R/3screens and HTML pages. At runtime, the ITS executes these extra statements to create thefinished HTML pages to run the Web transaction.

Web transactions must satisfy special requirements regarding:

• Screen design

Page 7: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Web Transaction Programming

December 1999 7

Since HTML (on the Internet side) and ABAP (on the R/3 side) offer different programmingfeatures, some objects used in ABAP programs or on R/3 screens are not supported byHTML, so you have to adapt the HTML code accordingly.

• User authorizations

• Use of BAPIs (Business Application Programming Interfaces) when applying preciselydefined methods to business objects.

Apart from exchanging data between the Internet and the R/3 System, and converting HTMLto R/3 screen data and vice versa, the ITS also performs system administration functionssuch as user management, system resource management, and Web transactionmanagement.

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 informationabout other programming models for implementing IACs, see:

WebRFC Programming [Ext.]

Web Reporting [Ext.]

Page 8: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Programming the R/3 Transaction

8 December 1999

Programming the R/3 TransactionFrom an ABAP coding point of view, Web transactions started from a Web browser are nodifferent from transactions started in the R/3 System.

However, since the graphical user interface available in HTML is more restricted than theSAPgui, 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 tomodify 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]

Page 9: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Quick Guide to ABAP Elements in HTML

December 1999 9

Quick Guide to ABAP Elements in HTMLThe following table summarizes graphical elements available in SAPgui and indicates their usagein HTML:

ABAP vs. HTML

R/3 Source ABAPElement

HTML Usage

Function keys Can be used, but not supported. Can use F21, F23 forscrolling. Otherwise, defineas pushbuttons.

GUI status

Menus Can be used, but not supported Web browsers contain onlybrowser-specific functions.You cannot merge menuoptions from an R/3transaction. Usepushbuttons instead.

I/O fields OK. Converted, no problem

Text fields OK. Converted, no problem.

Text areas Can be used. Require manual changes toHTML template.

Checkboxes Can be used. Require manual changes toHTML template.

Radio buttons Can be used. Require manual changes toHTML template.

Pushbuttons OK. Converted.

Step loops OK. Some problems exist.

See Implementing StepLoops [Page 16].

Tablecontrols

Can be used. Require manual changes toHTML template.

Tabstripcontrols

Do not use.

Dropdownboxes

Do not use.

R/3 screen

Icons Do not use. Instead, use the HTMLBusiness

function mimeURL toembed icons in HTMLtemplate manually.

Page 10: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Quick Guide to ABAP Elements in HTML

10 December 1999

Subscreens Can be used. Require manual changes toHTML template.

A subscreen corresponds toan HTML frame.A screen containingsubscreens corresponds toan HTML frameset.

Group boxes Can be used, but not displayedin HTML.

Instead, use the labelfunction (for example,Box1.label).

Dialog boxes Can be used, but not supportedin HTML.

Requires setting of servicefile parameter ∼popups.

Field help(F1)

Do not use.

ABAPmodule

Input help(F4)

Can be used, but not supportedby HTML.

Requires manual changes toHTML template.

Page 11: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Menus

December 1999 11

Implementing MenusThe Web browser has a menu that contains browser-specific functions, but there are no othermenus available in individual HTML pages, and it is not possible to merge individual menuoptions into the existing menu.

For this reason, Web transactions do not support menus, so user input must come throughpushbuttons.

Page 12: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Text Areas

12 December 1999

Implementing Text AreasIn 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 coulddefine 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.

Page 13: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Checkboxes

December 1999 13

Implementing CheckboxesAt 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 Webtransaction by means of a workaround.

To implement checkboxes in Web transactions, you identify them in HTML templates by thenames assigned in the Screen Painter. A checkbox field is always mapped to a character fieldwith 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 Webserver.

• If a checkbox is not checked, the Web browser transmits nothing to the Web server whenthe form is posted, so the Internet Transaction Server (ITS) receives no value and the calledprogram 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 thecheckbox field name. Since hidden HTML fields are always sent by the Web browser, the ITSreceives 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 thecheckbox is set and if it is specified after the hidden HTML form input field, because it takesprecedence over the hidden HTML field.

To find out the current state of a checkbox on the R/3 screen, you can use the checkedattribute in HTML. If the checkbox is set on the screen, the name assigned in the Screen Paintercontains ‘X’. You can use the HTMLBusiness statement if to set the checked attribute of thecheckbox 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>

Page 14: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Radio Buttons

14

Implementing Radio ButtonsAt 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 Webtransaction by means of a workaround.

To implement radio buttons in Web transactions, you identify them in HTML templates byspecifying the same name as in the ABAP program. You need to create a character input field ofthe appropriate length and edit the template accordingly to use <input type=radio instead of thegenerated 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 aparticular radio button is set, the Web browser assigns the value of that radio button to the groupname. If the value corresponds to the name of a radio button field on the screen in R/3, the radiobutton is set there.

You should ens

HTML

December 1999

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

OPTIONS = “RB_OPTION2”

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

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

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

RB_OPTION1

RB_OPTION2

RB_OPTION3

R/3 fields

R/3 Screen

Page 15: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Radio Buttons

December 1999 15

Page 16: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Step Loops

16 December 1999

Implementing Step LoopsIn the R/3 System, step loops require special instructions in the flow logic. Furthermore, all thefields 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 thedataset in the HTML document using either pushbuttons or a scroll bar.

Page 17: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Table Controls

December 1999 17

Implementing Table ControlsTo implement table controls in Web transactions, you need to transfer screen field names fromR/3 to the Web browser via the DIAG protocol.

Table DataThe data displayed in table control fields is made available to the HTMLBusiness interpreter via thefield names used on the screen, as shown in the following graphic:

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

Table Control AttributesIn HTMLBusiness, a table control is identified by the name assigned in the Screen Painter. Theattributes 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 tablecontrol. Numbering starts with 1.

LastVisible Line number of the last visible record in the dataset displayed by the tablecontrol. Numbering starts with 1.

RowCount Number of records in the dataset displayed by the table control.

ColumnCount Number of columns in the table control.

Account DescriptionAccount Number

Account Description[7]

Account Number[5]

Page 18: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Table Controls

18 December 1999

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 Control NavigationTo navigate to the place in the table where the user scrolls, you need to be able to position thetable control slider box accordingly.

Previously, only function codes (OK codes) could be sent back to R/3. However, since there cannow be more than one table control on a screen, you need to be able to communicate with aparticular object on the screen. In the HTMLBusiness template, you therefore specify the object withwhich 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 aparticular 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 datasetdisplayed by the table control

PrevPage Displays previous page of dataset displayed by the table control.This decreases .firstVisible and .lastVisible by the number ofvisible 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 visiblelines of the table control.

TABLE.lastVisible = 18

TABLE.rowCount = 20

TABLE.firstVisible = 6

TABLE.columnCount = 8

Page 19: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Table Controls

December 1999 19

To raise an event on a particular control, you use the HTMLBusiness command wgateUrl() andspecify 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 toscroll 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 ControlTo post data to a table control, you use HTML text fields with names assigned in the ScreenPainter, and an index. The index is equal to the absolute number of the record of the datasetdisplayed by the table control. See the following example:

Page 20: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Table Controls

2

<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 ResynchronizationWhen a user scrolls through the dataset displayed in a table control, not all the data is alwaysvisible. Since only visible fields can be ready for input, an HTML page should allow data inputonly for those fields currently visible in the table control.

To enforce this, you present only those fields between the lines Table.firstVisible andTable.lastVisible (as shown in the example above).

The following example shows how to transfer data from an HTML page to R/3:

Web Browser

0 December 1999

Screen

8 110-8 Detail 87 110-7 Detail 76 110-6 Detail 65 110-5 Detail 5

4 110-4 Detail 43 110-3 Detail 32 110-2 Detail 21 110-1 Detail 1

Screen

1 110-1 Detail 12 110-2 Detail 23 110-3 Detail 34 110-4 Detail 4

5 110-5 Detail 56 110-6 Detail 67 110-7 Detail 78 110-8 Detail 8

Next Page

R/3

Page 21: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Table Controls

D

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

T

Web Browser

ecember 1999 21

o resolve this problem, the ITS:

Repositions the scroll bar of the table control, so that the first field posted from the Web isdisplayed in the first line of the table control

Posts the data to the R/3 application.

4 110-4 Detail 43 110-3 Detail 32 110-2 Detail 21 110-1 Detail 1

Screen

1 110-1 Detail 12 110-2 Detail 23 110-3 Detail 34 110-4 Detail 4

Screen

8 110-8 Detail 87 110-7 Detail 76 110-6 Detail 65 110-5 Detail 5

STEP 1:Reposition scroll bar

STEP 2:Post data

Screen

8 110-8 Detail 87 110-7 Detail 76 110-6 Detail 65 110-5 Detail 5

1 110-1 Detail 12 110-2 Detail 23 110-3 Detail 34 110-4 Detail 4

5 110-5 Detail 56 110-6 Detail 67 110-7 Detail 78 110-8 Detail 8

Back

Screen

8 110-8 Detail 87 110-7 Detail 76 110-6 Detail 65 110-5 Detail 5

wrong fields!

R/3

Page 22: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Table Controls

22 December 1999

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, theITS detects when the Back button in the Web browser has been used, and displays a warningmessage. This method safeguards against data loss, but the user loses the ability to use theBack button.

Automatic ScrollingAlthough the functionality of table controls and step loops is similar, table controls do not supportthe automatic scrolling possible with step loops.

Page 23: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Table Controls

December 1999 23

Table Row SelectionTo 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 ScreenPainter. At present, it is not possible to use the name of the line selection variable assigned in theScreen Painter.

To determine whether a particular line of the table control is currently selected, you can use theattribute 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 AttributesThe identifier <TC>-COLUMN[i] contains information about the column number i of the tablecontrol 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>

Page 24: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Table Controls

24 December 1999

</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>

RestrictionsUntil R/3 Release 4.0A, no field names were transferred for table controls, so Release 4.0B is thefirst R/3 release where table controls are fully supported. If you write a transaction that could bedownported to R/3 releases earlier than 4.0B, please do not use table controls. Use step loopsinstead.

Page 25: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Dialog Boxes

December 1999 25

Implementing Dialog BoxesTo 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 messagetypes, security prompts and confirmations.

Previously, it was not possible to implement dialog boxes in Web transactions, because theywere always suppressed by sending an automatic OK code “\0” . This default behavior is notalways desirable, especially if the dialog box contains important information, or cannot be closedwith the OK code.

To facilitate implementation of dialog boxes, set the service file setting ~popups accordingly:

Service Setting

~popups

Value Meaning0 Dialog boxes are suppressed (default).

1 Dialog boxes are supported.

In this case, the ITS generates a template forthe screen currently displayed in the dialog box.

Page 26: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Input Help

26 December 1999

Implementing Input HelpTo implement field-specific input help, you need to find values that match certain selection criteriaspecified by the user.

The input help supported by the Internet Transaction Server (ITS) in Web transactions is similarto the input help in R/3, because it is an HTML version of the input help available in R/3. In bothR/3 and HTML, the availability of input help for a particular field is evident from the presence of apushbutton on the right of the field.

To implement input help for a field in a Web transaction, you must modify the HTML template todisplay a possible entries pushbutton next to that field. To do this, you can use the macrosearchhelp.

Syntax

searchhelp(~fieldname=expression)

Parameter Description~fieldname Specifies the Screen Painter name of

the screen field for which input help isrequested.

<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:

Page 27: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Implementing Input Help

December 1999 27

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 modifyingsystem templates.

Page 28: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Implementing Input Help

28 December 1999

The parameter names in the system template do not constitute a programminginterface 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 Dictionarydocumentation.

Page 29: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Creating the ITS Service

December 1999 29

Creating the ITS ServiceTo enable an R/3 transaction for Internet use, you need to create an ITS service – set of externalcomponents 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 theexception of themes, all exist as ITS files. Once created, you can move these files from theSAP@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 arestored 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/3transaction code (although these may often be the same). When creating a service, you mustensure that the service name conforms to the usual naming conventions applicable to customersystems. 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]

Page 30: Sap Web Transaction Programming

Web Transaction Programming SAP AG

ITS Service Description

30 December 1999

ITS Service DescriptionEach Web transaction must have one service description, which is the set of parameters thatdefine 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.]. Aftercreating 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 alsohas a global service description, which is stored in the global service file global.srvc. Theparameter values defined in the global service file are used as defaults for every parameter notspecified in an individual service description. If a parameter is defined in both the service-specificfile and the global service file, the value in the service-specific file always overrides the defaultvalue in the global service file.

The global service description is created when the ITS is installed, but you can change itmanually in the SAP@Web Studio.

Page 31: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Themes

December 1999 31

ThemesAn ITS service can also be sub-divided into themes, which are instances of the service that differonly in their look and feel (that is, layout, graphics, or language). Each theme has its own set ofHTML templates and other service files, but the functionality of the service is the same for allthemes. Themes have 2-character names.

To define a theme for a service description, you create a subdirectory for the theme in the servicedirectory, using the SAP@Web Studio [Ext.].

You can also specify a default theme for a service by inserting a ~theme service parameter inthe service description. A service can have multiple themes, but only one ~theme parametershould appear in the service description. You can override this parameter by supplying a differenttheme value in the URL at runtime.

A default theme 99 is defined globally for all services in the global service file global.srvc. Thistheme is provided by default at ITS installation, and is used when no other theme is specified forthe particular service.

Page 32: Sap Web Transaction Programming

Web Transaction Programming SAP AG

HTML Templates

32 December 1999

HTML TemplatesHTML templates are the means by which an IAC is displayed in a Web browser. For each screenin an R/3 transaction, the ITS generates exactly one HTML template.

Each HTML template contains standard HTML code and HTMLBusiness statements. HTMLBusiness isan SAP-specific macro language, which allows you to merge R/3 data into HTML files at runtime.HTMLBusiness 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 TemplatesWhen you create an ITS service, you must create an HTML template for each screen in the R/3transaction. To do this, you can use the SAP@Web Studio [Ext.], which accesses R/3 screendata and generates the corresponding HTML code.

An HTML template is assigned to exactly one service (or exactly one theme, if the servicecontains more than one theme).

Changing HTML TemplatesAfter 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@WebStudio, because the HTML generator cannot know how you want to use the R/3 data in yourHTML templates.

You may wish to use screen fields in different ways (for example, as radio buttons orcheckboxes), specify field values in URLs, reformat tables with URLs in a given column, andso on. Also, if the Web transaction sends data over the RFC channel (using the FIELD_SETor 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@WebStudio can perform syntax checks on HTMLBusiness statements.

Page 33: Sap Web Transaction Programming

SAP AG Web Transaction Programming

HTML Templates

December 1999 33

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

ITS System TemplatesAt runtime, the ITS uses system templates to generate Web browser pages that are not specificto 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 tocreate the required HTML pages. You cannot modify system templates.

See system templates.

Page 34: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Language Resource Files

34 December 1999

Language Resource FilesThe final HTML page derived from an R/3 transaction screen and displayed in the Web browsercan contain a mixture of texts. Some come from the R/3 System, while others are generatedoutside R/3.

At runtime, the Internet Transaction Server (ITS) automatically receives ABAP text elements fromR/3 in the correct language. For non-R/3 text elements (such as those in graphics), the ITS musttake steps to generate the texts in the correct language.

The solution to this problem is provided by language resource files, which contain collections oftext elements in a particular language. A language resource file always consists of languageresource keys, and corresponding translated texts.

Language resources are used by the ITS to run a service in a particular language, and thus keepHTML templates language-independent. Instead of hard-coding language-specific texts directly inthe HTML templates, you specify placeholders in the templates amd store the texts in therelevant language resource file.

HTML templates use the language resource keys as placeholders for non-R/3 text elements. Atruntime, the ITS replaces the placeholders with the translated texts from the appropriate resourcefile. The appropriate language resourec file is always the file that contains texts in the currentlogon language.

You can create one or more language resource files for each service, since each file containstexts for a single language. If you also use themes, you probably need to create a languageresource file for each theme in a service. If you create no language resource files, the ITS usesyour 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 controlfunctions.

Page 35: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Adapting the HTML Code

December 1999 35

Adapting the HTML CodeTo merge R/3 screen data dynamically into HTML templates, SAP provides a macro languagecalled HTMLBusiness.

When an Internet user starts an IAC from a Web browser, this triggers an ITS service, whichcorresponds to an R/3 transaction. For each R/3 transaction, there is an HTML template, whichcontains standard HTML code and HTMLBusiness statements.

At runtime, the Internet Transaction Server (ITS) replaces all HTMLBusiness statements with R/3data, R/3 texts, non-R/3 texts or graphics, dynamically generated URLs, R/3 error messages orstandard HTML source code. The complete HTML page is then sent to the Web browser via theWeb server.

This section summarizes the main features of HTMLBusiness such as:

• Embedding HTMLBusiness in standard HTML

• Field and array replacement

• if, repeat, and for statements

• HTMLBusiness functions

For further information, follow the links below or see HTML Business Language Reference [Ext.].

Embedding HTMLBusiness in HTMLTo enable the ITS to differentiate between HTMLBusiness and standard HTML, you must enclose allHTMLBusiness statements in special delimiters. These delimiters are either the server commands<server> and </server>, or back quotes (`). The back quotes are needed for insertingHTMLBusiness inside HTML tags.

The <server> … </server> container cannot be nested in another HTML tag. For example, thefollowing 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 ReplacementReplacing FieldsWith the exception of reserved keywords, each HTMLBusiness expression is treated as the name ofa screen field, and replaced with the value of that field. If the field cannot be found, the ITSgenerates 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

Page 36: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Adapting the HTML Code

36 December 1999

Example: array.dim

For further information, see Referring to R/3 Fields [Ext.].

Replacing ArraysThe ITS also processes arrays. On the R/3 side, the arrays are either step loops on the screen ortables sent from the screen to the ITS via RFC. You can access individual elements in an arrayby 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, seeReferring to R/3 Arrays [Ext.].

IF, REPEAT, and FOR StatementsIf you want to replace a field repeatedly, or only under certain conditions, HTMLBusiness providesthe following statements:

• if

• repeat

• for

if StatementDepending on some condition, you may want ITS to insert varying hyperlinks, suppress emptyfields or change the arrangement of fields on the screen.

Examples of if statement syntax are:

• if (expr) statements1 else statements2 end

• if (expr1) statements1if (expr2) statements2elsif (expr3) statements3end

elsif (expr4) statements4else statements1

end

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

repeat and for StatementsWhen processing fields that contain several values (such as step loops and internal tables), youmust ask the ITS to perform multiple replacements. The repeat and for commands execute aspecific 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.].

Page 37: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Adapting the HTML Code

December 1999 37

Expression EvaluationYou can code standard expressions in HTMLBusiness. The ITS evaluates these expressions whenexecuting your if, repeat, and for statements.

For information on expression syntax, see Expressions [Ext.].

HTMLBusiness FunctionsHTML templates with hardcoded URLs or path names to graphics files may not always workcorrectly when transferred to other systems. HTMLBusiness provides functions that generate URLsand other HTML texts dynamically. You must use these functions to ensure that your templatesare 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/3transaction, 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.Theonly difference between write and simple replacement is that write adds no spaces forseparating individual values.

The writeENC function works similarly, except that the output is coded according to URLrequirements, so that spaces and special characters are replaced with their hexadecimalcode. This function lets you construct URLs correctly from fields that contain spaces andspecial characters.

• wgateURL [Ext.]

This wgateURL function ensures browser independence by generating URLs thatdynamically 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) thatare to be incorporated in the HTML template at runtime. These files are not stored in the ITSdirectory 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 theappropriate function using the Command, ArchiveID and DocID parameters. You can findfurther information about the iXOS archive in the appropriate product documentation.

Page 38: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Quick Guide to the HTML Generator

38 December 1999

Quick Guide to the HTML GeneratorWhen you create HTML templates, the SAP@Web Studio generates HTML code that mimicsyour R/3 screens in an HTML page. The generated code consists of standard HTML code andHTMLBusiness statements.

Of course, the HTML generator cannot always know exactly what logic you require for yourtemplate, so you must modify the generated code to suit your requirements.

The following table summarizes the HTMLBusiness statements required to implement variousscreen or ABAP elements in R/3:

R/3 Element HTML

Function keys Not supported, but you can use the function keys F21 to F24 toimplement 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>

Page 39: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Quick Guide to the HTML Generator

December 1999 39

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 usingtwo 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 tothe wgateURL call, for example: ~target=SUBSCREEN1.

Page 40: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Quick Guide to the HTML Generator

40 December 1999

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 asubscreen frame. For each R/3 group box, the HTML generatorproduced a frame in the base HTML template.

• From Release 4.0, a group box in an R/3 screen has no equivalent inHTML, so no group box is generated.

Dialog boxes Not supported. To implement dialog boxes, you need to set the servicefile parameter ~popups.

Field help (F1) Not supported.

Input help (F4) To implement input help for a field, modify standard HTML using thesearchhelp macro<FORM ACTION=“~wgateUrl()“ METHOD=“POST“>`RMMG1-MATNR.label`<INPUT TYPE=“TEXT“ NAME=“RMMG1-MATNR“

VALUE=“`RMMG1-MATNR`“>`searchhelp(~fieldname=“RMMG1-MATNR“)`

</FORM>

Page 41: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Multiple Language Support

December 1999 41

Multiple Language SupportLike 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 inthe current logon language. The R/3 System also delivers the correct field names on eachscreen and the appropriate translations of numbered text elements.

• When you run a Web transaction, the same applies. At runtime, the Internet TransactionServer (ITS) automatically receives ABAP text elements from R/3 in the correct language anddisplays them in the HTML templates that corresponding to R/3 screens.

However, the R/3 System cannot provide translations for external objects such as pushbuttongraphics, or texts that are hard-coded in HTML templates. Therefore, the Internet TransactionServer (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 themaintenance 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 notfollow 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]

Page 42: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Setting the Logon Language

42 December 1999

Setting the Logon LanguageSince the R/3 System supports multiple languages, a language must be specified as part of thelogon procedure.

When you log on to the R/3 System via the SAP GUI for Windows, you usually have to enter youruser 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 providesimilar logon information, including a logon language.

If you start a Web transaction, the ITS determines the logon language from any of the followingsources:

• In the global service description

You can specify a logon language in the global service description using the ~languageparameter. This value applies to all services unless specifically overridden in a servicefile.

A service description specifying English, for example, would contain the followingexpression:

− ~language=EN

• In the service description for the current service

You can specify a logon language in the service description for the current service usingthe ~language parameter. If you do this, the user cannot choose any other language atruntime. Values in the service file override any value in the global service file, evenbalnak values.

A service description specifying English, for example, would contain the followingexpression:

− ~language=EN

• In the URL

Sometimes the ITS is unable to determine a logon language from either the globalservice description or the service description for the current service. This can happen inthe following cases:

− Neither contains a value for the ~language parameter

− The global service description specifies a value for the ~language parameter, but this isoverridden 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 toenter a language on the logon page.

Regardless of whether the service description specifies a language or not, the ITS always uses avalid language.

Page 43: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Setting the Logon Language

December 1999 43

The language used when the ITS logs on to R/3 is the same language used for all HTMLBusiness

templates belonging to a service. However, you can change this behavior if you wish.

Page 44: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Using Language-Independent Templates

44 December 1999

Using Language-Independent TemplatesLanguage-independent HTML templates work together with language resource files.

Whenever possible, HTML templates should be language-independent, because this reduces themaintenance overhead when you have to make changes. This means that they should contain nolanguage-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 canthen insert placeholders known as resource keys in the HTML template. At runtime, the InternetTransaction Server (ITS) replaces the placeholders with a translation text taken from thelanguage resource file for the logon language. You can use these placeholders for nearly allHTML objects (simple text, URLs, field names, and so on).

The file name of a language-independent HTML template contains no language indicator. Forexample:

sapmaww1_100.html

The file name of a language-specific HTML template contains a language indicator for therelevant 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 nameof the English language resource file for the service aww1 would be:

aww1_e.htrcWhen executing a transaction, the ITS must determine how to handle the language texts for theHTML 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 languageresource file for the current logon language.

Here, the ITS uses language-independent HTML templates in this and all subsequentprocedures.

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 needingtranslation.

For further information about ITS naming conventions, see ITS Naming Conventions [Page 55].

Page 45: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Using Language-Specific Templates

December 1999 45

Using Language-Specific TemplatesLanguage-specific HTML templates can contain any language-specific objects. This includes anyhard-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 therelevant 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. Forexample:

sapmaww1_100.html

A service can contain both language-specific and language-independent templates. Forinformation 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].

Page 46: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Setting Placeholders in Language Resource Files

46 December 1999

Setting Placeholders in Language Resource FilesObjects 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 thedesired text. To differentiate between a normal field reference and a resource key, the resourcekeys (placeholders) are always prefixed with the character #:

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

Page 47: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Web Transaction Programming Tools

December 1999 47

Web Transaction Programming ToolsTo support the implementation of Web transactions, the Internet Transaction Server (ITS)provides the following tools:

• SAP@Web Studio

• HTMLBusiness

• ITS Debugger

SAP@Web StudioThe SAP@Web Studio is a PC tool for creating and maintaining the external componentsrequired by the ITS to run a Web transaction. These external components include:

• Service description

• HTML templates

The Studio’s HTML editor recognizes and compiles HTMLBusiness code, which is the HTMLextension 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 bothR/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. Thesetemplates contain both standard HTML code and HTMLBusiness code.

HTMLBusiness is an SAP’s own extension of standard HTML for handling data transfer between R/3screens and HTML templates. It allows you to merge the data dynamically from an R/3 screenwith fields in the corresponding HTML template.

For further information, see HTMLBusiness Language Reference [Ext.].

ITS DebuggerThe ITS debugger is a tool for analyzing errors in Web transactions. It allows you to establish aparallel connection between a Web transaction and a normal SAPgui. This means that you candisplay the transaction in the Web browser and the SAPgui simultaneously. You can thusactivate the ITS debugger in the SAPgui and use it to analyze the current Web transaction.

For further information, see ITS Debugger [Page 48].

Page 48: Sap Web Transaction Programming

Web Transaction Programming SAP AG

ITS Debugger

48 December 1999

ITS DebuggerWhen you have created or modified all the external components required by the InternetTransaction Server (ITS) to run a Web transaction, you must test these components against thecorresponding R/3 transaction. Several errors can occur outside the R/3 System, and although atransaction 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 separatedebugging tool, but an integration of existing R/3 debugging facilities into the ITS. This integrationis possible because Web transactions are implemented in R/3 using the ABAP Workbench, anddiffer only slightly from standard R/3 transactions. For example, Web transactions do not usesome of the screen elements allowed in standard R/3 screens. Also, you must observe specialdialog control rules when programming Web transactions.

The ITS debugger allows you to establish a parallel connection between a Web transaction andits corresponding R/3 transaction. This means that you can display the transactionsimultaneously in the Web browser and the SAPgui. Effectively, you activate the ABAP debuggerin R/3 and use it to analyze your Web transaction. This way, you can determine whether a Webbrowser 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/3transaction. These templates control how the contents of R/3 fields are converted to HTML anddetermine how user entries are transferred from the Web browser to R/3 screen fields. The ITSdebugger 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 ITSthen acts as a virtual application server. You can log on to ITS using SAPgui and SAPgui willdisplay the current screen of your web transaction (even though you started it from the webbrowser).

When you execute an action in the Web browser that changes the transaction status, the ITSimmediately adapts the SAPgui transaction screen. The following graphic illustrates this process:

Page 49: Sap Web Transaction Programming

SAP AG Web Transaction Programming

ITS Debugger

December 1999 49

Page 50: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Setting Up the ITS Debugger

50 December 1999

Setting Up the ITS DebuggerThe capability for debugging Web transactions using the SAPgui is usually only active in ITSdevelopment systems. In standard ITS installations, the ITS debugger is deactivated.

You activate the ITS debugger in the ITS Administration Tool.

Procedure1. 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].

Page 51: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Starting an ITS Debugger Session

December 1999 51

Starting an ITS Debugger SessionProcedureTo 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 applicationserver.

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 registryentry HKEY_LOCAL_MACHINE\Software\SAP\ITS\Agate\SAPguiDebuggerPort. Thedefault is sapdp00.

The following figure shows an example logon.

Page 52: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Starting an ITS Debugger Session

52 December 1999

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 debuggerhas 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.

Page 53: Sap Web Transaction Programming

SAP AG Web Transaction Programming

Leaving an ITS Debugger Session

December 1999 53

Leaving an ITS Debugger SessionProcedureTo stop the ITS debugger and continue normal processing in the Web browser, deactivate theABAP debugger in the SAPgui.

ResultIn the current ITS version, the SAPgui window closes only after you leave the ITS service in theWeb browser.

Page 54: Sap Web Transaction Programming

Web Transaction Programming SAP AG

Troubleshooting

54 December 1999

TroubleshootingIf you notice that the Web browser and SAPgui transaction screens are displaying differentinformation, you must determine whether the SAPgui is displaying the correct information:

• If the SAPgui transaction screen contains the required information, there is probably an errorin the HTML template.

• If the SAPgui transaction screen contains the wrong information, there is probably an error inthe R/3 transaction.

Page 55: Sap Web Transaction Programming

SAP AG Web Transaction Programming

ITS Naming Conventions

December 1999 55

ITS Naming ConventionsObjects 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 namingconventions

When creating a service, service names must conform to the naming conventionsapplicable to customer systems. From R/3 Release 3.1H, service names should startwith 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 “_”(optional)

1

Language(optional)

1

Language resource Service name 1 - 14

Separator

“_”

1

Language 1

Binary data Any 12