Skip to content

How to Send SAP ERP Data to a Local Integration Server Without Opening Firewall Ports

Receive SAP ERP outbound IDocs on your local integration server during development by pointing SM59 and WE21 at a Localtonet HTTPS tunnel. No network team involvement required.

Summary in your language
In this article 10 sections
SAP ERP · XML HTTP IDoc · Local Middleware · Authorized Non-Production Testing · 2026

Connect an approved SAP test system to local IDoc middleware while keeping inbound router ports closed

An XML HTTP IDoc receiver does not have to be permanently hosted on public infrastructure, but the SAP system that sends the request must be able to reach it. A Localtonet HTTP tunnel can give an authorized local receiver a public HTTPS address without inbound router port forwarding. The Localtonet client opens an outbound connection to our relay and forwards requests to the local service. This guide covers the receiver, the tunnel, the SAP objects, and verification. It also explains what our platform does with the traffic, including where TLS ends, which tunnel settings add a second access-control layer, and what still requires organizational approval.

📦 XML HTTP IDoc delivery, not tRFC 🔒 Authentication, TLS trust, and data minimization 🌐 Outbound connectivity without inbound port forwarding ⚙️ Local, tunnel, SAP, and middleware verification

Scope: XML HTTP IDoc delivery to a local receiver

SAP ERP sends an XML IDoc through a Localtonet HTTPS tunnel to a loopback receiver without an inbound firewall port.
The public HTTPS endpoint forwards SAP ERP traffic through an outbound tunnel to the local receiver.

This tutorial covers one deliberately narrow workflow: an authorized, non-production SAP ECC or SAP S/4HANA on-premise system sends an outbound IDoc as XML over HTTPS to middleware listening locally on port 3000. A Localtonet HTTP tunnel makes that local HTTP service reachable through an assigned public HTTPS address.

The design does not remove enterprise network controls. The SAP application server must resolve the public hostname and establish an outbound HTTPS connection under the organization’s proxy, firewall, allowlisting, and routing policy. The device running the Localtonet client must also be allowed to establish its outbound connection to the selected Localtonet server. If either outbound path is blocked, the flow will not work.

Middleware also does not inherently need a public URL. If SAP can reach an integration service through a private routed network, an approved reverse proxy, a private cloud connection, or existing enterprise middleware, use that architecture. A temporary public tunnel is most useful when a controlled non-production test requires a callback to a developer workstation, lab device, or local integration server that is not otherwise reachable.

1️⃣ SAP sends outbound HTTPS The SAP system initiates the XML HTTP request to the assigned public endpoint. Outbound DNS, routing, proxy policy, authorization, and TLS trust still apply.
2️⃣ Localtonet terminates TLS and relays TLS for the public address ends at the Localtonet server, which then sends the request through the tunnel. The client maintains an outbound connection, so no inbound router port forwarding or public IP address is required.
3️⃣ The client reaches port 3000 The selected client forwards the request to the configured local IP address and port. The service must be reachable from the device running that client.
4️⃣ The receiver authenticates and validates Middleware verifies credentials, limits the request size, checks the media type, parses XML defensively, records correlation data, and durably accepts the message.

XML HTTP is not tRFC

SAP supports multiple outbound integration mechanisms. An XML HTTP port serializes an IDoc into XML and sends it through an HTTP destination. A transactional RFC port uses SAP’s RFC mechanisms and requires an RFC-capable receiver. A custom ABAP program using a supported HTTP client API is another distinct workflow because the application controls the HTTP method, body, headers, and response handling.

Mechanism Receiver Configuration focus This guide
XML HTTP IDoc HTTP endpoint receiving IDoc XML HTTP destination, XML HTTP port, partner profile Covered
tRFC IDoc RFC-capable integration system RFC destination, transactional RFC port, RFC processing Not covered
Custom ABAP HTTP client Application-specific HTTP API Destination-based HTTP client and custom ABAP logic Only discussed for comparison
SAP S/4HANA Cloud outbound integration Endpoint permitted by a released communication scenario Communication scenario, system, arrangement, authentication, and tenant policy Not configured in this tutorial
Use this pattern only with approval

A public endpoint connected to an ERP test system is still an external integration path. Obtain approval from SAP Basis, ALE or integration owners, information security, data owners, and the network team where required. Do not use production credentials or production business data on a developer workstation.

Prerequisites and ownership

Complete the ownership and technical checks before creating the endpoint. SAP transaction access alone is not sufficient authorization to alter an integration landscape.

Area Requirement Typical owner
SAP scope An authorized non-production ECC or S/4HANA on-premise system whose applicable release supports the selected XML HTTP IDoc workflow SAP Basis and ALE team
SAP access Approved access to the applicable portions of SM59, WE21, WE20, WE19, WE02 or WE05, STRUST, and BD87 SAP security and Basis
Landscape governance An existing approved logical system and partner definition, or a governed decision to create them Basis and landscape management
SAP outbound network SAP application-server access to public DNS and HTTPS on port 443, including any required proxy or destination-host allowlisting, plus the public egress or proxy IP address if you plan to use tunnel IP Restriction Network and security teams
Client outbound network Permission for the device running the Localtonet client to connect outbound to our servers. Under strict firewalls, the tunnel’s Outbound Port setting can fix the ports the app uses for that connection so the network team can approve them. Network team and developer
TLS Trust in the certificate chain Localtonet presents for the tunnel hostname, configured through an appropriate SAP SSL client PSE SAP Basis and PKI team
Data handling Data-owner approval for a path in which TLS ends at the Localtonet server and the request is decrypted there before travelling through the tunnel Data owner and information security
Localtonet A Localtonet account, the client installed on the device and connected with an AuthToken kept secret, a suitable plan, and account balance if you use a custom subdomain or custom domain Developer or integration team
Local receiver Python 3, permission to install packages, and a device on which the Localtonet client can reach TCP port 3000 Developer or middleware team
Test data A sanitized IDoc fixture and an approved WE19 test case containing no unnecessary personal, financial, credential, or regulated data Data owner and integration team

