on 03-10-2009 3:02 PM
Hello,
I would like to use a filename like this:
Name.<DOCNUM>.Direction.<Timestamp>
For DOCNUM I use variable substitution. Works fine.
For <Timestamp> I need a different format as the timestamp function
in file adapter create. So I try to set up my timestamp in mapping like
dynamic file name:
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Timestamp");
conf.put(key1, a);
Input a is date function which creates my desired timestamp format. In file adapter I try this:
Name.%DOCNUM%.Direction.%Timestamp%
or
Name.%DOCNUM%.Direction.Timestamp
or
Timestamp
all doesn't work for Timestamp.
So is there a possibility to configure a dynamic filename like this???
Is there a possibility to access dynamic configuration variables in dynamic filename except
the known for filename and directory??
thanks
chris
Edited by: Christian Riekenberg on Mar 10, 2009 4:02 PM
Edited by: Christian Riekenberg on Mar 10, 2009 4:05 PM
I dont think there is a TImestamp variable available. You can populate the timestamp field in the mapping by calling Java DateTime (something like that) package functions.
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian,
You achieve all this in Dynamic configuration itself.
Write a small udf to set the file name in the mapping using dynamic configuration variable "FileName"
Pass your other paramerters - DOCNUM, DIRECTION, DATA (use a small java date function to get date in your desired format) as input to the above udf.
Let me know if you need any more details.
Regards,
Younus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
check this link
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
No need to go for UDF--Dynamic configuration...
Just check Adapter specific attributes in both communication channels and give File Construction mode as ADD TIME STAMP
Now You will get like %dynamicfilename%timestamp for example source file is input then your target file is input20090312-173817-187.txt like this
thanks
your file name needs to be
Name.<DOCNUM>.Direction.<Timestamp>
dont use variable substitution. use only dynamic configuration and set the file name
introduce a logic that will create the string
Name.<DOCNUM>.Direction.<Timestamp>
eg. String filename = "Name" + var_docnum + "Direction" + var_timestamp;
then use the dynamic conf code to set the file name and use adapter specific properties in you adapter to retrieve it.
Ref:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the UDF while mapping,
String DATE_FORMAT_NOW = "yyyyMMddHHmmssSSS";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
Concat this with your File name and pass to "DynamicConfig".
You just need to import
java.text.SimpleDateFormat
Let me know if you have any problem.
Filename UDF -> DynamicCofig -> Node
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
My speculation is that the dynamic configuration cannot access the time stamp. However you requirement is much possible, rather than trying to assign the time-stamp dynamically in the mapping use the Standard Date function currentDate with the format as yyyyMMdd-HHmmss-SSS ( same as the timestamp of the file adapter) and map it.Refer to this element in the variable substitution like Name.%DOCNUM%.Direction.%Timestamp%.
Thanks,
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
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.