on 09-15-2008 11:30 AM
I need to append today's date to the file name when outputting a file. The date isn't available in the outbound XML so I can't use variable substitution. Does anyone have any suggestions?
Hi, Perhaps I should explain a little more about the interface I'm trying to build. It's iDoc to File. I don't have access to a date or time in the outbound XML file so I can't use variable substitution. I can't add additional fields to the outbound message as the partner would reject them. I need to rename the outbound file including the date and a sequence number.
I'm not a JAVA programmer and know nothing about user defined functions but am more than willing to learn. I see that I need to create a mapping to the root node, using my date and including a userdefined function to put this value somewhere I can get it later. Can someone please explain how I reference this value from the receiver comms channel?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don't have access to a date or time in the outbound XML file so I can't use variable substitution. I can't add additional fields to the outbound message as the partner would reject them.
To Map the Date function you no need any field in the source structure.The Date function is the standard function.and it wont take any input from sourece.it simply returns the current date in the specifies format.
I see that I need to create a mapping to the root node, using my date and including a userdefined function to put this value somewhere I can get it later
generally u specify your file name in Receiver communincation channel.So the same file name you have to concate with the Date (by usind predefined function Concat) and give the new string that means(ex:Filename = XYZ and Date :20080914 then new concated string whould be "XYZ20080914")
you have to create one new UDF and copy the code that have specified and give the new String (for ex:XYZ20080914) as input.map it to root node.
In ID you have to enable Adapter specific message attributes and also Filename in that.(Give * or any string in the place of File name) Because of this in the receiver file adapter it wont take the static filename which we have specified in the fiels FileName,instead it will take the File name which we have specified in Mapping UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use variable substitution for filename check the code for UDF getFileName
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
result.addValue(""+ourSourceFileName);
Edit the SourceFileName with some string manipulation (SubString) with your requirement.
Also check the thread for more detail.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Better try doing this with variable substitution.
Insert the timeStamp in a XML tag (using Message Mapping) and use the Variable Substitution. For Example:
Create a "filename" tag
File Name Schema = %fileName%
Variable Substitution (Table)
... add a Line
Variable name = fileName
Reference = payload:myXml,1,filename,1
Edited by: malini balasubramaniam on Sep 15, 2008 1:05 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can give addtimestamp option in Receiver file adapter.
So that you can achieve the same what you want.
Thanks,
Kalyan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the Date function in mapping to get the required date in what ever format you want by using change format option in it and then concat this Date with the required FileName ex:file1 and give this new String to the Below UDF.
Map the output of this UDF to root node of target structure in Mapping so that it wont effect any target structure.
check Adapter specific parameters in your Receiver File Adapter
write this UDF
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
use these links for ur reference
https://sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
use std date functions and a UDF
currentDate> TransformDate>UDF ---> Root node
in currDate specify your date format..if it is not existing type it there..
Time field should be blank as you are not interested in time..
For UDF refer..
By default I appear to get YYYYMMDD-HHMMDD-SSS where SSS is some sort of sequence number.
--->
to resolve this,in rec file adapter File construction Mode = Add counter
counter Mode =After first file
so that sequence no will not be written at the end.... it will appear in case more than one file comes at same time and this will hardly happen
Hi,
By default u get tat format oly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Add time stamp option at receiver end, by default u can get format yyyymmdd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use Addtimestamp option in the receiver file channel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.