Confirm the SAP release-specific procedure

SAP GUI labels, XML record options, available authentication settings, destination behavior, and IDoc test-tool flow can vary by release and installed components. Before changing SM59, WE21, WE20, or STRUST, the Basis team should validate the procedure against the documentation and configuration standards applicable to that exact system.

This article explains the relationship among the required objects and provides a safe verification sequence. It intentionally does not prescribe an unverified XML record-type selection or assume that every ECC and S/4HANA release presents identical fields.

Do not create a logical system casually

A logical system identifies an SAP system or logical participant in ALE processing. Creating one in BD54 can affect governed landscape definitions and may require client assignment or transport coordination. Reuse the approved logical system designated by the Basis or ALE team. If a new logical system is required, its creation and assignment should be treated as a separate landscape change, not as an incidental troubleshooting step.

Build a hardened local XML receiver

A loopback-only XML receiver validates requests, limits input, records safe logs, and returns an HTTP response.
The local receiver should constrain and validate requests before acknowledging them.

The following Python receiver is a compact non-production reference implementation. It provides authenticated health and IDoc endpoints, limits requests to one MiB, accepts only XML media types, parses XML with defusedxml, avoids logging the payload or authorization header, and writes accepted input to a local inbox before returning success.

One MiB is an example test limit, not a statement about SAP or Localtonet limits. Select an approved limit based on your expected IDoc size and resource controls. A real integration platform should use a durable database, queue, or object store with access control, retention, encryption, monitoring, and backup appropriate to the data classification.

Install the local environment

python -m venv .venv
source .venv/bin/activate
python -m pip install Flask defusedxml

On Windows PowerShell, activate the environment with the script created under .venv\Scripts. Keep dependency versions under your organization’s normal review and pinning process before sharing or automating the project.

Create the receiver

# app.py
import hashlib
import hmac
import os
import re
from pathlib import Path

from defusedxml import ElementTree as SafeET
from flask import Flask, Response, jsonify, request

app = Flask(__name__)
app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024

IDOC_USER = os.environ.get("IDOC_USER", "")
IDOC_PASSWORD = os.environ.get("IDOC_PASSWORD", "")
INBOX = Path(os.environ.get("IDOC_INBOX", "./idoc-inbox"))
ALLOWED_TYPES = {"application/xml", "text/xml"}

if not IDOC_USER or not IDOC_PASSWORD:
    raise RuntimeError("Set IDOC_USER and IDOC_PASSWORD before starting")

INBOX.mkdir(mode=0o700, parents=True, exist_ok=True)

def unauthorized():
    return Response(
        "Authentication required\n",
        401,
        {"WWW-Authenticate": 'Basic realm="SAP IDoc test receiver"'},
    )

def authenticated():
    credentials = request.authorization
    if credentials is None or credentials.type.lower() != "basic":
        return False

    valid_user = hmac.compare_digest(credentials.username or "", IDOC_USER)
    valid_password = hmac.compare_digest(credentials.password or "", IDOC_PASSWORD)
    return valid_user and valid_password

def local_name(tag):
    return tag.rsplit("}", 1)[-1]

def first_element(root, names):
    wanted = set(names)
    for element in root.iter():
        if local_name(element.tag) in wanted:
            return element
    return None

def child_text(element, name):
    if element is None:
        return None

    for child in element.iter():
        if local_name(child.tag) == name and child.text:
            return child.text.strip()
    return None

def inspect_idoc(raw_body):
    root = SafeET.fromstring(raw_body)

    if local_name(root.tag) == "IDOC":
        idoc = root
    else:
        idoc = first_element(root, {"IDOC"})

    if idoc is None:
        raise ValueError("No IDOC element found")

    control = first_element(idoc, {"EDI_DC40", "EDIDC40"})
    if control is None:
        raise ValueError("No supported IDoc control record found")

    document_number = child_text(control, "DOCNUM")
    message_type = child_text(control, "MESTYP")
    basic_type = child_text(control, "IDOCTYP")

    if not message_type or not basic_type:
        raise ValueError("Required control-record identifiers are missing")

    return {
        "document_number": document_number,
        "message_type": message_type,
        "basic_type": basic_type,
    }

def safe_identifier(value):
    cleaned = re.sub(r"[^A-Za-z0-9_.-]", "_", value or "no-docnum")
    return cleaned[:64] or "no-docnum"

def store_once(raw_body, document_number):
    digest = hashlib.sha256(raw_body).hexdigest()
    filename = f"{safe_identifier(document_number)}-{digest}.xml"
    destination = INBOX / filename

    try:
        descriptor = os.open(
            destination,
            os.O_WRONLY | os.O_CREAT | os.O_EXCL,
            0o600,
        )
        with os.fdopen(descriptor, "wb") as output:
            output.write(raw_body)
            output.flush()
            os.fsync(output.fileno())
        return destination, False
    except FileExistsError:
        return destination, True

@app.errorhandler(413)
def request_too_large(_error):
    return jsonify(error="payload_too_large"), 413

@app.route("/health", methods=["GET", "HEAD"])
def health():
    if not authenticated():
        return unauthorized()
    return jsonify(status="ready")

@app.route("/idoc", methods=["GET", "HEAD"])
def idoc_health():
    if not authenticated():
        return unauthorized()
    return jsonify(status="ready", endpoint="idoc")

