Hola,
Necesito tomar el
SourceFileTimestamp
y pasarlo en el cuerpo del correo como texto.
Necesito que esta fecha esté en un formato específico que es -
MM/dd/yyyy hh:mm:ss
La fecha viene como -
YYYYMMDDTHHMMSSZ
de ASMA
SourceFileTimestamp
donde T representa el inicio del tiempo y Z representa el final del tiempo.
Mi código es el siguiente pero está dando error -
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= "Archivo EBS con nombre de archivo " + fname + " se recibió correctamente en SAP @ " +date1+" "+time1;
return "Estimado/a Señor/a," +" \n " +" \n "+filename;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
Por favor, corrija esta UDF.
Gracias
Neha