cancel
Showing results for 
Search instead for 
Did you mean: 

FTP to Proxy With Attachment

Former Member
0 Kudos
233

Dear experts,

I need your help.

I need to build an interface with the following scenario:

> Search ZIP files on a FTP server (FTP Sender Communication Channel).

> Move the ZIP file into the inbound ABAP proxy (XI Receiver Communication Channel).

The partner does not want to use Java Mapping or Custom Modules. He also did not want to use the File to File scenario.

I need to do the ZIP file into the ABAP Proxy as an attachment.

I need that the ZIP file goes into the inbound ABAP proxy as an attachment.

It is possible to do this? Can you guide me?

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Fernando,

I think, PayloadSwapBean will not work. I think, this requirement can be easily done using Java mapping. I would suggest, to give Java mapping demo to client and convince them, that it is easy to maintain.

You can use below solution.

Develop a dummy DT, MT, SI, OM. Use below Java Mapping. Call this OM in interface determination.


package javaapplication1;

import java.io.OutputStream;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

import java.io.InputStream;

public class JavaApplication1 extends AbstractTransformation {

    @Override

    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {

        try {

            InputStream inputstream = transformationInput.getInputPayload().getInputStream();

            OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

            // a) Just copy Input zip file content to Output attachment content 

            byte[] b = new byte[inputstream.available()]; 

            inputstream.read(b); 

            transformationOutput.getOutputAttachments().create("ZipFileAttachment", b); 

           

            //Set attachment Name.

            //transformationOutput.getOutputHeader().setContentType("fileName1.zip");

            //b) Send proxy XML to proxy. ABAP proxy need SI to be defined in SAP PI ESR.

            String outputXML = "<?xml version='1.0' encoding='UTF-8'?><ns0:Receivers xmlns:ns0='http://sap.com/xi/XI/System'><Receiver><Child1></Child1><Child2>Receiver1</Child2></Receiver></ns0:Receivers>";

            outputstream.write(outputXML.getBytes());

           

        } catch (Exception exception) {

            getTrace().addDebugMessage(exception.getMessage());

            throw new StreamTransformationException(exception.toString());

        }

    }

}

Former Member
0 Kudos

Thank you very much Raghu.

The client accepted this, and already is working.

Answers (0)