@app.post("/idoc")
def receive_idoc():
    if not authenticated():
        return unauthorized()

    if request.mimetype not in ALLOWED_TYPES:
        return jsonify(error="unsupported_media_type"), 415

    raw_body = request.get_data(cache=False)
    if not raw_body:
        return jsonify(error="empty_body"), 400

    try:
        metadata = inspect_idoc(raw_body)
        _path, duplicate = store_once(
            raw_body,
            metadata["document_number"],
        )
    except ValueError as error:
        app.logger.warning("Rejected XML: %s", str(error))
        return jsonify(error="invalid_idoc_xml"), 400
    except Exception:
        app.logger.exception("Could not durably accept IDoc")
        return jsonify(error="temporary_receiver_failure"), 503

    app.logger.info(
        "Accepted IDoc docnum=%s message_type=%s basic_type=%s duplicate=%s",
        metadata["document_number"] or "missing",
        metadata["message_type"],
        metadata["basic_type"],
        duplicate,
    )

    return jsonify(
        status="accepted",
        document_number=metadata["document_number"],
        duplicate=duplicate,
    ), 200

if __name__ == "__main__":
    app.run(host="127.0.0.1", port=3000)
Why the parser accepts two control-record names

Common XML IDoc documents use an outer basic-type element, an IDOC child, and an EDI_DC40 control record. Some existing integrations use a different serialized control-record name such as EDIDC40. The example locates the IDOC element under an outer envelope and recognizes both names, but it does not replace release-specific schema validation.

Set credentials without putting them in source code

export IDOC_USER="sap_idoc_test"
export IDOC_PASSWORD="replace-with-a-secret-from-your-approved-secret-store"
export IDOC_INBOX="./idoc-inbox"
python app.py

Do not paste a real password into documentation, source control, shell history, tickets, or screenshots. The environment-variable method keeps the sample readable, but managed deployments should retrieve credentials from an approved secret store and rotate them according to policy.

The Flask development server is suitable only for a controlled local exercise. It is not a production application server. Keep it bound to 127.0.0.1 when the Localtonet client runs on the same machine. If the client runs on another approved device, bind and protect the service according to your local network policy, then use a local IP address reachable from that device.

The receiver serves plain HTTP on the loopback interface. That is intentional: with a Localtonet HTTP tunnel, our server provides the public HTTPS certificate, so the local service can stay on plain HTTP. The TLS consequences of that design are explained in the tunnel section below.

Verify the service locally first

curl -i \
  -u "$IDOC_USER:$IDOC_PASSWORD" \
  http://127.0.0.1:3000/health

Expect a successful HTTP response containing {"status":"ready"}. Resolve local application errors before introducing the tunnel or SAP configuration. This separation makes it much easier to identify which layer is failing.

Create and run the Localtonet HTTP tunnel

With Localtonet, the selected client establishes an outbound connection to our server, and the HTTP tunnel gives the receiver a public HTTPS address. The tunnel forwards requests only while that client is connected and the tunnel is running.

Use the values shown in your own dashboard rather than copying a server region, device token, or public hostname from an article. The Localtonet HTTP tunnel documentation is the canonical companion page for the current interface. The steps below follow its documented flow and labels.

Before you start

The Localtonet client must be installed on the device and connected with an AuthToken. If it is not, follow the Quick start in our documentation first. The receiver should already be running and answering on port 3000, as verified above. A Custom subdomain or Custom domain needs balance on your account, and a Custom domain also needs a domain you added in DNS Manager, as described on the Custom domains documentation page.

1

Open the HTTP page

Open My Tunnels › HTTP and select Create HTTP Tunnel to open the form.

2

Choose the URL type

Select Random subdomain, Custom subdomain, or Custom domain. A Random subdomain such as https://<RANDOM_NAME>.localto.net needs nothing extra. A Custom subdomain needs account balance. A Custom domain needs balance plus a domain added in DNS Manager.

3

Choose the device and the region

In Device token, select the token used by the Localtonet app on the device that can reach the receiver. In Server region, choose a region close to that device for lower latency. Treat the token as a secret and never place it in scripts, screenshots, logs, or SAP configuration.

4

Enter the local address and create the tunnel

Fill in Domain (localto.net or one of your own domains), Subdomain (only for Custom subdomain), Local IP address (127.0.0.1 when the receiver runs on this device; the form accepts an IPv4 or IPv6 address or localhost), and Local port (3000 here; any value from 1 to 65535). Then select Create tunnel. The tunnel appears under Your tunnels as Tunnel # followed by its ID. Creating it does not start it.

5

Start the tunnel

Select the start button in the Actions column. When the tunnel runs, its address in the URL column becomes a link, and requests to that address reach the receiver. If the Localtonet app of that token is offline, a dialog tells you so. Start the app, or select Start anyway and the tunnel goes live when the app connects.

URL type Address you get Needs SAP consideration
Random subdomain A generated name on the selected domain, for example https://<RANDOM_NAME>.localto.net Nothing extra Adequate for a short test. The name is not chosen by you, so it must be recorded in the change record after creation.
Custom subdomain The name you type in Subdomain, for example https://myapp.localto.net. Letters, digits, and hyphens are allowed. Balance A chosen, predictable name that can be submitted for allowlisting before the test window.
Custom domain A domain of your own, selected in Domain Balance and a domain in DNS Manager A name under your organization’s domain, which some network and security teams prefer for outbound approval.

Your public address and how long it lasts

The public address is https:// followed by the host name in the URL column. It has no port number, so it behaves like any other website on the standard HTTPS port. In SAP, that means the SM59 destination uses the host from the URL column with port 443.

Stopping keeps the address; deleting does not

An HTTP tunnel keeps its subdomain until you delete the tunnel. Stopping and starting it does not change the address, so you can stop the tunnel between test sessions without touching the SAP destination. If you delete the tunnel and create a new one, the new tunnel gets a new address, and the SAP destination, the outbound allowlist entry, and the TLS trust review must all be updated through the approved change process. If you need a name you choose rather than a generated one, use a Custom subdomain or Custom domain.

