Skip to Content
0
Jul 18, 2018 at 04:55 PM

Dynamic Naming does not work

85 Views

Dear All,

I have a scenario where i have to change the file name. Scenario is NFS to sFTP via Java Mapping, but it is not working. not sure what am I doing wrong here..

I am working on 7.5 PO.

please help me..

Thanks and Regards,
Rohit Verma

public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {

try {

DynamicConfiguration conf = (DynamicConfiguration)param.get("DynamicConfiguration");

KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System", "FileName"); KEY_NEWFILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System", "FileName");

String valueOld = conf.get(KEY_FILENAME), s;

trace.addInfo("File name :" + valueOld);

DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyMMdd-HHmm");

s= valueOld+dtf.toString()+".PMT"; trace.addInfo(s);

conf.put(KEY_NEWFILENAME, s); byte[] b = new byte[arg0.getInputPayload().getInputStream().available()];

arg0.getInputPayload().getInputStream().read(b);

arg1.getOutputPayload().getOutputStream().write(b);

}

catch (Exception e) { e.printStackTrace(); }