Friday, 14 April 2017

PI FILE to IDOC Scenario


SAP PI FILE TO IDOC SCENARIO

In SAP PI file to Idoc scenario, we transfer a file from source system to target SAP system. Once the components are built in SAP PI, we can transfer a file in SAP PI system by creating objects in the Enterprise Service Builder.

DESIGNING OF OBJECTS

 

Step 1 − Go to SAP PI Tools Page. Then click on Enterprise Service Builder under ESR.

 


Step 2 − To find the name of component under which objects have to be created, expand the component to find out the software component version.


 

 



 

 

Step 3 − Select the component. Then Right click and click on New to create an object under this component.

 



Click on New to create an object
 


 

Step 4 − The first object that we create is a namespace. Enter the namespace in the form of URL and click on Create button at the bottom. The namespace that we used in this example is: urn:ppg.com:Training:SC1


 

 

 



Once the object is created under software component, save and activate the object.

CREATING DATA TYPE

Step 1 − Once the Namespace is saved and activated, create a data type. Go to the software component. Right click and click on New as shown previously. In the next window, select Interface objects. Under Interface objects click on Data Type. Enter name of Data Type and click on Create button. The data type that we used in this example is: DT_SalesOrderIdoc.

 

 

 



 

Step 2 – Form the input message structure by entering the names of elements and sub elements as required. Define the type and occurrence. Occurrence defines how many times that element will appear in the file. You can select minimum occurrence and maximum occurrence value.

 

 

 


 

 

 

 

 

 



After creating the Data Type click on Save and Activate.

 

CREATING MESSAGE TYPE

Step 1 − Right click and click on New as shown previously. In the next window, select Message Type under Interface Objects. The message type that we used in this example is: MT_SalesOrderIdoc.

 

 



Step 2 − Now, define the Data Type that you will be using for Message Type. Drag the Data Type from the left bar to the Data Type option under Message Type (Message Type ). Then click on Save button.

 


Here we create the data type, message type and service interface of Source System only because the Target System is an Idoc. So we do not need to create data type, message type or service interface for the target system.

CREATING SERVICE INTERFACE

Step 1 – Right click and click on New as shown previously. In the next window, select Service Interface under Interface Objects. The service interface that we used in this example is: SI_SalesOrderIdoc_Asyn_Out.

Step 2: Give the category of the interface to be outbound and mode to be asynchronous. Drag the Message Type from the left bar to the Request option under Messages bar. Click on Save button.

In case of Inbound service interface enter the category as Inbound and the mode of communication can be Synchronous or Asynchronous.


CREATING MESSAGE MAPPING

Step 1: Right click and click on New as shown previously. In the next window, select Message Mapping under Mapping Objects. The message mapping that we used in this example is: MM_SalesOrderIdoc_To_Orders_Order05.

Step 2: Define source and target message by dragging the message type under Message in the source and dragging the Idoc ORDERS_ORDERS05 from the Imported Objects in the target.


Step 3: Map the messages of the target structure to the corresponding messages of the source structure as per given requirements.


The rules and requirements of mapping is given in the mapping sheet below:


CREATING OPERATION MAPPING

Step 1: Right click and click on New as shown previously. In the next window, select Operation Mapping under Mapping Objects. The operation mapping that we used in this example is: OM_SI_SalesOrderIdoc_Asyn_Out_To_ORDERS_ORDERS05.

Step 2 – Enter Source Operation by dragging the Service Interface from the left pane to Source Operation. Outbound Service Interface will be dragged to Source Operation. Idoc name will be  dragged to Target Operation. Drag the Message Mapping to the Mapping Program.


 

Unit Test Data:

Input test value:

Delivery date
09-08-2016
Partner
XXX
PONumber
XXXXXXXX
Comment
This is my first Sales Order Mapping in PI ESR
ItemNo
001
Name
Nithish
SurName
Adepu
PODate
08-04-2016
POItemNumber
XXXX
Quantity
4
Price
320
POSName
VIPBigBazaar

 

Expected Output:

SAP Segment
SAP Field
Expected Output
E1EDK01
BELNR
TestSO
E1EDK03
DATUM
08-04-2016
E1EDK03
IDDAT
005
E1EDK02
BELNR
XXXXXXXXX
E1EDK02
QUALF
002
E1EDKA1
PARTN
XXX
E1EDKA1
PARVW
AG
E1EDKT1
TDID
001
E1EDP01
POSEX
1
E1EDP01
MENGE
4
E1EDP01
MENEE
3.20
E1EDPA1
PARTN
Nithish Adepu
E1EDPA1
PARVW
WE
E1EDP19
IDTNR
00000000009856

 

 

 

 

 

 

 

CONFIGURATION OF OBJECTS

Step 1: Go to Integration Builder under Integration Directory on SAP PI Tools Home Page to configure a scenario.


Step 2: To configure a scenario click on Object, then New. Under Administration tab click on Configuration Scenario.


 

 



 

 

 

 

 



 

Step 3: Create communication channel for both sender and receiver by clicking on Communication Channel under Collaboration Profile. The sender and receiver channels that we created here are SalesOrderIdoc_Channel and IDOC_Receiver_ECC_CC respectively.

 

Step 4: For sender communication channel go to Adapter and click the available adapter types. Here we use File adapter. The Adapter Type is selected as Sender as the type of communication channel is a sender channel. Enter the file name and path of the file.

 

 

 

 

 

 

 



 

Step 5: For receiver communication channel go to Adapter and click the available adapter types. Here we use IDoc AAE adapter. The Adapter Type is selected as Receiver as the type of communication channel is a receiver channel.

 


Step 6: Create integrated configuration by clicking on Integrated Configuration under Collaboration Agreement.

Step 7: In the Inbound Processing tab, select the communication channel as created for the Sender.


Step 8:  In the Receiver tab, select the communication.


 

Step 9: In the Receiver Interfaces tab, select Operation Mapping. Click Search and select the Operation Mapping as shown in the following screenshot. Operation Mapping will be created the same way as in the previous steps.


Step 10: In the Outbound Processing tab and select the Receiver Communication channel.


 

Step 11: Click on save and activate.

 

No comments:

Post a Comment