Where TLS ends and what our servers handle

SAP reaches an HTTP tunnel over HTTPS, using a certificate that Localtonet provides and renews. TLS ends at the Localtonet server. From there the request travels through the tunnel to the device, and the Localtonet app passes it to the receiver on 127.0.0.1:3000.

This has a direct consequence for ERP data. With an HTTP tunnel, Localtonet decrypts the traffic at its server before forwarding it. The IDoc body and the HTTP Basic credentials sent by the SAP destination are therefore visible in decrypted form at that point in the path. Data owners and information security must approve this path for the specific test data, which is another reason to use sanitized fixtures.

If policy requires the receiver itself to present its own certificate end to end, an HTTP tunnel is not the right type. Our documentation names the TLS tunnel as the option when a service must present its own certificate. That design changes what SAP must trust and how the receiver is built, and it is outside the scope of this tutorial.

The tunnel setting Is SslStream? tells the Localtonet app to connect to the local service with TLS. It is only relevant when the local receiver itself uses HTTPS, for example a service on https://localhost:5001. The app accepts the local certificate as it is, so a self-signed local certificate works. The sample receiver in this guide serves plain HTTP on loopback, so leave Is SslStream? off. Note that Is SslStream? changes the device-side hop only; it does not change where public TLS ends.

Get data-handling approval before the first real dispatch

Record in the test plan that TLS terminates at the Localtonet server and that traffic is decrypted there. Do not send production data, real personal data, or reused production credentials through the tunnel. If the data classification does not permit this path, use a private network route or evaluate the TLS tunnel option with your security team.

Tunnel settings that matter for an SAP integration

Select the settings button in the Actions column to open the Tunnel settings panel. Under Tunnel Details you can rename the tunnel and change the local IP address and local port. The settings below are the documented options most relevant to a machine-to-machine SAP call. Use only what your test plan needs.

Setting What it does Recommendation for this test
Is Only Https? Serves the public URL over HTTPS only and redirects http:// requests to the same address on https://. While it is off, the address answers on both. Turn it on. The traffic carries credentials and ERP data.
HTTP Timeout Sets how long the server waits for a response from the local application, from 1 to 600 seconds. Size it to the acknowledgment strategy. Durable acceptance needs a short window; synchronous completion needs a longer one.
Basic Authentication? Asks visitors for a username and password at the tunnel edge. Possible second layer, but test its interaction with the receiver’s own Basic authentication first (see below).
IP Restriction Controls which client IP addresses can access the tunnel. Restrict to the SAP egress or proxy public IP address if the network team can confirm it.
SSO Providers Visitors sign in with one of your identity providers before they can open the tunnel. Designed for interactive sign-in. Do not enable it for the SAP destination unless you have verified a non-interactive flow that works.
WAF (Actions column) Opens WAF Setting for the Web Application Firewall and shows whether it is not configured, active, or inactive. Optional. Confirm that configured rules do not block legitimate XML POST requests before relying on it.
Expiration Date, Speed Limits, Bandwidth Limit Stop the tunnel on a date, cap its speed, and cap its data. Set Expiration Date to the end of the approved test window. Use limits as a guard against unexpected volume.
Request Log, Activity Log, Tunnel Health Inspect requests, review starts, stops, and setting changes, and see health checks. Use for verification and troubleshooting. Include any logged request data in the data-handling review.
Outbound Port Uses fixed outbound ports for the Localtonet app’s server connection, for strict firewalls. Use when the network team must approve specific outbound ports for the client device.
Headers Manages custom HTTP request and response headers, including a request header named Host. Only needed if a local server routes by host name. The sample receiver does not.

Layering edge access control with receiver authentication. IP Restriction is the cleanest second layer for a machine caller, because it does not change what SAP sends. Ask the network team for the public IP address that SAP traffic leaves from, which is often an outbound proxy rather than the application server itself, and confirm that it is stable for the test window. Remember that a workstation curl test from a different IP address will then be refused, so add the tester’s address temporarily or test from an approved location. Keep the receiver’s own Basic authentication in place regardless, so that the tunnel is never the only defense.

Tunnel-edge Basic Authentication? and the receiver’s Basic authentication both rely on the HTTP Authorization header, and an SAP destination normally sends one set of credentials. Whether the header used for tunnel-edge authentication is also passed through to the local service is something to verify in your own test before enabling both. If the two layers conflict, prefer IP Restriction at the edge and keep authentication in the receiver.

SSO Providers and the WAF are documented tunnel features, but they are oriented toward visitors using a browser. An XML HTTP port cannot complete an interactive identity-provider sign-in, so treat SSO as unsuitable for this flow unless you have confirmed otherwise. For the WAF, verify with a sanitized fixture that the active rules pass a legitimate IDoc POST.

Some setting changes restart the tunnel

Changing Is SslStream? or Legacy Connect? on a running tunnel restarts it, so the Localtonet app must be connected. Avoid changing them while SAP may be dispatching. Legacy Connect? is only for cases where the tunnel cannot connect with the normal method. A new tunnel also has Is HTTP/3 Active? turned on; our documentation recommends turning it off only if a client has trouble with HTTP/3.

Check the Free plan warning page before SAP testing

An automated XML POST must reach the receiver, not an interstitial

The HTTP tunnel documentation includes a section titled “The warning page on the Free plan”. Read that section and confirm how it applies to your plan before configuring SAP. An SAP XML HTTP port is not a browser user who can click through a page. If an automated POST receives an HTML warning page instead of reaching the receiver, the dispatch can fail or the response can be misread. Confirm from the receiver’s own log, not only from an HTTP status code, that the sanitized fixture actually arrives.

Verify forwarding through the public endpoint

Put the assigned address into a shell variable without adding a trailing slash:

