File to IDOC Scenario
In this Scenario:
Get the Vendor Master Data from file and create a Vendor in R/3 System
Perquisites: Try creating a vendor in R/3 using transaction XK01 and get list of mandatory fields to
have the source file structure. Here we are using XI server as File System and IDES as R/3 System.
The IDOC type used is CREMAS04
Exercise Steps:
1. System LandScape (SLD)
2. Integration Builder: Design
3. Integration Builder: Configuration
4. Testing
Step 1: SLD
Create a Product and software Component for File System.
Create a Third Party Technical and Business System for File System.
Create a Web AS ABAP Technical System and Business System for SAP R/3 System
Go the transaction code ‘SXMB_IFR’ and go for System Landsacpe
Under the Software Catalog, you have the option to create the Product and Software Component.
1(a).Select the Product and go for New Product Version as shown in the below screenshot.
Enter the Product Name, Vendor and Version of the Product.
Go for Create
Enter the Non-SAP Software Unit Name and go for Create
1(b). Define your Software Component:
1(c) Create Techinical System:
Go to the SLD homepage by clicking on ‘Home’ in the upper corner
Select the Technical Systems
Go to New Technical System
Since we are creating the Technical System for File System, select the radio-button ‘Third-Party’ and go
to Next
Enter the File System Name and Host Name and go for
Next
Select the Product and Sofware Component and go for Finish
The Technical System(new third party system is created)
Switch over to tab Installed Products of your Technical System: Here you can find your Product and
Software Component
1(d). To Create New Business System:There are two ways of creating business system
1. From SLD Home Page, you can select the Business System and create
2. The below mentioned way is the second way where you can add the business system to your
technical system by Switching over to tab Business Systems of your Technical System. You can
follow either of the ways.
Switch over to tab Business Systems of your Technical System and go for Add New Business
System
Select your Technical System for the business system and provide the logical system name and go for
Next and enter the Business System Name and go for Next
Select you Product and Software Component and go for
Next
Enter the related Integration Server and go for
Finish
As far as now we have created the product, software component , file system’s technical system and
business system
1(e). Create a Web AS ABAP Technical System and Business System for SAP R/3 System :
Go to the SLD homepage by clicking on ‘Home’ in the upper corner
Select the Technical Systems
Go to New Technical System
Since we are creating the Technical System for SAP R/3 System, select the radio-button ‘Web AS ABAP’
and go to Next
Logon to EC6( SAP R/3 System and go to System -> Status and copy the installataion number and
Database Host Name
Note: Please provide the details of your relevant R/3 System not the values mentioned in the screenshot.
If you have any doubt in entering these values you can approach your trainer.
Enter the R/3 System Name. Installation and Database Host Name and go for Next
Enter the Message Server, Port and Central Application Server details and go for Next
Enter
the Application Server Host Name and Instance Number and go for Next
Add the client and the logical client name and go for Next
Select your Product and Software Component and go for finish
1(f).To Create New Business System: Refer to the point 1(d) in the same document
Step 2:
Integration Repository - Design:
Import the Software Component from SLD
Create the Namespace for file to IDOC scenario
Import the IDOC Cremas03
2(a). Import the Software Component from SLD as follows:
Go to Tools-> Transfer from System Landscape Directory->Import Software Component Versions
Select your software component from the list and import
2(b). The newly created SWC should appear in the left frame. Go to your SWC and create new
Namespace
In our scenario we need to have connection with SAP R/3 System to import the IDOC, so while creating
the namespace select the radio button ‘Import of RFC and IDOC Interface from SAP System Permitted’.
Enter the SAP R/3 System details like System, Client, Message Server and Group and SAVE
2(b). To Import the IDOC CREMAS03 from your SAP R/3 System, go to ‘Imported Objects’ in your
Namespace.
Select t ‘IDOCS’ and right click on that
Select the Import from SAP Objects
Enter the details of Application Server, System Number, User Name and Password of the SAP R/3
System and go for continue and Select ‘IDOC’ and
Expand
Search your IDOC CREMAS.CREMAS03 and select it and go for continue and Finish
The IDOC got imported in your Namespace
2(c). Under your namespace in the left frame, expand the node
“Interface objects”
Create new data types.
Right-click on “Data types” and select “New”. First we will create a data type called
“Address_DT”
2(d). In the data type editor, create a structure for the Address with the four
String elements Street, City, Zip, Country, as specified below.
Save the object.
2(e). Now create another data type called “Vendor_DT”. Its structure should be as follows:
Note that the Address_DT type previously created is now referenced from the main data type.
This is called nesting of data types. This is achieved by selecting “Search Help” from the
Drop-down menu in the “Type” column. There you will be able to select any existing data type in the same
SWC.
2(f). Create Message Type
Create a new message type called Vendor. In the left frame, right-click on the node
“Message Types” and select “New”.
The name of the message type will be “Vendor”. Please note that the root element of the
XML business document needs to match the message type exactly (case-sensitive).
For the section “data type used” you can go to the input help (F4) and choose your data
type (Vendor_DT) from there. As an alternative you can also drag and drop the data type
from the left frame (onto the icon with the hand). Make sure that the namespace is filled
in correctly. Save the object.
2(g). Create a “Message Interface” object (from the left frame), called “Vendor_out”. The
interface should be outbound and asynchronous. It should reference your message type
(drag and drop or use F4 help).
Create a graphical mapping between the custom XML message and the IDoc.
2(h). Expand the node “Mapping Objects”. Create a “Message Mapping” object and name it
“Vendor_CREMAS03”.
You are now in the graphical mapping editor. The source message is on the left, the target message on the
right, and the mapping rules at the bottom.
As source message, select your message type “Vendor”. You can choose “Search for Repository object”.
Make sure that you select your own SWC.
There you will be able to find your namespace and message type. Alternatively, you can drag and drop
your message type onto this area of the screen (onto the icon with the hand).
As target message, select the CREMAS.CREMAS03 IDoc. As a reminder, you can find the IDoc under
SWC “Imported Objects”.
2(i). Now that we have defined the source and target message, we can start defining the
Mapping rules.
Note: in order to get a larger working area, you can detach the window by clicking on the thumbnail in
the upper right corner.
Map the fields of the source document to the equivalent fields in the IDoc.
This can be achieved easily by locating the target field in the IDoc structure and then drag-and-drop from
the source field to target field.
Please refer to the table below for the mapping rules (segments and fields are sorted according to their
order of appearance in the IDoc).
Source field in Vendor Target field in CREMAS03
Vendor Number E1LFA1M LIFNR
Address Country E1LFA1M LAND1
Last Name E1LFA1M NAME1
Address City E1LFA1M ORT01
Address Zip E1LFA1M PSTLZ
Search Term E1LFA1M SORTL
Address Street E1LFA1M STRAS
Vendor Number E1LFA1M E1LFB1M LIFNR
Vendor Number E1LFA1M E1LFM1M LIFNR
Currency E1LFA1M E1LFM1M WAERS
This is a good time to save your mapping.
Now we have to assign constants to certain fields and attributes in the IDoc (for segment Qualifiers,
hardcoded values and XML attributes). This can be achieved by following the procedure below.
Double-click on the target field in the IDoc. At the bottom of the screen, select “Constants” from the
drop-down list for function type. Click on the function “Constant”. Now the “empty” constant appears in
the screen.
Double-click on the “empty” constant and assign a specific value.
Connect the constant to the target field.
Constant Target field in CREMAS
1 CREMAS03 IDOC BEGIN
009 E1LFA1M MSGFN
COMPANY E1LFA1M ANRED
LIEF E1LFA1M KTOKK
1 E1LFA1M E1LFB1M SEGMENT
009 E1LFA1M E1LFB1M MSGFN
3000 E1LFA1M E1LFB1M BUKRS
31000 E1LFA1M E1LFB1M AKONT
A1 E1LFA1M E1LFB1M FDGRV
1 E1LFA1M E1LFM1M SEGMENT
009 E1LFA1M E1LFM1M MSGFN
3000 E1LFA1M E1LFM1M EKORG
This is a good time to save your mapping again.
For the segments E1LFB1M and E1LFM1M please assign an empty constant. This is necessary because
these segments are optional in the IDoc.
Although some underlying fields have already been mapped, if the parent node is not explicitly used as
the target of a mapping, the segment will not be instantiated at all.
Finally, right-click on the segment ‘EDI_DC40’ and disable it (this segment is mandatory but will be
filled out automatically by the IDoc adapter).
Save your mapping.
2(j). Now you can test your mapping by selecting the “test” tab.
Fill in the following values in the XML instance and click “execute mapping”. In the
Right-hand side you should see the IDoc populated with the appropriate values.
Note that all optional segments and fields of the IDoc, that were not explicitly mapped, were not
generated.
Vendor Number: 320## (## is your EmpID number)
Last Name <Your choice>
Search Term <Your choice>
Currency USD
Address Street <Your choice>
Address City <Your choice>
Address Zip <Your choice>
Address Country US
Save the source XML instance to the XI server directory. This will be used later as a input file for testing.
Select “Source document view”.
Highlight the entire XML document and copy it to the clipboard.
Open notepad (on the WTS session), paste the clipboard and save the document to a file named
“Vendor##.xml” on your folder “My Documents” on the server:
2(j). Create an “Interface mapping”, named “Vendor_out_CREMAS03”. Assign the following references:
Source interface: Vendor_out (your outbound interface)
Target interface: CREMAS.CREMAS03 (the IDoc from the base SWC)
(Select “Refresh Interfaces” and assign your mapping program)
- Mapping program: Vendor_CREMAS03 (your message mapping)
Follow the below mentioned steps to achieve the interface mapping
Finally, in the left-hand frame, go to your change list and activate it.
Until now we have created the following objects in the Integration Repository:
Data type: Vendor_DT (Vendor data type).
Data type: Address_DT (Nested DT).
Message type: Vendor (Vendor message type).
Message interface: Vendor_out
Message mapping: Vendor_CREMAS03
Interface mapping: Vendor_out_CREMAS03
Step 3: Integration Directory
3.1 From the Integration Builder home page, select “Integration Directory”. This will launch the Java Web
Start application.
Log in with your user ID and password from the Integration Server
3.2 The first step is to create Configuration Scenario Object
3.3 Add your ‘SAP Business System’ to your
scenario
3.4 Go to Service without party” and right-click on “Business System”
Assign Business System…”
3.4 Now create a Communication Channel. The communication channel is essentially the physical
connectivity to/from the application system. This is where the adapter configuration takes place. In this
case we need to configure the file adapter to poll for new files and send them to the Integration Server.
In the wizard, leave the Party name blank and then select your own business system
Uncheck the box “Create Communication Channels Automatically”. This service (business system)
represents the legacy system which will be sending data as XML files.
Note: In case your business system is not listed, a cache refresh is necessary. Close the wizard and use the
menu “Environment / Clear SLD data cache“. Once this is done by any user, the Integration Directory
will fetch all currently available business systems from the SLD.
Now create a communication channel. The communication channel is essentially the physical
connectivity to/from the application system. This is where the adapter configuration takes place. In this
case we need to configure the file adapter to poll for new files and send them to the Integration Server.
Expand your service (Configuration Scenario) and right-click on “Communication
Channel”
“New…” Name your communication channel. For the adapter type, use the F4 help and select “File”.
Specify “Sender” since the adapter will be sending messages to the Integration Server.
Specify the following parameters: - Transport Protocol: File System (NFS) (NFS or FTP could be used).
Message Protocol: File (you can process the file as-is, or convert a flat file to XML).
Adapter Engine: Integration Server (this is where you can choose between the central or local Adapter
Engine).
For the File System Access Parameters, enter the following:
Source Directory:/usr/sap/trans/tmp/group##( path of file )
(Attention: use “/” instead of the backslash “\” used in windows)
File Name: Vendor##.xml
Select File Type “binary”.
Enter the following processing parameters:-
Quality of service: Exactly Once
Poll Interval (secs):60000
(*Note that the poll interval is very high on purpose, in order to keep the amount of messages to a
minimum, for training purposes).
- Processing mode: delete (the file will be deleted after being processed).
The sender file adapter is now configured.
Save your communication channel.
3.5 Receiver system Communication channel: (Select IDOC)
The receiver idoc adapter is now configured.
3.6 Sender Agreement: This defines a binding between the communication channel you just created, and
the outbound interface.
In the left frame, right-click on “Sender Agreement” New
As service, select your business system.(no party).
Select your interface (Vendor_out). Make sure that the correct namespace is utilized.
In the screen “Edit Sender Agreement”, use F4 help for the Sender Communication
Channel field. Select your communication channel
(Save and close)
3.7 From the left frame, create a new “Receiver Determination” object. This is the main part of the
routing process, where you assign a receiver for your message.
Select your sender service and interface
In the “Configured Receivers” area, choose the existing service for the target R/3 system
R3_BACKEND(check with instructor). Save your receiver determination.
Enter the sender file business system and the sender message interface in the above screen
Determine your receiver system
3.8 In the following steps, you will create an “Interface Determination” object. Now that we have defined
a receiver for the message, we need to assign an inbound interface, and an interface mapping (if necessary).
In the receiver determination you just created, have a look below at the area
“Configuration Overview for Receiver Determination” at the bottom of your screen, and hit
Refresh for that the business system you assigned is displayed in that area as well.
In the column “Receiver (Partner/Service)” open the details by using the little triangle.
The entry “Not defined” shows you that there is no interface determination present. Right-click on the
entry “Not Defined” and select “New Specific”, in order to create a new interface determination object.
You are now in the screen “Edit Interface Determination”. In the section “Configured
Inbound Interfaces” select the Inbound Interface CREMAS.CREMAS03 using F4 help. You might need
to select button “All” for the interface
CREMAS.CREMAS03 to show
(Since the software component this interface belongs to may not be assigned to the business system).After
choosingCREMAS.CREMAS03, the inbound interface is shown in the interface determination.
A mapping has to be specified since the sender interface is different from the selected receiver interface.
Use the F4 help next to the Inbound Interface to select your interface mapping.
When you are done, please save the Interface Determination object.
3.9 Define Receiver Agreement
This will allow you to assign a receiver communication channel to the receiver service/interface you have
chosen. Go back to the main screen for your receiver determination.
In the area “Configuration Overview for Receiver Determination” at the bottom of the screen, hit
“Refresh”. In the column “Receiver Agreement (Communication Channel)” right click and select “New
Specific”.
In the screen “Edit Receiver Agreement”, for the field “Receiver Communication Channel” use the input
help (F4), and select the communication channel “IDoc_receiver”. This is a predefined channel which is
used for all inbound IDocs into the R/3 system.
Save the Receiver Agreement.
Go back to the main receiver determination screen and refresh. Now your configuration is complete.
Before activating the objects we need to set up the input file in the next step (indeed, as soon as your
sender communication channel is activated, the polling sequence of the file adapter will start
immediately).
Step 4 – Testing
4.1 Find the file Vendor##.xml which you had previously saved, and copy it to your shared folder group##
on the XI server. Please note, the name of the file should match exactly what you have specified in your
sender communication channel.
4.2 Now you can go back to the Integration Directory, open your change list and activate your objects.
4.3 Monitor your directory. After a few seconds your file
Vendor##.xml should disappear. This means that the file adapter has successfully processed it and the file
was deleted.
4.4 In SAPGUI, choose monitoring Integration Engine monitoring (transaction SXMB_MONI).
4.5 Choose “Monitor for Processed XML Messages”. You can filter using different criteria, for example
by date and also by sender service (find your own business service name in the drop-down list). In the
monitor, your message should appear with a checkered flag (message processed successfully). From there
you can also navigate to the IDoc adapter.
4.6 In the backend R/3 system, go to transactionWE05 or BD87 and search for IDocs according
to the logical system name used by your sender. Verify that your IDoc was posted. If everything goes well,
the IDoc should have status 53 (application document posted). If you expand the status record you will see
the vendor number that was created. Write down the vendor number for future reference.
4.7 Check in transaction MK03 that your vendor was created.