This document will help us in understanding and achieving the following scenario by using Java Mapping
- SAP PI receives a .csv file as an attachment.
- The attachment needs to be read ,converted in to XML and place the XML file in the target location
- The .csv file contains multiple records with 2 fields in each record
Note: The above scenario can be further enhanced based on the requirement.
· Java and PI Knowledge.
· SAP PI 7.31(Single Stack), SAP NetWeaver Developer Studio 7.31 SP07, Java Version 1.6.
PFA Java Mapping Code and test sample files for reference.
Source Message Type
Target Message Type
– Create Outbound and Inbound Service Interfaces and assign these message types.
Note: For Outbound Interface, Please choose Interface Pattern as: Stateless (XI 3.0- Compatible)
– Import the java mapping in ESR under Imported Archives
– Create Operation mapping and assign the java class from the imported archives as shown below:
Please check Read Attachments check box in Operation Mapping
In Integration Directory, you can configure a simple File to File scenario
Note: While configuring the sender file adapter, make sure Additional File(s) section is selected under this section you have to mention the csv file name that will be picked as an attachment or you can refer to my blog http://scn.sap.com/docs/DOC-44537 where in an customized adapter module is being used to achieve this functionality.
Sender FILE Channel Configuration
NFS location contains the following files
Sender Channel is started and the following audit logs can be seen in the Audit logs
Message Monitoring Logs is as shown below . Here, in the below screenshot , you can see the File.csv coming as an attachment in the payload.
Following is the output of Java mapping