0% found this document useful (0 votes)
4 views8 pages

1 - IDocs

The document provides an overview of IDocs, which are SAP's standard data containers for EDI and application integration, detailing their structure, creation, and processing in SAP S/4HANA and cloud environments. It outlines steps for creating custom IDocs, enhancing standard IDocs, and processing inbound and outbound IDocs, along with advanced topics such as ALE and error handling. Additionally, it includes exercises and code examples for practical implementation.

Uploaded by

lowpriceditbooks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

1 - IDocs

The document provides an overview of IDocs, which are SAP's standard data containers for EDI and application integration, detailing their structure, creation, and processing in SAP S/4HANA and cloud environments. It outlines steps for creating custom IDocs, enhancing standard IDocs, and processing inbound and outbound IDocs, along with advanced topics such as ALE and error handling. Additionally, it includes exercises and code examples for practical implementation.

Uploaded by

lowpriceditbooks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1.

IDocs – Custom IDocs, Enhancement, and Processing in SAP


S/4HANA & SAP on Cloud

What are IDocs?

 IDocs are SAP's standard data containers for EDI (Electronic Data
Interchange) and application integration.

 They act as structured documents for asynchronous data exchange


between SAP systems or SAP and external systems.

 IDocs contain segments (data containers) arranged hierarchically.

 Used in many modules: SD, MM, FI, HR, etc.

 You can create custom IDocs for your own business processes.

 You can enhance standard IDocs to add extra fields.

 You can implement processing logic for inbound and outbound IDocs.

1. IDoc Basics & Terminology

Term Explanation

Intermediate Document, a container for


IDoc
data

Basic Type Defines structure and segments of IDoc

Extension Adds custom fields to standard IDoc

Message
Links business process with IDoc basic type
Type

Segment Part of IDoc representing a logical data unit

Partner Configures communication partners and


Profile processes

Port Defines communication channel for IDocs

Control Contains meta information (sender,


Record receiver, etc)

Data Record Contains actual business data in segments


Term Explanation

2. Custom IDocs: How to Create and Use

Step 1: Define Custom Basic Type

 Transaction WE30 (IDoc Type Development)

 Create a new Basic Type (copy standard or create from scratch)

 Define segments and fields (structure)

 Save and activate

Step 2: Define Segment(s)

 In WE31, create segment structures used inside Basic Type.

 Fields are defined with domain/data element.

Step 3: Create Message Type

 Transaction WE81

 Create new message type (name descriptive)

 Assign Basic Type to message type

Step 4: Create IDoc Extension (If enhancing standard IDoc)

 Use WE30, select standard basic type, create extension

 Add new segments or fields

Step 5: Maintain Distribution Model (If using ALE)

 Transaction BD64

 Assign message type to logical system(s)


Step 6: Configure Partner Profiles & Ports

 Transactions WE20 (partner profiles), WE21 (ports)

 Configure inbound/outbound parameters

3. Enhancements of IDocs

3.1 IDoc Extensions (Standard + Custom Fields)

 Create IDoc extension with extra fields/segments.

 Maintain segments with append structures.

 Use Extension Inbound / Outbound Processing to handle data.

3.2 User Exits and BAdIs for Enhancements

Enhancement Point Usage Transaction

Modify inbound IDoc Include in SAP


USEREXIT_IDOC_INPUT
data program

USEREXIT_IDOC_OUTP Modify outbound IDoc Include in SAP


UT data program

BAdI: Process IDocs


SE18
EDI_PROCESS_IDOC dynamically

Change outbound
BAdI: IDOC_OUTPUT SE18
IDocs

3.3 IDoc Processing Function Modules (Exit Points)

 IDOC_INPUT_<message_type> for inbound processing.

 Create custom processing logic here.

 Call BAPI, update database, validate data.

4. IDoc Processing
4.1 Outbound Processing (Sending IDocs)

 Data preparation program collects data.

 Use function module MASTER_IDOC_DISTRIBUTE to send IDoc.

 Control record & data records created.

 Use transaction WE02/WE05 to monitor IDocs.

