SAP transaction codeObjectWE21ModuleBTP_INTEGRATION

WE21 — Port Definition for IDoc Interfaces

WE21 maintains ports, the technical channel an IDoc travels through: transactional RFC, file, ABAP-PI, or XML/HTTP. The port itself carries no business meaning; it only becomes active once a partner profile in WE20 references it. Most 'port' problems are really partner profile or RFC destination problems being surfaced through the port screen.

WE21 defines the physical or logical channel an IDoc uses to leave or enter the system: an RFC destination, a file path, or an XML/HTTP endpoint. This page covers the entry sequence, the tables the save touches, and the diagnostic order for the recurring failures around missing ports, broken file paths, and stale RFC destinations.

Reviewed by an ERPClimb SAP consultant on 15 Sept 2026· 1,252 words

Purpose

WE21 creates and maintains ports, the technical definition of where an IDoc goes physically once it leaves ALE processing, or where it is expected to arrive from. A port has a type (transactional RFC, file, ABAP-PI, Internet/XML) and, depending on type, a target RFC destination or a file directory and naming convention. The structural fact that causes most confusion: a port is purely a transport-layer definition. It does not know which message type, partner, or direction it serves. That binding happens in the partner profile (WE20), which points at a port by name. Consultants who edit a port expecting to change routing for a specific interface are often editing something shared by several unrelated partner profiles, and the fix intended for one interface silently breaks another.

When it is used

WE21 is reached during initial ALE or EDI setup, when a new outbound or inbound IDoc interface is being wired to a target system, a third party via file exchange, or a middleware layer such as PI/PO acting as the tRFC or XML endpoint. It sits upstream of WE20: the port must exist before a partner profile can reference it. Consultants reach for WE21 specifically when an interface fails with a port-related error, when a new environment (QA, a new partner, a new middleware instance) needs its own destination, or when a file-based interface changes its drop directory. For interfaces built through SAP Cloud Integration or an API-based connection rather than classic IDoc/ALE, WE21 is irrelevant; it belongs to the IDoc transport layer, not to proxy or REST-based integration.

How to use it in practice

  • Open WE21 and select the port type node: Transactional RFC, File, ABAP-PI, or Internet (XML/HTTP)
  • Choose Create, and either accept the system-generated port name or assign a meaningful custom name (recommended in a multi-interface landscape)
  • For tRFC or ABAP-PI ports, enter the RFC destination that must already exist and be tested in SM59
  • For file ports, define the outbound file name/path, inbound file name/path, and the physical directory or logical file path variant, matching the target operating system's separators
  • Save, then confirm the port appears correctly typed under its node before linking it in a partner profile via WE20
  • Test the interface end to end, not just the port in isolation, since a syntactically valid port can still point at a dead destination

Key data objects

  • EDIPORT - the port master record: port name, port type, and, for file ports, the outbound/inbound file naming and path parameters
  • RFCDES - the RFC destination referenced by transactional RFC and ABAP-PI ports; WE21 does not create this record, it only stores a reference to it
  • EDIDC - not written by WE21 directly, but every IDoc control record processed through the port carries the port name in its header, which is the practical link back to WE21 configuration

How to prove it in the data

Start in SE16 on EDIPORT filtered by the port name in question; confirm the port type and, for file ports, the exact outbound and inbound path strings including trailing separators. If the port is tRFC or ABAP-PI, take the RFC destination name from that record into SM59 and confirm the destination is active, points at the intended target host, and authenticates successfully. To confirm which interfaces use a given port, filter EDIDC (the IDoc control table) by the port name field and status, and check whether stuck IDocs cluster on one port versus many, which indicates a port-level problem rather than a data problem.

ECC vs S/4HANA

WE21 is unchanged on S/4HANA; it remains part of the classic ALE/IDoc configuration layer and has no Fiori equivalent, because it is infrastructure configuration rather than a business transaction. What has changed is how often it gets used: newer integration scenarios built on SAP Cloud Integration or API-based connections bypass ports entirely, but WE21 remains relevant wherever an S/4HANA system still exchanges IDocs with a middleware layer, a legacy partner, or a file-based interface, including hybrid landscapes that bridge classic IDoc traffic into cloud integration flows.

Common pitfalls and how to diagnose them

  • Port not found or mismatched type: a partner profile in WE20 references a port name that no longer exists, was deleted, or was recreated with a different type (file instead of tRFC). Check WE20 first to see which port name the failing message type actually expects, then confirm that exact port exists in WE21 with a matching type, before touching anything else.
  • File port path problems: the outbound or inbound directory does not exist or is not writable on the application server, the path uses the wrong OS separator for a Unix target when maintained from a Windows-minded consultant, or two interfaces share a directory and overwrite each other's files. Confirm the directory exists on the actual application server instance handling the job, not just the central instance, since file systems can differ across servers in a landscape.
  • Stale or environment-mismatched RFC destination: the port's RFC destination was copied from production into QA without updating the target system ID, or credentials in SM59 expired. This shows as IDocs stuck at a dispatch status with a connection error, not a data error, and no amount of IDoc reprocessing fixes it until SM59 is corrected.
  • Port name duplication across systems: ports created manually and inconsistently in DEV, QA, and PROD rather than transported, so the same logical interface has different port names or parameters per system. This surfaces as 'works in QA, fails in PROD' with no code difference; the fix is aligning port configuration across the landscape, not patching the receiving program.
  • Treating the port as the root cause when it is a passthrough: recreating a port under a new name to 'fix' an interface, when the real fault is the partner profile's message type assignment or the receiving system's IDoc posting configuration, multiplies the number of ports to maintain without resolving anything.

Whose problem this is

Ownership splits by port type. File port directories and Basis-level connectivity belong to Basis; the RFC destination's technical health (SM59) is also Basis, though its business meaning belongs to the integration consultant. The functional or integration consultant owns which port a partner profile should reference and why. A clean handover names the exact port, its type, the RFC destination or file path it resolves to, and which partner profile and message type depend on it, so Basis is not left guessing which of several ports is safe to change.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-tcodes/we21ERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.