export TUNNEL_BASE_URL="https://your-assigned-address"

curl -i \
  -u "$IDOC_USER:$IDOC_PASSWORD" \
  "$TUNNEL_BASE_URL/health"

This checks public HTTPS routing, tunnel state, local forwarding, and authentication. It does not test SAP or IDoc parsing. Confirm that the response body is the receiver’s JSON rather than an HTML page, and that the request appears in the tunnel’s Request Log and in the receiver’s log. Then confirm that an unauthenticated request returns 401:

curl -i "$TUNNEL_BASE_URL/health"

Configure the SAP XML HTTP path under Basis control

WE21 references an SM59 HTTP destination that directs outbound IDocs to the Localtonet HTTPS endpoint.
The WE21 XML HTTP port uses the SM59 destination for outbound delivery.

The SAP configuration connects several separate concepts. The HTTP destination identifies the remote HTTPS service. The XML HTTP port references the technical delivery path. The partner profile determines which outbound message is sent to which receiver and port. Message type and basic IDoc type are related but are not interchangeable.

Object Purpose Important distinction
Logical system or partner Identifies the governed ALE participant Creation and client assignment belong to landscape governance
HTTP destination Defines the external HTTPS host, port, path, security, and applicable authentication It does not select the business message type
XML HTTP port Defines the IDoc delivery port and references the HTTP destination It is different from a tRFC port
Message type Represents the business meaning of the IDoc message For example, it is not the same field as the basic type
Basic IDoc type Defines the technical segment structure It may be selected separately from the message type
Partner profile Connects partner, outbound message parameters, receiver port, and processing mode Dispatch timing and reprocessing depend on its settings and jobs

1. Prepare the HTTPS destination in SM59

Under the approved change procedure, create or update an HTTP connection to an external server in SM59. Use the host name from the URL column of the running tunnel, HTTPS port 443 (the tunnel address has no port number, so the standard HTTPS port applies), and the receiver path /idoc. Enter the hostname only where the destination expects a host. Do not include the URL scheme in a host-only field.

Configure the authentication method approved for the SAP release and organization. The reference receiver uses HTTP Basic authentication, so the destination must send the matching dedicated username and password. Store those credentials using the facilities approved for the SAP system, restrict who can display or modify the destination, and never reuse an interactive user’s credentials.

Align the destination’s own response timeout with the tunnel’s HTTP Timeout setting. If SAP waits longer than the tunnel does, the tunnel can end the request first; if SAP gives up sooner, the receiver may store an IDoc that SAP then records as failed. Either case makes duplicate handling, covered later, essential.

2. Establish TLS trust through the correct SSL client PSE

The certificate SAP must trust is the one Localtonet presents for the tunnel hostname, because TLS from SAP ends at the Localtonet server rather than at the local receiver. Ask Basis to inspect the chain actually presented by that hostname and establish trust in the appropriate SAP SSL client PSE through STRUST and the organization’s certificate-management process.

Because Localtonet provides and renews this certificate, the leaf certificate will change over time. Follow your PKI policy on which part of the chain to import, and avoid a setup that only works with one specific leaf certificate. If you later switch from a random subdomain to a custom domain, or recreate the tunnel, repeat the review for the new hostname.

Keep peer verification enabled

Do not solve a certificate error by making disabled peer verification the normal configuration. Correct the trust chain, hostname, system time, proxy interception configuration, or PSE selection. Disabling verification removes an essential server-identity check and should not be presented as a routine sandbox shortcut.

3. Test destination connectivity carefully

Save the destination and use the release-appropriate connection test. A connection test is not an IDoc dispatch. Depending on SAP release and destination behavior, it may use a request method or path that differs from the eventual XML POST. The sample receiver supports authenticated GET and HEAD requests on /idoc to make a simple reachability check possible, but do not assume every SM59 test will produce HTTP 200 or a particular log entry.

Treat DNS resolution, TCP connection, TLS negotiation, authentication, and HTTP application response as separate layers. Record the exact SAP error rather than reducing every failure to an endpoint outage. The tunnel’s Request Log helps show whether the test reached our server at all.

4. Create or update the XML HTTP port in WE21

In WE21, work with the XML HTTP port category applicable to the installed SAP release. Assign the approved HTTP destination created in SM59. Have Basis or the ALE owner select any XML record or serialization option based on the sender release and receiver contract. Do not copy a record-type choice from another system without checking compatibility.

Save the port under the organization’s naming and transport rules. Confirm that it is an XML HTTP port rather than a transactional RFC port.

5. Configure the outbound partner parameters in WE20

Select the approved partner profile, commonly a logical-system partner in ALE scenarios. Add or update the outbound parameter for the required business message. Enter the message type in the message-type field and the applicable basic type or extension in its separate field when required by the profile and release. Point the receiver port to the XML HTTP port from WE21.

Select immediate dispatch or background collection only according to the test plan. This choice affects when SAP attempts delivery and how failed or waiting IDocs are handled. Do not assume an HTTP error automatically creates a universal retry schedule. Retry and reprocessing depend on IDoc status, partner-profile processing mode, jobs, and system configuration.

6. Review authorization and change records

Apply least-privilege SAP authorizations to destination maintenance, partner-profile maintenance, test generation, status inspection, reprocessing, and certificate administration. Keep the Localtonet endpoint, tunnel ID, destination name, port name, partner, message type, basic type, test window, tunnel Expiration Date, owner, and cleanup plan in the approved change or test record.

Verify each layer before sending a real test IDoc

A reliable test proceeds from the local service outward. Do not start with WE19 and then troubleshoot every layer at once.

1. Local health verification

Call http://127.0.0.1:3000/health with the dedicated credentials. Confirm that the receiver returns success and that its inbox directory is writable. This proves only that the application is running locally.

