Entering content frame

Background documentation wgateURL Function Locate the document in its SAP Library structure

Purpose

Generates URLs that are compatible with the current Web server.

Syntax

wgateURL(parameter = expression {, parameter = expression})

Parameters

Parameter

Meaning

~OkCode

Function code to be triggered in R/3 transaction.

~target

Name of target frame in a <form> command.

The response to this request appears in the target frame. For full details on using ~target , see Web Browser Independence.

(From ITS 2.2, ~target replaces ~forceTarget .)

~forceTarget

No longer supported.

(From ITS 2.2, use ~target for all browsers.

~FrameName

Determines URL of a frame in a frame set document.

~secure

Specifies whether a relative or absolute URL should be used:

  • If ~secure is not used at all:

wgateURL() creates a relative URL as prior to ITS 2.2.

  • If ~secure="on" :

wgateURL() creates an absolute URL and uses the protocol type HTTPS.

Use this value to switch from HTTP (unsecure) to HTTPS (secure) communication within a session.

  • If ~secure="off" :

wgateURL() creates an absolute URL and uses the protocol type HTTP.

Use this value to switch from HTTPS (secure) to HTTP (unsecure) communication within a session.

Screen field name

Fills screen fields in target frame.

Description

This function dynamically generates URLs that agree with the system information for the current Web server. In this way, you can avoid hard-coding URLs in a template and produce HTML templates that are easily portable between servers.

In addition to including system information (such as the ~state field), the wgateURL function also encodes all parameters according to URL requirements. (For details, see writeEnc Function).

Use wgateURL in the following three cases:

Creating Anchors in the URL

Use the ~anchor parameter to generate an HTML anchor in the wgate URL :

<form method="POST" action="`wgateURL(~anchor="footer")`">

This is expanded to:

<form method="POST" action="/scripts/wgate.dll/vw01#footer">

Examples

The following example illustrates the use of mimeURL .

<ul>
  `repeat with j from 1 to xlist-matnr.dim`
  <li>
    <a href="`wgateURL(matnr=xlist-matnr[j],
                       quantity=xlist-kwmeng[j])`">
    `xlist-matbez[j]` </a> </li>
  `end`
</ul>

This HTML template would be expanded as follows:

<ul>
  <li>
    <a href="http://pn0208/scripts/wgate.dll/vw01?~State=4711&matnr=9132&quantity=2"> Microsoft Word Update
    </a>
  </li>
  <li>
    <a
href="http://pn0208/scripts/wgate.dll/vw01?~State=4711&matnr=9133&quantity=1"> Microsoft Excel Update
    </a>

  </li>
</ul>

Note

Always make sure that the value of href is enclosed in double quotation marks (").

Using the ~secure Parameter

To query whether the current request is using HTTP or HTTPS, you can use the system variable ~http_https .

The following are examples of how to use the ~secure parameter:

The ~secure parameter requires additional information in the service file (<service>.srvc ), usually the global service file global.srvc :

System Parameter

Description

~hostSecure

Host name and domain of the Web server to be used for secure requests (HTTPS).

If not specified, this parameter defaults to ~hostUnsecure .

~portSecure

Port number to be used for secure requests (HTTPS).

If not specified, this parameter defaults to 443 (standard HTTPS port).

~hostUnsecure

Host name and domain of the Web server to be used for unsecure requests (HTTP).

If not specified, this parameter defaults to ~http_host from the current request HTTP header.

~portUnsecure

Port number to be used for unsecure requests (HTTPS).

If not specified, this parameter defaults to 80 (standard HTTP port).

From ITS 2.2, these system parameters are added to the global service file global.srvc .

Leaving content frame