cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for Timestamp

Former Member
0 Kudos

Hi Friends,

Can anyone please provide me the UDF for the following case.I need my output file name in following format

156WE_YYYYmmddHHMMSS.xml

Thanks for quick help..

Regards,

Dinesh

Accepted Solutions (0)

Answers (2)

Answers (2)

aashish_sinha
Active Contributor
0 Kudos

Hi,

In the target file adapter, you can choose target file name as 156WE_.xml, then in next tab choose ADD time stamp. It will create a output filename as 156WE_YYYYmmddHHMMSS.xml, if values till underscore is fixed.

Else you can use below code.

/* Using Dynamic Configuration */

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

//conf.removeAll();

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

//String filename= conf.get(key);

conf.put(key, fileName);

key= null;

return fileName;

Refer link --- http://wiki.sdn.sap.com/wiki/display/Snippets/SAPXIDynamic+Configuration

Regards

Aashish Sinha

Former Member
0 Kudos

My receiver is SFTP..so i think i can try with Danielle post..

Thanks

Dinesh

aashish_sinha
Active Contributor
0 Kudos

you can try with my way also..

Regards

Aashish Sinha

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Try this code snippet ...

Date date = new Date(); // get the current date
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); // set the format
String concat ="156WE_" + df.format(date);
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key,concat);

Former Member
0 Kudos

Thnx for everyone help

DG
Active Contributor
0 Kudos

It is farily simple using the following imports

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

 
		    Date now = new Date();  
		    DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS:SZ");  
		    String date = df.format(now);

You can change the date parameters, search for simpledateformat.