2. Public tunnel verification

Call the same health endpoint through the assigned HTTPS address. Confirm that valid credentials succeed, missing or incorrect credentials return 401, and the response is the receiver’s JSON rather than an HTML page. If Is Only Https? is on, a request to http:// should redirect to https://. If IP Restriction is on, confirm that a request from a non-approved address is refused. This proves forwarding and access control, but it is not an IDoc test.

3. Send a sanitized representative XML fixture

Save the following synthetic fixture as test-idoc.xml. It models the common envelope in which a basic-type element contains an IDOC child and an EDI_DC40 control record. It contains no real customer, employee, supplier, financial, or credential data.

<ORDERS05>
  <IDOC BEGIN="1">
    <EDI_DC40 SEGMENT="1">
      <TABNAM>EDI_DC40</TABNAM>
      <DOCNUM>0000000000000001</DOCNUM>
      <IDOCTYP>ORDERS05</IDOCTYP>
      <MESTYP>ORDERS</MESTYP>
      <SNDPOR>SANITIZED_SENDER</SNDPOR>
      <SNDPRT>LS</SNDPRT>
      <SNDPRN>SANITIZED_SENDER</SNDPRN>
      <RCVPOR>SANITIZED_RECEIVER</RCVPOR>
      <RCVPRT>LS</RCVPRT>
      <RCVPRN>SANITIZED_RECEIVER</RCVPRN>
    </EDI_DC40>
    <E1EDK01 SEGMENT="1">
      <CURCY>USD</CURCY>
    </E1EDK01>
  </IDOC>
</ORDERS05>
curl -i \
  -u "$IDOC_USER:$IDOC_PASSWORD" \
  -H "Content-Type: application/xml" \
  --data-binary @test-idoc.xml \
  "$TUNNEL_BASE_URL/idoc"

A successful response should identify the message as accepted. Confirm that exactly one protected file appears in the inbox and that the application log contains only the document number, message type, basic type, and duplicate flag. Sending the identical fixture again should return success with duplicate set to true.

This fixture validates forwarding and minimal parsing only

The fixture is representative, not a complete SAP schema-validation artifact. It does not prove that the receiver supports every segment, namespace, extension, serialization option, or release-specific envelope produced by the target SAP system.

4. Run the SAP destination test

Ask the Basis owner to run the appropriate SM59 connectivity test and inspect its detailed result. A successful connectivity test confirms only the aspects exercised by that test. It does not prove that the partner profile resolves correctly, that an XML IDoc can be serialized, or that downstream middleware processing succeeds.

5. Create an approved WE19 test

WE19 is an IDoc test tool. Under the approved test plan, use a sanitized existing non-production IDoc as a template or use the release-supported method for creating a test document. Review the generated control record, receiver partner, message type, basic type, and port before initiating standard outbound processing.

WE19 behavior and available actions vary across releases. Follow the test procedure approved for the target system rather than assuming that one button sequence applies universally. The test tool may create a new test IDoc and should not be treated as editing the original business document.

6. Inspect status records in WE02 or WE05

Locate the generated IDoc and read its complete status history. Status 03 means that data was passed to the port. It does not prove that middleware completed mapping, database commits, downstream API calls, or business processing.

Do not collapse different statuses into a generic endpoint error. Common outbound meanings include status 02 for an error passing data to the port, status 04 for an error within control information of the EDI subsystem, and status 29 for an error in ALE service. The status message and application log for the applicable release provide the actionable detail. Compare the SAP timestamp with the tunnel’s Request Log and the receiver log to see how far each attempt got.

BD87 is a status-based IDoc reprocessing tool, not simply an outbound queue monitor. Use it only after identifying and correcting the cause, and select the reprocessing action appropriate to that status and system configuration. Reprocessing can create another delivery attempt, so the receiver must tolerate duplicates.

Separate HTTP acceptance from business completion

HTTP acceptance ends at a 2xx response, while parsing, validation, and business processing continue separately.
A successful HTTP response confirms receipt, not completion of downstream business processing.

An HTTP success response has a precise but limited meaning. It should mean that the receiver accepted responsibility for the message according to its documented contract. It should not be interpreted as proof that every downstream system completed processing.

Choose an acknowledgment strategy

Strategy When success is returned Tradeoff
Durable acceptance After authenticated input is validated and committed to a durable inbox or queue Short HTTP transaction that fits comfortably within a modest tunnel HTTP Timeout, with downstream completion tracked separately
Synchronous completion After all required processing and downstream calls finish Simple semantics but greater timeout and partial-failure risk; the tunnel HTTP Timeout (maximum 600 seconds) and the SM59 timeout both bound how long processing may take
Premature acknowledgment Before durable storage or required processing Risks losing a message after SAP has been told it was accepted

The sample uses durable acceptance within the limits of a local filesystem exercise. It writes and synchronizes the file before returning HTTP 200. A production design should define whether success means committed to a queue, inserted into a database transaction, stored in object storage, or fully processed.

The tunnel’s HTTP Timeout setting defines how long our server waits for the receiver to answer, from 1 to 600 seconds. With durable acceptance, the receiver answers in well under a second in normal conditions, so a short timeout limits how long a stuck request holds resources. With synchronous completion, the timeout must exceed the slowest acceptable end-to-end processing time, and a request that hits the limit may have completed in the receiver even though SAP did not see the success response.

Design for duplicate delivery

Networks fail at ambiguous moments. SAP or an operator may retry after the receiver stored an IDoc but before the response was observed, for example when a timeout fires. BD87 reprocessing can also produce another delivery attempt. The middleware should therefore be idempotent.

Use the SAP IDoc document number as correlation data, but do not assume it alone is globally unique across every system and client. A robust key may include the sender system, SAP client, document number, message type, and a payload digest. Decide how to handle the same identifier with different content, and alert rather than silently overwriting it.

