on 07-15-2009 11:14 AM
Hi All,
My requirement is, i need to rename the file in receiver file adapter after the file is written to the folder. and this file should have a counter attached to its name. For eg. If i had a file created with name Material, i want to change it to Order001, Order002, Order003.... so on and counter should reset after 999. how can i achecive it?
thanks a lot in advance.
Regards,
Rashmi
Edited by: Rashmi H S on Jul 15, 2009 12:15 PM
Hi Rshmi,
use this UDF i hope it will work fine,
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String a=conf.get(key);
int inc = 1;
Integer seqNo = (Integer) container.getParameter("seqNo");
if(seqNo == null || seqNo ==999){
seqNo = new Integer(inc);
}
else{
int num = seqNo.intValue() + inc;
seqNo = new Integer(num);
}
container.setParameter("seqNo", seqNo);
return var1+seqNo.toString();
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
One approach could be to use a batch program in receiver folder which will rename the file and reset the counter when it reaches 999.
If you dont want to reset the counter use the counter mode in XI with your file name
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi use Dynamic configuration bean to chnage the file name dynamically..
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String a=conf.get(key);
return a;
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rashmi
I believe for this you have to use UDF, i dont know how to use this but this will be achieved through UDF.
Regards
Dheeraj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for the responses. But i'm not using mapping in my interface.
To give you more info, my scneario is like this. we have two files, Material and item file coming to XI as soap attachments. we are reading Material into one file called Material.txt and later item also will be appended to same file. after that i want to rename Header.txt to Order.txt
any help?
Regards,
Rashmi
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.