You are on page 1of 14

IDoc to File Scenario

by Neeraja Surapaneni
1 General Requirement
1.1 Introduction
This document describes IDoc to file scenario in which an IDoc from an SAP system is converted into a Flat
File and routed to the FTP Server via Exchange Infrastructure.
A business system representing Sender SAP system sends the IDoc to XI; XI converts the IDoc to Flat File
and sends it to the receiving business system (FTP Server) by using an inbound File adapter.
1.2 Prerequisites:

rd

One Business System representing the sending R/3 is required to be configured of type 3 party in
SLD (System Landscape Directory).
FTP configuration should be in place to transfer the output file to desired location.

2 Configurations at the Sender System (SAP R/3)


This section describes all the configurations needed in the Sender SAP System (R3X) for sending an IDoc
to XIR.
2.1 Create RFC Destination
Use TCode SM59 to create RFC Destination in R3X to connect to XI (XIR) system.
RFC Destination in R3X: R3X_TO_XIR

2.2 Maintain Ports


Use TCode WE21 to create a tRFC Port. The RFC Destination created in the previous step should be
assigned to this port.
Port in R3X: SAPXIR

2.3 Maintain Partner Profile


Create a Partner Profile for the Receiver System (XIRCLNT100) using the T-Code WE20, with the following
outbound parameters.

Message type: MATMAS


IDoc Type: MATMAS05
Receiver port: SAPXIR

2.4 Create Distribution Model (BD64)


Create model view and add Message type with following
Sender System R3XCLNT100
Receiver System XIRCLNT100
Message type - MATMAS
Distribute the Model view.

3 Configurations in the Integration Server


This section gives an overview of all the configurations required in the Integration server. These settings are
required for the XI system to receive the IDoc sent by the Sender SAP system.
3.1 Create RFC Destination
Use TCode SM59 to create an RFC Destination of Type 3 in order to establish communication with the
Sender SAP system.
Sender RFC Destination in XIR: R3XCLNT100

3.2 Create Port


On the Integration Server, create a port for IDoc communication using transaction IDX1.
Ideally, the port name should be of the format SAPxxx, where xxx is the system id of the SAP system. The
created port has to be bind with the RFC Destination of the Sender SAP system configured in the Step 3.1
above.
Sender Port in XIR: SAPR3X

3.3 Transaction IDX2


This configuration step is used to import the metadata of the IDoc using the corresponding Business
systems port as below.

continued..

IDoc to File Scenario


Previous
4 Design the Scenario in the Integration Repository
4.1 Import IDocs
Import the IDoc from the Sender SAP system. Enter the details of the sender system as shown below.
In this scenario, MATMAS.MATMAS05 is the outbound message type.

Select the IDocs which are to be imported

Thus, the IDoc MATMAS.MATMAS05 (sender message type) is imported.


4.2 Define Data Type
Define a Data type resembling the structure of the inbound message (file structure), Data type resembling
outbound structure is not required as Imported IDoc cab be used as Data type, Message type and Message
Interface.

4.3 Define Message Type


Define a Message Type for the Data type created in Section 4.2.

4.4 Define Message Interface


Define Inbound Message Interface for the Message Type created in Section 4.3. as below.

4.5 Create Message Mapping


Create the Message Mapping with Source message as MATMAS.MATMAS05 (Imported from R3X), Target
message as MT_IB_MATMAS (created in section 4.3)

continued..

IDoc to File Scenario


Previous
4.6 Define Interface Mapping
Define Interface Mapping for the Mapping created in Section 4.5

5 Configure the Scenario in Integration Directory


Following objects should be configured in the Integration Directory:
5.1 Assign Business System
A Business System represents the Sender SAP System in the system landscape directory. Assign the
Sender Business System defined in the System Landscape directory in the Integration Directory.

Choose Assign Business System.

Select the Business System corresponding to the Sender SAP System as defined in the System Landscape
Directory and Click Finish (In this scenario R3X is the Sender System and hence is the Business System).

5.2 Create New Business Service


In this scenario the Receiver System is a FTP Server. A Business Service representing the Receiver system
should be created. Choose New Business Service as shown in the screenshot below.

Add the Inbound Message Interface to the Business Service created.


Message interface: MI_IB_MATMAS

5.3 Create Receiver Communication Channel


Create a receiver communication channel (File Adapter) under the Receiver Business Service (File_service).

5.4 Create Receiver Determination


Receiver Determination defines the possible receivers for a sender and an outbound interface combination.
In Conditional Receivers specify a conditional argument whose value will be used to route the inbound
message to the respective Service. Based on the value of a certain field in the incoming IDoc the conditional
argument is evaluated and thus the receiver is determined and message is routed accordingly at runtime.

continued..

IDoc to File Scenario


Previous
5.5 Create Interface Determination
Provide the details Sender Service, inbound interface and the Receiver Service while creating the interface
determinations.

5.6 Create Receiver Agreement


Receiver Agreement defines to which receiver the message, has to be routed.

6. Testing the Scenario


At the Sender system
Go to Transaction BD10, to send the Material from R3X to XIR. An outbound Generic IDoc MATAMS05 is
created in R3X as shown in the below screenshot.

As per the configuration this IDoc will be converted to a flat file and routed to the corresponding Receiver
(/XI_Practice/ folder of the Receiver FTP Server in this case).
At XI System:
A message is created in XI, which indicates the message from R3X has reached XI Integration Server.
Execute transaction SXI_MONITOR in the XI Integration Server as below.

The Processed Successfully Flag indicates that the outbound message (IDoc) has been successfully
processed and it has reached the Receiver FTP system.
At Receiver System (FTP Server):
Log on to the FTP Server of the Host System, to verify the new file.

You might also like