Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FTP to Proxy With Attachment

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.

Former Member
Former Member replied

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());

        }

    }

}

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question