Hi Felipe,
Kindly use this udf for dynamic file name.
publicclassDynamicFileName_JavaMapping extendsAbstractTransformation
{
publicvoidtransform(TransformationInput transformationInput, TransformationOutput transformationOutput)
throwsStreamTransformationException
{
try
{
InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
Map mapParameters = (Map) transformationInput.getInputHeader().getAll();
// a) Set Output File name
mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",
StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
//Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.
DateFormat dateFormat = newSimpleDateFormat("yyyyMMdd");
conf.put(key, ("NewDynamicName_"+ dateFormat.format(newDate())) + ".pdf");
// b) Just copy Input file content to Output file content
byte[] b = newbyte[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
} catch(Exception exception)
{
getTrace().addDebugMessage(exception.getMessage());
thrownewStreamTransformationException(exception.toString());
}
}
}
Best Regards,
Monikandan