on 2010 Feb 12 6:55 AM
Hi Experts
I have a bypass scenario where I need not do any transformation to the file but need to change the filename scheme.
The sourcefile name is XYZ.txt whereas the target needs to be <IDOCNUM>_X_Y.DAT
As of now we have used a java mapping to achieve this but I was looking out for something simpler.
I mean can we straighaway catch the IDOCNUM(comes in source payload) and use it for filename scheme?
Regards
Soumen...
Hi,
Use this as a sample
try {
String filename = "";
String timestamp = "";
DynamicConfiguration conf1 = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 =DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey key2=DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","SourceFileTimestamp");
filename = conf1.get(key1);
timestamp = conf1.get(key2);
filename = filename.replaceAll( ".xml" ,"_" );
filename = filenametimestamp".xml";
conf1.put(key1,filename);
return filename;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
Regards,
Nithiyanandam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without mapping its not possible i think(looking for simple sol),even we can achieve this requirement using message mapping using Dynamic Configuration UDF,by passing DOCNUM as input to the UDF.
Simple is a wrong word that I used. What I meant is can we twitch the file channels(some kinda parameters or something) to get this done.
Message mapping is not there atall and hence we didn't want to add one just for this.
I think you have used dynamic configuration code in JAVA Mapping...
Exactly!!!
Use this as a sample
@Nithiyanandam A.U : Prolly you missed my query. We already have done teh code. All i want to know is an alternative way to achieve this w/o using a mapping.
Regards
Soumen...
Hi ,
You can achieve this requirement by usinh the variable substitution.
in variable substitution specify the variable...
seqno payload:(give the whole path of the IDOC number)
if FCC ,for the file name use
abc_%seqno%.txt.
.................................
I think this is the only way u can solve this issue without mapping.
Babu
>
>
> @Nithiyanandam A.U : Prolly you missed my query. We already have done teh code. All i want to know is an alternative way to achieve this w/o using a mapping.
>
> Regards
> Soumen...
to answer your question, the simplest way is what you are already doing
without a mapping or a module, it is not possible to cache the dynamic configuration parameters
Ok!!! slight change in the requirement. Now I just need to change the extension.
For example : Input is XYZ.txt and required output is XYZ.dat is it possible w/o any mapping. The scenario is same bypass one. And hence I dont have any XML structure. Its flatfile @ both source & target. With change of extension.
How can we change the extension without changing teh filename?
Hi,
Think i got the solution for you..
Do what it says in this:
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
Just ignore the stuff about UDF...
And check the File Name option under Adapter-Specific Message Attribute on your senderchannel.
Then you will get the original filename..
I just tried it out and it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Step by step..
Sender Channel:
1. put a checkmark in File Name under Adapter-Specific Message Attribute
Receiver Channel:
1. Add the following line to Module as the first entry
1 AF_Modules/DynamicConfigurationBean Local Enterprise Bean 0
2 CallSapAdapter Local Enterprise Bean 0
2. Add the following lines to Module Configuration
0 key.0 write http://sap.com/xi/XI/System/File FileName
0 value.0 message.interface
3. Enable variable substitution under Advanced parameters
Variable Name = filename
Reference = message:interface_name
4. File Name Scheme = Output_%filename%
If you do above your result will be the following:
Input file = XYZ.xml
Output file = Output_XYZ.xml
Hello,
I am facing similar issue but with time stamp format. can you please guide me in this.
I am usinf Integrated configuaration for File to file scenario ( no IR objects)
I need the target file name to be XYZ.ddmmyyyy but when I am using Add time Stamp option output file is coming as XYZ.ddmmyyyy-ssssss.
I need to eliminate the milli seconds part. How can I do that.
Thanks .
Hi,
Without mapping its not possible i think(looking for simple sol),even we can achieve this requirement using message mapping using Dynamic Configuration UDF,by passing DOCNUM as input to the UDF.
I think you have used dynamic configuration code in JAVA Mapping,the same code we can use as UDF also.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.