Lesson 3 of 6
Extension types in WE30
7 min
Listen to this lesson
A segment on its own goes nowhere. To use it, you append it to an SAP basic type through an extension (older documentation calls it an enhancement or extension type). The basic type plus the extension together form the IDoc type that partners receive. You build extensions in the IDoc type editor, WE30, choosing Extension rather than Basic type.
Building the extension
- In WE30, select Extension, enter a name in the customer namespace, for example
ZCMCINV1, and choose Create. - Link it to the basic type it extends,
INVOIC02, and give it a description such as "Contoso core return data on invoice items". - SAP shows the basic type's segment tree. Select the reference segment, here
E1EDP01(invoice item), and appendZ1CMCCOREas its child. - Set the occurrence: minimum 0 (optional, because many invoice items have no core agreement) and maximum 1 per item.
- Check the extension for consistency, save it on the same transport as the segment, and release it once tests pass.
Extensions attach to reference segments of the basic type. Because SAP never removes segments from a released basic type, the parent you hang your segment on will still be there in future releases. That is the core of the upward compatibility SAP's documentation describes, and the reason an extension is preferred over copying the basic type into a new custom basic type.
Extension or new basic type?
| Option | When it fits | Main cost |
|---|---|---|
| Extension of an SAP basic type | You need extra data in an SAP business message (invoice, order, delivery) | Exit code to fill or read the segment; SAP processing stays standard |
| Copy of a basic type as a Z basic type | Rarely justified; avoid | You own the whole structure and lose SAP's improvements to the original |
| New custom basic type | A message with no SAP counterpart, for example a custom object distributed by ALE | Own processing code end to end |
Naming, versions and limits
Keep extension names short and meaningful, with a version digit at the end, because a later change usually means a new extension rather than an edited one once partners rely on it. One extension extends one basic type. If both Great Lakes and another fleet customer need different custom data on invoices, consider whether one shared extension with optional segments can serve both; every additional extension is another IDoc type to document, map and test.
Extensions can only add segments. You cannot change fields of SAP segments, change SAP occurrence rules, or remove segments. If a partner needs a longer field than the SAP segment offers, the extra data goes into a custom segment, not into a modified SAP segment.
- Do you need to change an SAP segment's fields?Yes → not possible; add a custom segment instead · No → continue
- Does the data belong to an existing SAP segment level?Yes → append under that reference segment · No → append under the header
- Can the segment be missing for some items?Yes → minimum occurrence 0 · No → minimum 1, and the exit must always fill it
- Will partners rely on it?Yes → release before go-live, version the name · No → keep it unreleased while prototyping in CMD only
Hierarchy in the data records
In the IDoc's data records, every segment carries its hierarchy level and the number of its parent segment. Because Z1CMCCORE is defined as a child of E1EDP01 in the extension, SAP knows that each Z1CMCCORE belongs to the item segment immediately before it. Middleware and partner translators rely on the same hierarchy: Process Orchestration reads Z1CMCCORE as a child node of the E1EDP01 node in the IDoc XML, so the mapping can place the core agreement reference in the correct 810 item loop. If the exit appends the segment after the wrong item, the reference lands on the wrong invoice line, and only a content check catches it.
Inbound extensions
Extensions work the same way for inbound IDocs. If a customer sent a value in its 850 that no ORDERS05 segment carries, the middleware would fill a custom segment in an extension of ORDERS05, the inbound partner profile would name the extension, WE57 would register the inbound function module for it, and an inbound exit would read the segment and move the value into the sales order. The structure work is identical; only the direction of the exit code changes.
- Build extensions in WE30 by appending custom segments under reference segments of an SAP basic type.
- Basic type plus extension is the IDoc type partners receive; extensions only add segments.
- Set occurrences deliberately: optional data gets minimum 0.
- Prefer extensions to copied basic types; release before partners rely on them.
Check your understanding · not graded
Lesson check
1. Which transaction builds an extension of INVOIC02?
2. What can an extension NOT do?
3. Why is an extension preferred to copying INVOIC02 into a Z basic type?