on 06-04-2007 2:59 PM
Hi Gurus,
I have a requirement that the File Name should be generated as
shown below .
File name scheme + <YYYYMMDDThhmmss> + GMT + extension
I am able to accomplish the task using Module at the Receiver side.
My question is will it be possible to do using variable substitution with using the reference from PAYLOAD (is that i can use refernce from some other than payload and do it)
thanks
Rams
Hi Ramamurthy,
I presume you want to create a file with the following name scheme.
File name scheme + <YYYYMMDDThhmmss> + GMT + extension
Where YYYYMMDDThhmmss contains the timestamp during file creation.
Am I right?
I had a similar requirement in file to file scenario but in my case the timestamp to be written in the filename was not when the file was created but when my file sender adapter polls the file.
or Is this what you are looking for?
You can achieve this by variable subsitution.
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
Regards,
Pritish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ram,
<b><i>File name scheme + <YYYYMMDDThhmmss> + GMT + extension</i></b>
Can you give example o/p u needed. One more thing the value for YYYYMMDDThhmmss must be current time or its from payload?
Also let me know from the above which of the fields you are getting from payload.
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ram,
you can solve this by using dynamic configuration.
Please follow the below blog for reference.
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Implement the below code to achieve the same.
Create UDF with Date(pre-defined function) as input parameter.
Map the UDF to the root node level of the target message.
<b>//Get Current time</b>
Calendar cal =new GregorianCalendar();
int hour = cal.get(Calendar.HOUR);
if(cal.get(Calendar.AM_PM) != 0)
hour+=12;
int min=cal.get(Calendar.MINUTE);
int sec=cal.get(Calendar.SECOND);
String cur_time=hour""min""sec;
<b>//Get Input Date in the reqd format</b>
String Datetime= Date""cur_time+"GMT";
<b>//I hope file name is constant</b>
String Filename ="ABC";
String extension =".txt"
String dynaname = FilenameDatetimeextension
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
conf.put(key,dynaname);
return "";
If you have any doubt reply back.
Best Regards,
raj.
<i>My question is will it be possible to do using variable substitution with using the reference from PAYLOAD </i>
Yes. It is possible
Variable substitution allows you to name your target file dynamically with some value in the msg payload.
/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
Although u have another of option of trying Adapter specific message attributes (ASMA)
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.