4.2 Inbound Processing (Receiving IDocs)

 IDoc received, status updated.

 Inbound function module processes IDoc.

 Custom logic to update database or trigger business logic.

 Status codes 64 = processed successfully, 51 = error.

4.3 IDoc Status Codes Overview

Status
Meaning
Code

01 Created

03 Data passed to port

12 Dispatching

16 Data received

Error during
51
processing

Successfully
64
processed

5. Advanced Topics and Variations


5.1 ALE (Application Link Enabling) and IDocs

 ALE controls IDoc communication between logical systems.

 Uses Distribution Model (BD64).

 Logical systems represent SAP systems or clients.

5.2 Partner Profiles & Ports

 Partner profile configures how IDocs are processed per partner.

 Port defines physical communication (File, tRFC, HTTP, etc).

5.3 IDoc Segments Variations

 Basic Type with fixed or optional segments.

 Nested segments (hierarchy).

 Repeating segments for line items.

5.4 IDoc Monitoring & Error Handling

 Use WE02, WE05 to view IDocs and statuses.

 Use BD87 to reprocess failed IDocs.

 Use logs and trace for troubleshooting.

5.5 XML IDocs and Modern Alternatives

 XML-based IDocs for modern integration.

 SAP PI/PO or CPI can be used to transform and route IDocs.

 Use Web Services or REST APIs as alternative, but IDocs are still widely
used.

6. Code Examples & Exercises


Exercise 1: Create Custom Basic Type and Send IDoc

 Create Basic Type ZCUSTOM_INVOICE

 Define segments HEADER and ITEM

 Create message type ZINVOICE

 Write ABAP program to create and send an IDoc with sample data.

Sample ABAP Code to Create and Send IDoc

abap

CopyEdit

DATA: lv_idoc_control TYPE edidc,

lt_idoc_data TYPE STANDARD TABLE OF edidd,

ls_idoc_data TYPE edidd.

" Prepare control record fields (simplified)

lv_idoc_control-mestyp = 'ZINVOICE'.

lv_idoc_control-idoctyp = 'ZCUSTOM_INVOICE'.

lv_idoc_control-rcvprn = 'LOGICAL_SYS'.

" Prepare data records (header segment)

ls_idoc_data-segnam = 'HEADER'.

ls_idoc_data-sdata = |{ your header data here }|.

APPEND ls_idoc_data TO lt_idoc_data.

" Prepare data records (item segment)

ls_idoc_data-segnam = 'ITEM'.

ls_idoc_data-sdata = |{ your item data here }|.

APPEND ls_idoc_data TO lt_idoc_data.


" Call IDoc creation function module

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = lv_idoc_control

TABLES

communication_idoc_data = lt_idoc_data

EXCEPTIONS

error_error = 1

OTHERS = 2.

IF sy-subrc = 0.

WRITE 'IDoc sent successfully'.

ELSE.

WRITE 'Error sending IDoc'.

ENDIF.

Exercise 2: Implement Inbound IDoc Processing

 Implement function module exit to handle inbound IDocs of message


type ZINVOICE.

 Update custom database table with IDoc data.

 Handle error logging and status updates.

Exercise 3: Enhance Standard IDoc (ORDERS05)

 Create IDoc extension.

 Add custom fields.

 Implement logic in USEREXIT or BAdI to fill and process new fields.


7. Summary Table

Topic Key Points

Structure, Basic Type, Segments, Message


IDoc Basics
Type

Create Basic Types, Segments, Message


Custom IDocs
Types

Enhancements Extensions, User Exits, BAdIs, Append Fields

Inbound/outbound function modules, status


IDoc Processing
codes

ALE and Partner Profiles Logical systems, distribution model, ports

Monitoring & Error


WE02, BD87, logs, retries
Handling

XML IDocs, CPI/PO integration, dynamic


Advanced Variations
segments

Create/send IDoc, inbound processing,


Exercises & Code
enhancement

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy