IDoc
ABAP Developmentintermediate

IDoc Part 4: Outbound IDocs, Distribution Model and Reprocessing

Key takeaway

Create and send outbound IDocs: ALE distribution model (BD64) for master data and transactional messages, partner profile outbound parameters (receiver port, basic type, transfer immediately vs collect), MASTER IDOC DISTRIBUTE, status 30/03/02, RSEOUT00 and resending.

Explanation

📌 KEY POINTS
✅ Outbound IDocs are created by applications (output control, change pointers, ALE programs like BD10) or by custom code with MASTER_IDOC_DISTRIBUTE.

✅ The distribution model (BD64) defines which message types go from which sender to which receiver logical system (ALE).

✅ Partner profile outbound parameters define receiver port, basic type and "transfer IDoc immediately" or "collect IDocs" (sent later by RSEOUT00).

⚠️ Status 30 means "ready for dispatch" — the IDoc has not left SAP yet. Status 03 means passed to the port, not that the partner processed it.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Part 3 covered inbound. Now the other direction: SAP sends data.

━━━━━━━━━━━━━━━━━━━━
▶ 1. SOURCES OF OUTBOUND IDOCS

  • Output control (NACE, medium 6 EDI / A ALE): e.g. order confirmation ORDRSP, invoice INVOIC (Part 7).
  • Change pointers for master data (BD21) — Part 7.
  • Direct send programs: BD10 (material), BD12 (customer), BD14 (vendor).
  • Custom programs using MASTER_IDOC_DISTRIBUTE.

━━━━━━━━━━━━━━━━━━━━
▶ 2. DISTRIBUTION MODEL (BD64)

  • Model view with sender logical system, receiver logical system, message types and optional filters (e.g. only plant 1000).
  • Distribute the model to the receiving system; generate partner profiles from it.
  • Required for ALE master data distribution; EDI via output control uses partner profiles only.

━━━━━━━━━━━━━━━━━━━━
▶ 3. PARTNER PROFILE OUTBOUND (WE20)

  • Receiver partner + message type → receiver port (WE21), basic type, output mode: transfer immediately or collect.
  • For output control: message control tab with application, output type and process code (e.g. V1/BA00/SD10).

━━━━━━━━━━━━━━━━━━━━
▶ 4. STATUS SEQUENCE

  • 01 created → 30 ready for dispatch (collected) → 03 passed to port OK.
  • 02 error passing to port (e.g. RFC destination issue) → check SM58 / port.
  • With ALE audit or acknowledgements, 12/41 etc. can confirm receipt/processing.

━━━━━━━━━━━━━━━━━━━━
▶ 5. SENDING AND RESENDING

  • RSEOUT00 sends collected IDocs (status 30) — schedule as job.
  • BD87: process status 30/02 IDocs again after fixing the port.
  • Resending an already sent IDoc: copy via WE19 or trigger the application output again — agree with the receiver to avoid duplicates.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. BD64: display a model view and its message types.
  2. WE20: check outbound parameters for a partner (port, basic type, mode).
  3. Send a material with BD10 in a test system and follow the status in WE02.

✅ CHECKPOINT: you can configure, send and monitor outbound IDocs.

Code example

ABAP Code
* ===== Custom outbound IDoc with MASTER_IDOC_DISTRIBUTE =====REPORT zidoc_send_custom. DATA: ls_control  TYPE edidc,      lt_data     TYPE STANDARD TABLE OF edidd,      ls_data     TYPE edidd,      lt_comm     TYPE STANDARD TABLE OF edidc,      ls_comm     TYPE edidc,      ls_seg      TYPE z1projhdr.            " own segment (WE31) START-OF-SELECTION.* ===== Step 1: control record (receiver determined via partner profile) =====  ls_control-mestyp = 'ZPROJECT'.           " own message type (WE81)  ls_control-idoctp = 'ZPROJECT01'.         " own basic type (WE30)  ls_control-rcvprt = 'LS'.                 " logical system  ls_control-rcvprn = 'EXTSYS_100'. * ===== Step 2: data records =====  ls_seg-projid  = 'PRJ-2026'.  ls_seg-descr   = 'Warehouse extension'.  ls_data-segnam = 'Z1PROJHDR'.  ls_data-sdata  = ls_seg.  APPEND ls_data TO lt_data. * ===== Step 3: create and distribute =====  CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'    EXPORTING      master_idoc_control            = ls_control    TABLES      communication_idoc_control     = lt_comm      master_idoc_data               = lt_data    EXCEPTIONS      error_in_idoc_control          = 1      error_writing_idoc_status      = 2      error_in_idoc_data             = 3      sending_logical_system_unknown = 4      OTHERS                         = 5.   IF sy-subrc <> 0.    ROLLBACK WORK.    WRITE: / 'IDoc creation failed, sy-subrc =', sy-subrc.  ELSE.    COMMIT WORK.                             " IDocs are dispatched after commit    LOOP AT lt_comm INTO ls_comm.      WRITE: / 'IDoc', ls_comm-docnum, 'status', ls_comm-status.    ENDLOOP.  ENDIF. * ===== Send collected IDocs (status 30): program RSEOUT00 as job =====

Real project scenario

Material master changes were not reaching the warehouse system. WE02 showed hundreds of MATMAS IDocs in status 30: the partner profile was set to "collect IDocs", but the RSEOUT00 job had been deleted during a system copy.
After rescheduling RSEOUT00 every 10 minutes and sending the backlog through BD87, the warehouse received the data. The team added "status 30 older than 1 hour" to their IDoc monitoring alerts.

Common mistakes

  • Collect mode without an RSEOUT00 job (IDocs stuck in 30).
  • Missing distribution model entries for ALE message types.
  • Treating status 03 as "processed by receiver".
  • No COMMIT after MASTER_IDOC_DISTRIBUTE.
  • Resending IDocs without agreement (duplicates at receiver).

Best practices

  • Maintain BD64 and generate partner profiles consistently.
  • Choose immediate vs collect deliberately and schedule RSEOUT00.
  • Monitor status 30/02 regularly.
  • Commit after creating custom IDocs.
  • Agree resend procedures with receivers.

Interview angle

Questions: "How are outbound IDocs created?", "What is the distribution model?", "IDocs stuck in status 30 — why?"
Strong answer: output control, change pointers (BD21), send programs (BD10), custom MASTER_IDOC_DISTRIBUTE + COMMIT; BD64 defines sender/receiver/message types for ALE; WE20 outbound: port, basic type, immediate or collect; status 30 waits for RSEOUT00, 03 passed to port, 02 port error; reprocess via BD87.

Practice this lesson

Quick check

1. Outbound IDocs are in status 30. What does this mean?

2. In the ALE distribution model (maintained via BD64), what is the primary function of a 'filter object' attached to a distribution model entry?

3. Distribution model is defined in:

Interview questions

1. When would you still use IDoc instead of OData or modern APIs in S/4HANA?

Answer it in your own words first, then compare.

2. After a system restart, outbound IDocs to a partner stayed in status 30 and 02. How do you recover without sending duplicates?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics