Olá,
Preciso pegar o
SourceFileTimestamp
e colocá-lo no corpo do e-mail como texto.
Preciso que esta data esteja em um formato específico que é -
MM/dd/yyyy hh:mm:ss
A data vem como -
YYYYMMDDTHHMMSSZ
do ASMA
SourceFileTimestamp
onde T representa o início do tempo e Z representa o final do tempo.
Meu código é o seguinte, mas está dando erro -
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
try{
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("
_http://sap.com/xi/XI/System/File","FileName
");
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("
_http://sap.com/xi/XI/System/File","SourceFileTimestamp
");
String fname= conf.get(key1);
String timestamp= conf.get(key2);
String Str= timestamp;
String date= Str.substring(0, 8);
String year= date.substring(0, 4);
String month= date.substring(4, 2);
String day= date.substring(6, 2);
String time= Str.substring(9, 6);
String hours= time.substring(9, 2);
String mins= time.substring(11, 2);
String secs= time.substring(13, 2);
String date1= month+" / "+day+" / "+year;
String time1= hours+" : "+mins+" : "+secs;
String filename= "Arquivo EBS com nome do arquivo " + fname + " foi recebido com sucesso no SAP @ " +date1+" "+time1;
return "Prezado/a Senhor/a," +" \n " +" \n "+filename;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
Por favor, corrija esta UDF.
Obrigada
Neha