Track downstream outcomes independently

Maintain a processing state such as accepted, validating, transformed, delivered, retrying, quarantined, or completed. Record timestamps and sanitized error categories without copying the full business payload into ordinary logs. Operators need to distinguish an SAP transport failure from a middleware transformation failure or a downstream application rejection.

A non-success HTTP response does not by itself guarantee automatic SAP retry. SAP behavior depends on how the XML HTTP port records the result, the resulting IDoc status, partner-profile settings, background jobs, and reprocessing procedures. Confirm those behaviors in the target system and document who is responsible for recovery.

Security, lifecycle, and operational controls

🔑 Protect the device token A Localtonet AuthToken identifies a specific client device. Keep it out of SAP destinations, repositories, command history, screenshots, and support tickets.
🛡️ Layer access controls Keep the receiver’s dedicated Basic authentication, turn on Is Only Https?, and add IP Restriction for the SAP egress address where it is known. Store and rotate secrets through approved SAP and middleware controls.
📋 Minimize and classify test data Prefer synthetic fixtures. TLS ends at the Localtonet server, where HTTP tunnel traffic is decrypted, so representative data needs explicit approval, minimized fields, and the required retention controls.
🧾 Redact operational logs Do not log authorization headers, cookies, complete XML bodies, personal data, payment data, or secrets. Log only the correlation fields needed for support, and include the tunnel Request Log in the data review.
⏱️ Limit the exposure window Start the tunnel for the approved test window, set an Expiration Date so it stops on schedule, and stop it when testing ends. A stopped tunnel no longer forwards requests, yet keeps its address for the next session.
🔍 Monitor every boundary Monitor SAP status records, the tunnel Request Log, Activity Log, and Tunnel Health, HTTP authentication failures, durable-inbox growth, duplicate rates, and downstream processing outcomes.

Outbound allowlisting and proxies

Some SAP landscapes permit HTTPS only through an outbound proxy or to approved destinations. Provide the tunnel hostname, purpose, data classification, owner, and test period to the network team. Because stopping and starting keeps the subdomain, one approval can cover several test sessions on the same tunnel. If the tunnel is deleted and recreated, the new hostname needs the required approval and trust checks again rather than a workaround.

On the client side, the Localtonet app’s own outbound connection may also be subject to strict egress rules. The Outbound Port setting fixes the ports the app uses for its server connection so the network team can approve a known set instead of opening broad egress.

Shutdown and cleanup

1

Stop SAP test dispatch

Confirm that no scheduled job, queued test, or tester will continue sending to the temporary destination.

2

Stop the Localtonet tunnel

Use the stop control in the Actions column after the test window. Stopping keeps the configuration and the subdomain, so the tunnel can be started again for a later approved session without changing SAP.

3

Delete the tunnel if it is no longer needed

Delete temporary tunnel configuration after confirming that the project does not require it. Deleting releases the subdomain; a tunnel created later will have a new address that needs new SAP, allowlist, and TLS approvals.

4

Retire SAP configuration and credentials

Disable or remove temporary destinations, ports, partner parameters, allowlist entries, and credentials according to change-control and retention requirements.

5

Handle stored test data

Reconcile accepted IDocs, preserve only required evidence, securely delete local payloads when retention expires, and close the test record.

Troubleshooting by symptom and layer

Symptom Likely layer What to check
Local health request cannot connect Receiver Process state, bind address, port 3000, local host firewall, and application startup errors
Local health works but public health fails Localtonet Whether the app for the selected Device token is connected, whether the tunnel is running (address shown as a link in the URL column), local IP address and port in Tunnel Details, Tunnel Health, and Activity Log
Tunnel was started while the app was offline and nothing answers Localtonet client With Start anyway, the tunnel goes live only when the app connects. Start the Localtonet app on the device and confirm it stays connected.
Client device cannot keep its connection on a strict network Client outbound network Egress policy for the device, the Outbound Port setting for fixed ports, and, if the normal method still fails, Legacy Connect? (which restarts the tunnel)
Public health works from a workstation but not SAP SAP outbound network or edge restriction DNS resolution, proxy configuration, routing, outbound allowlisting, organizational policy, and whether IP Restriction includes the actual SAP egress or proxy IP address
SAP or curl receives an unexpected HTML response or a non-XML, non-JSON reply Plan behavior or edge control The “warning page on the Free plan” section of the HTTP tunnel documentation and your current plan, whether SSO or WAF is enabled on the tunnel, the Request Log, and whether the request appears in the receiver log at all
SAP reports a TLS handshake or trust error TLS and STRUST The chain Localtonet presents for the tunnel hostname, hostname match, PSE selection, certificate validity after renewal, system time, and TLS inspection policy
Receiver returns HTTP 401 Authentication Dedicated username, password storage, destination authentication settings, rotation state, unexpected proxy changes, and whether tunnel-edge Basic Authentication? is consuming or altering the Authorization header
SM59 test fails but authenticated curl succeeds Test semantics or destination HTTP method, path prefix, port 443, authentication behavior, proxy use, IP Restriction, and release-specific connection-test details
SAP times out, yet the IDoc is in the inbox Timeout alignment Tunnel HTTP Timeout (1 to 600 seconds), the SM59 timeout, receiver processing time, and duplicate handling on retry
Local server answers with the wrong site or an error only through the tunnel Host header The service receives the tunnel hostname as Host. If a local server routes by host name, add a request header named Host with the expected name under Headers in the tunnel settings. The sample Flask receiver does not need this.
Receiver returns HTTP 405 HTTP method mismatch Actual request method and whether the tested route supports it; remember that an IDoc dispatch should use the configured XML HTTP workflow
Receiver returns HTTP 413 Payload policy Actual IDoc size, whether the approved receiver limit should be changed, and any tunnel Bandwidth Limit
Receiver returns HTTP 415 Content type Content-Type header and the serialization produced by the selected SAP configuration
Receiver returns HTTP 400 XML validation Well-formed XML, outer envelope, IDOC element, control-record name, and required MESTYP and IDOCTYP fields
Tunnel stopped unexpectedly at the end of a session Limits and expiration Expiration Date, Bandwidth Limit, and the Activity Log entries for stops and setting changes
SAP IDoc has an error status SAP ALE or port processing Complete status history, status message, partner profile, message type, basic type, receiver port, destination, and application logs
Status 03 appears but downstream data is missing Middleware processing Durable inbox, correlation identifier, processing state, duplicate handling, transformation errors, and downstream response
Duplicate XML files or repeated business action Idempotency Reprocessing history, ambiguous timeouts, deduplication key, payload digest, and downstream idempotency controls

