Integration Repository: Unit Summary
Exercise 1: File sender to IDoc Part 2: Integration Repository Exercise steps
Step 1 – System Landscape Directory Step 2 – Integration Repository Step 3 – Integration Directory Step 4 – Testing
Step 2 – Repository
2.1 From the Integration Builder home page, select “Integration Repository”. This will launch the Java Web Start application. Log in with your user ID and password from the Integration Server (abap client 800).
2.2 In the left-hand frame, find the software component “TBIT40_BASE_COMP” and expand it. In the section “imported objects” you will find the IDoc CREMAS.CREMAS03. Double-click on it and inspect the IDoc metadata.
2.3 From the “tools” menu, select “Transfer from system landscape directory” Æ “import software component versions”.
2.4 From the list of software component versions, select your own software component created in the SLD (TBIT40_WORKSHOP##). Click “Import”.
(After the import, close the import window.)
2.5 The newly created SWC should appear in the left frame. Open the SWC and then double-click on the version. This will bring up the SWC version screen in the right frame.
03 - IntegrationRepositoryEx - File to IDoc2.doc 2
2.7 Under your namespace in the left frame, expand the node “Interface objects”.
2.8 Create new data types.
2.8.1 Right-click on “Data types” and select “New”. First we will create a data type called
“Address_DT”.
2.8.2 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.8.3 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 datatypes. 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.9 Create a new message type called Vendor
2.9.1 In the left frame, right-click on the node “Message Types” and select “New”.
2.9.2 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).
2.9.3 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.10 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).
2.11 Create a graphical mapping between the custom XML message and the IDoc.
(Note: The complete mapping rules are available at the end of this document.)
In the left frame, expand “Mapping Objects”. Create a “Message Mapping” object and
03 - IntegrationRepositoryEx - File to IDoc2.doc 4
2.11.3 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.
2.11.4 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
VendorNumber E1LFA1M Æ LIFNR
Address Æ Country E1LFA1M Æ LAND1
LastName E1LFA1M Æ NAME1
Address Æ City E1LFA1M Æ ORT01 Address Æ Zip E1LFA1M Æ PSTLZ
SearchTerm E1LFA1M Æ SORTL
Address Æ Street E1LFA1M Æ STRAS
VendorNumber E1LFA1M Æ E1LFB1M Æ LIFNR
VendorNumber E1LFA1M Æ E1LFM1M Æ LIFNR
Currency E1LFA1M Æ E1LFM1M Æ WAERS
This is a good time to save your mapping.
2.11.5 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. Refer to the table below for more details on the mapping rules.
2.11.5.1 Double-click on the target field in the IDoc.
2.11.5.2 At the bottom of the screen, select “Constants” from the drop-down list for function type.
2.11.5.3 Click on the function “Constant”. Now the “empty” constant appears in the screen.
2.11.5.4 Double-click on the “empty” constant and assign a specific value.
2.11.5.5 Connect the constant to the target field.
Constant Target field in CREMAS
1 CREMAS03 Æ IDOC Æ BEGIN
1 E1LFA1M Æ SEGMENT
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.
2.11.6 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.
2.11.7 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.
03 - IntegrationRepositoryEx - File to IDoc2.doc 6
2.11.8 Now you can test your mapping by selecting the “test” tab.
2.11.9 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.
VendorNumber 320## (## is your group number)
LastName <Your choice>
SearchTerm <Your choice>
Currency USD
Address Æ Street <Your choice>
Address Æ City <Your choice>
Address Æ Zip <Your choice>
Address Æ Country US
2.11.10 Save the source XML instance to the XI server directory. This is the document which you will use later on for testing.
2.11.10.1 Select “Source document view”.
2.11.10.2 Highlight the entire XML document and copy it to the clipboard.
2.11.10.3 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:
03 - IntegrationRepositoryEx - File to IDoc2.doc 8
Appendix: naming conventions and terminology Exercise 1 (replace ## with your group number)
Area Obj. type Object name Description
Int. Repository Namespace urn:tbit40:workshop:group##:legacy Namespace for legacy objects
Data type Vendor_DT Vendor data type
Data type Address_DT Nested DT
Message type Vendor Vendor message type
Message interface Vendor_out Message interface
Message mapping Vendor_CREMAS03 Message mapping
Interface mapping Vendor_out_CREMAS03 Interface mapping
Transformation rules for Vendor Æ CREMAS03 mapping
(you can create such a list in your message mapping with icon “Text preview” ):
/CREMAS03/IDOC/@BEGIN=Constant([value=1])
© SAP AG TBIT40 4 - 1