Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2695

Re: Changing the Extension of a file

$
0
0

Aamir,

 

Please follow these blogs

Dynamic file name for pass-through scenario

How to create Java Mapping in SAP PI / PO

 

package javaapplication1;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class DynamicFileName_JavaMap {    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {        try {            InputStream inputstream = transformationInput.getInputPayload().getInputStream();            OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();            // a) Set Output File name            DynamicConfiguration conf = (DynamicConfiguration) transformationInput.getInputHeader().getAll().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);            DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");            String FileName = conf.get(key);            FileName = FileName.replace(".txt", ".pgp");            conf.put(key, FileName);            // b) Just copy Input file content to Output file content            byte[] b = new byte[inputstream.available()];            inputstream.read(b);            outputstream.write(b);        } catch (Exception exception) {            throw new StreamTransformationException(exception.toString());        }    }
}

Viewing all articles
Browse latest Browse all 2695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>