Preserve correlation rather than payloads when gathering evidence. Useful fields include SAP system and client, IDoc document number, message type, basic type, timestamp, HTTP status, tunnel ID and state, and middleware processing identifier. Redact destination credentials, authorization headers, AuthTokens, personal data, and full XML content.

Frequently asked questions

Does this eliminate all firewall requirements?

No. Localtonet avoids inbound router port forwarding because the client establishes an outbound connection to our server. The client still needs permitted outbound connectivity, which the Outbound Port setting can narrow to fixed ports, and SAP must be allowed to resolve and reach the public HTTPS endpoint on port 443. Enterprise proxy, firewall, DNS, TLS, allowlisting, and approval requirements continue to apply.

Is the IDoc encrypted all the way to my local receiver?

Not with an HTTP tunnel. TLS ends at the Localtonet server, which provides and renews the certificate, and Localtonet decrypts the traffic there before sending it through the tunnel to your device. Data owners must approve that path for ERP test data. If the service must present its own certificate end to end, our documentation points to a TLS tunnel instead. Is SslStream? only controls whether the app connects to a local service that itself uses HTTPS.

Does IDoc status 03 prove that middleware completed processing?

No. Status 03 means that data was passed to the port. Downstream completion must be verified through middleware correlation, durable-inbox state, transformation records, and the target system’s processing result. Define and monitor these states separately.

Will SAP automatically retry every HTTP 500 response?

Not as a universal rule. The resulting status and recovery behavior depend on the XML HTTP port, partner-profile processing mode, SAP release, background jobs, and reprocessing configuration. Inspect the status record and use the release-appropriate recovery procedure. BD87 can reprocess eligible IDocs after the cause is corrected, but it is not simply an automatic outbound queue.

Can the same instructions be used for SAP S/4HANA Cloud?

Not automatically. SAP S/4HANA Cloud outbound communication is constrained by released communication scenarios, communication systems, communication arrangements, supported authentication, and tenant policy. Use an external endpoint only when a documented scenario supports it and the tenant administrators approve the destination. The on-premise SM59, WE21, and WE20 procedure in this article should not be applied to S/4HANA Cloud.

Can a custom ABAP program call a local API through the same tunnel?

A custom ABAP application can call an approved public endpoint through a destination-based, release-supported HTTP client API. That is a separate integration design from XML HTTP IDoc delivery. The ABAP team must define request methods, payloads, authentication, timeout behavior, response handling, and application-level retries. Do not assume that every older function-module workflow is interchangeable with an HTTP destination.

How should an SAP TLS certificate error be fixed?

Have Basis inspect the certificate chain that Localtonet presents for the tunnel hostname, since that is where TLS from SAP ends, and establish the required trust in the correct SAP SSL client PSE through STRUST and the organization’s PKI procedure. Localtonet renews that certificate, so avoid trust that depends on one specific leaf certificate. Also verify the hostname, certificate validity, system time, proxy interception behavior, and selected PSE. Keep peer verification enabled rather than using a no-verification setting as the routine remedy.

What happens when the Localtonet client or tunnel stops?

The public tunnel forwards requests only while the selected client is connected and the tunnel is running. Creating a tunnel does not start it, and a tunnel started with Start anyway while the app is offline goes live only when the app connects. If the receiver, client, or tunnel stops during dispatch, inspect the resulting SAP status and recover according to the configured processing and reprocessing procedure.

Can the assigned public address be treated as permanent?

It is stable for the life of the tunnel. An HTTP tunnel keeps its subdomain until you delete the tunnel, and stopping and starting it does not change the address, so the SAP destination can stay in place between test sessions. Deleting the tunnel and creating a new one gives a new address, which then requires updates to the SAP destination, the outbound allowlist, the TLS review, and the test record. If you want a name you choose, use a Custom subdomain, which needs account balance, or a Custom domain, which also needs a domain in DNS Manager.

Should I use the Free plan for SAP testing?

Check first. Our HTTP tunnel documentation has a section on the warning page shown on the Free plan. An automated SAP XML POST cannot click through a page, so read that section and confirm how it applies to your plan before testing. Then verify with a sanitized fixture that requests reach the receiver and that SAP gets the receiver’s response rather than HTML.

Create an approved SAP integration test endpoint

Run and verify your authenticated local receiver first, then create a Localtonet HTTP tunnel for the authorized test window with Is Only Https?, an Expiration Date, and IP Restriction where the SAP egress address is known. Coordinate the SAP destination, XML HTTP port, partner profile, TLS trust, data-handling approval, monitoring, and cleanup with the responsible Basis, ALE, network, and security teams.

Get Started with Localtonet →

Corrections & updates

Substantive changes approved by the Localtonet editorial team are listed transparently below.

Updated the Localtonet tunnel steps to the current dashboard flow and clarified address persistence, TLS termination, access controls, timeouts, and Free plan behavior.

Reviewed and updated for accuracy and completeness.

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

Support