on 03-29-2011 2:54 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.