Header image  
COMPLETE SAP NETWEAVER TUTORIALSSITE  
  
 
 
 
 

 
 

Welcome to SAPAG.CO.IN

 

 

 

SAP AG.co in Will Give information of SAP related meterials Like SAP Platform and Operation,,SAP Security , SAP Enterprise Portal (EP), ,SAP Knowledge Management (KW), SAP Business Intelligence (BI), Exchange Infrastructure (XI),Application Server, Mobile (MI), Master Data Management MDM, Composit Appications Frame work,Web Dynpros,OOPABAP,Blog,Intergration Bulder, Integration Repository (IB),Integration Directory (ID).System Landscape Directory (SLD), And Adopter Configuration like File to File,File to JDBC, File to IDoc, File Content Convertion, RFC, HTTP,SOAP,XI Interview Questions,Xi Sertification Questions, and many more about SAP Netweaver Platform XI Training And Tutorial and XI interview Questions ..

 

SAP Exchange Infrastructure Tutorials

SAP XI Exercises File to IDoc

Exercise 1: File sender to IDoc

•  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. Make sure that the namespace is filled in correctly. Save the object.

•  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).

•  Now we will 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, close the section “Interface objects” and expand “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.

•  As target message, select the CREMAS.CREMAS03 IDoc. As a reminder, you can find the IDoc under SWC “ XI RIG US workshop base comp” à “Imported objects”.

•  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

 

 

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

•  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.

•  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

 

 

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

•  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 explicitely 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.

•  Now you can test your mapping by selecting the “test” tab. Select “Generate instance”.

•  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 expliitely mapped, were not generated.

 

VendorNumber

Use the vendor number specified in the exercises overview (Verify with the instructor!)

LastName

<Your choice>

SearchTerm

<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 your desktop. This is the document which you will use later on for testing.

•  Select “Source document view”

•  Highlight the entire XML document

•  Copy and paste to a file on your PC: “VendorXX.xml”

•  Now create an object of type “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)

•  Mapping program: Vendor_CREMAS03 (your message mapping)

2.13 Finally, in the left-hand frame, go to your change list and activate it.

Step 3 – Directory

•  From the Integration Builder home page, select “Integration Directory”

•  The first step is to create a scenario object. This will serve as container for all your configuration work in the following exercises. Create a new scenario called “xiworkshop_group[XX]”.

•  Expand “Service without party” and right-click on “Business System” à Assign Business System.

•  In the wizard, leave the Party name blank and then select your own business system (XIWS_legacy_BS_XX). Uncheck the box “Create Communication Channels Automatically”. This service (business system) represents the legacy system which will be sending data as XML files.

•  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 and right-click on “communication channel” à New. Name your communication channel “File_sender”.

 

•  For the adapter type, use the F4 help and select “File”.

•  Specify “Sender” since the adapter will be sending messages to the IS.

•  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 (you can use the central or decentral AE).

3.5.5 For the File System Access Parameters, enter the following:

•  Source Directory: D:/workshop/group[XX] (this is your shared directory on the server)

•  File Name: Vendor[XX].xml

•  Select File Type “binary”.

•  Enter the following processing parameters:

•  Quality of service: Exactly Once

•  Poll Interval (secs): 600000 (please use a very high poll interval for test/training purposes).

Previous Next

 

 

 

 

 

 Back to SAP XI Tutorials


 
Latest SAP Netweaveer Books