从ftp读取一个供应商数据文件,PI将其转换为IDOC并上传ECC创建供应商,上传后将此文件删除。
Brief Overview:
The purpose of thisexercise is to implement a simple one way Asynchronous link between a filesender and SAP R/3 system using SAP XI/PI. Custom XML Document ContainingVendor information is picked up from the FTP server by file adapter. TheMessage is mapped to IDoc –XML format & then routed to the IDoc adapter.The CREMAS IDoc is then posted into the backend R/3 System and vendor will becreated by the R/3 system provided that it has authorization to do so.
Prerequisites:
1. Basic Knowledge of SAP PI/ XI 7.0
2. Business Systemconfiguration in SLD is not covered in detail.
3. FTP configuration shouldbe in place to pick up flat file from specified location
4. Try creating a vendor inR/3 using transaction XK01 and get list of mandatory fields that are necessaryin the source file structure
ImplementationSteps:
A.) Maintain XI/PI System (Pick File – Transform into IDocxml)
A.1) Maintain SLD (SystemLandscape Directory)
This Document does notcontain configuration steps for creating the Business System, Technical system,Product & Software component. It is assumed that the sender and receiverBusiness Systems are already created along with corresponding Technical System,Product, Software components. Also the Software Component is imported intoIntegration Repository.
In thisExample,
Sender Business System: TBIT40_Legacy_BS_DS
Receiver Business System: CX1_Business_System
Software Component: TBIT40_DS_SWCW, 1.0 ofSAP
A.2) Maintain IR(Integration Repository)
A.2.1 Importing IDoc fromSAP R/3 System
Double Click on yourSoftware Component in the Integration Repository.
Select the radio Button “Import of RFC and IDocinterfaces from SAP system Permitted”
Enter the Connection Datafor Import from SAP System
Add a new Namespace “http://sdht1.com”.
Click on SAVE & Activate.
Now right click onImported Object under your Software Component and click on Import of SAPObjects.
Give the relevant SenderSystem information
Select the IDoc CREMAS03and click continue
Click finish to startimport. Once the IDoc is successfully imported save & activate it.
Note: We don’t need any Data Type,Message Type and Message Interface for Receiver side as IDoc itself will beused for receiver Data Type, Message Type and Message Interface.
A.2.2 Create DataType for Sender:
Go to Interface Objectstab in your namespace.
Go to Data type and Clickon new
Here we will create adata type Address_DT and Vendor_DT.
Address_DT will be referred as type forone of the field in the Vendor_DT.
This is called as Nestingof Data types.
This is achieved bySelecting “Search Help” from the Drop downmenu. There you will be able to select any existing data type in the SAME SoftwareComponent
The Structure of Bothdata types are as follows
A.2.3 Create MessageType for Sender:
In the Left Frame,Right Click on the Node Message type and select “New”.
The Name of the Messagetype will be “Vendor”.
Note: Message type formsthe root element of the XML business Document.
For section “data type used”, select your data type “Vendor_ DT” from F4 help.
Save &activate.
A.2.3 Create MessageInterface for Receiver:
In the Left Frame, RightClick on the Node Message Interface and select “New”
The Name of the MessageInterface will be “Vendor_out”.
The Interface Shouldbe OUTBOUND & ASYNCHRONOUS
It should Reference themessage type “Vendor_MT”
Save & activate.
A.2.3 Create MessageMapping:
Create a graphicalmapping between the Custom XML message & IDoc CREMAS03
In the left frame, rightclick on the Message Mapping under “Message objects”tab and select “new”.
The Name of the MessageMapping will be “Vendor_CREMA03”.
Source message “Vendor”
Target message “CREMAS.CREMAS03”.
Perform the Mapping ofeach target field with suitable source fields as per your requirements.
Save & activate.
A.2.3 CreateInterface Mapping:
Now Create the InterfaceMapping “Vendor_out_CREMAS03”
In the left frame, rightclick on the Interface Mapping under “Message objects”tab and select “new”.
Source Interface: “Vendor_out”
Target Interface: “CREMAS.CREMAS03”
Mapping Program: “Vendor_CREMA03”
Save &activate
A.3) Create RFCDestination in XI system pointing to Receiver R/3 System
Create a RFCdestination RFC_CX1 of type 3(ABAP connection) inthe sender XI system, pointing to receiver R/3 System.
This RFC Destination willbe used to remotely logon to receiver system so as to post IDoc into receiverR/3 system.
A.3) Create RFC Port forthe RFC Destination created above
Go to Transaction IDX1and create a RFC port “SAPCX1” for the RFC destination“RFC_CX1” created above.
A.4) Maintain ID(Integration Directory)
A.4.1 CreateConfiguration Scenario
Open IntegrationDirectory
Create a newConfiguration Scenario or use an existing one. In our example scenario “TBIT40_WORKSHOP_SD” will contain all ourscenario objects.
A.4.2 Add Sender andreceiver Business System.
Add sender and receiverbusiness System in your Configuration scenario
Please verify that theAdapter specific parameters for both these Sender & receiver System arefilled in properly.
A.4.3 Create SenderCommunication Channel
Go to your SenderBusiness System, right click on communication channel and select “new”.
Create a new receivercommunication channel “File_Sender_DS1”.
Select the SenderRadio button to identify the channel as sender.
Adapter type: File
Transport Protocol: FileTransfer Protocol (FTP)
Message Protocol: File
Adapter Engine: IntegrationServer.
Source Directory: /XMLFiles
File name: Vendor_DS.xml
Provide Your FTP serverDetails
Quality of service: Exactlyonce
Poll interval(secs.): 60
Processing Mode: Delete
Save & activate.
A.4.4 CreateReceiver Communication Channel.
Go to your ReceiverBusiness System, right click on communication channel and select “new”.
Create a new receivercommunication channel “IDoc_rcv”.
Select the ReceiverRadio button to identify the channel as receiver.
Adapter type: IDoc
Transport Protocol: IDoc
Message Protocol: IDoc
Adapter Engine: IntegrationServer.
RFC Destination: RFC_CX1
Interface version: SAPRelease 4.0 or higher
Port: SAPCX1
Save &activate.
A.4.5 CreateReceiver Determination.
Create a new ReceiverDetermination.
Sender service: TBIT40_Legacy_BS_DS
Interface: Vendor_out
Namespace: http://sdht1.com
Note: If you are notable to see your sender interface when you click F4, then Select “ALL” under InterfaceSelection option.
Enter your receiverbusiness system “CX1_Business_System”. Save.
A.4.6 CreateInterface Determination.
Create a new InterfaceDetermination.
Sender service: “TBIT40_Legacy_BS_DS”
Interface: “Vendor_out”
Namespace: http://sdht1.com
Inbound Interface: “CREMAS.CREMAS03”
Namespace: “urn:sap-com:document:sap:idoc:messages”
Interface mapping: “Vendor_out_CREMAS03”
Save &activate
A.4.7 CreateReceiver Agreement.
Sender service: “TBIT40_Legacy_BS_DS”
Receiver service: “CX1_Business_System”
Inbound Interface: “CREMAS.CREMAS03”
Namespace: “urn:sap-com:document:sap:idoc:messages”
Select the ReceiverCommunication Channel “IDoc_rcv” created above.
Save &activate.
A.4.8 CreateSender Agreement
Sender service: “TBIT40_Legacy_BS_DS”
Interface: “Vendor_out”
Namespace: http://sdht1.com
Select the senderCommunication channel “File_Sender_DS1” created above.
B.) Maintain R/3 Receiver System (For receiving IDoc from XI)
B.1) Create LogicalSystem (LS) for IDoc Sender System:
Go to Transaction BD54
Click on New EntriesButton
Enter Logical System Nameof your Receiver Business System (WESS in this example)
Now click on save. Hereone window may appear (if so) just click on continue. Now the Logical System(LS) is ready
B.2)Create Partner Profile with Inbound Parameter.
Maintain the PartnerProfile for Sender File System and add the inbound parameter as follows:
Go to Transaction WE20
Select Partner Type LSfrom Partner (left tree panel)
Click on Create Button
Enter Logical System Namewhich we have just created in step 5 as Partner No.(WESS), Partner Type shouldbe LS (Just Check), Agent (some valid data) Language (EN).
Now click on Save
Now we need to addInbound Parameter, so click on Add to create inbound parameter.
Select the Message Typeas CREMAS
Select Process Code asCRE1
Select Triggerimmediately.
Click on Save & goback to previous screen.
Here you will see MessageType CREMAS is added in the inbound parameter.
Testing the Scenario
Putthe file containing vendor data ”Vendor_DS.xml” on to the FTP server().
Thefile should be picked up by the sender channel “File_Sender_DS1”
Logon to XI system to see whether the message has been successfully processed byXI or not in transaction SXMB_MONI.
In backend R/3 system, goto transaction WE05 and verify that your IDoc was posted or not.
If every thing goes wellthen IDoc should have status as 53.
Expand the status recordof the IDoc to see the Vendor Number that was created.
Check in transaction “MK03” that your vendor wascreated.