on 08-27-2008 7:42 AM
Hi everyone,
I have a task regarding mapping
In my structure , i defined a field for Filename . What I need is, what ever source file name am sending, that should be mapped into this filed.
If am sending inputfile.txt.
My output file should appear like this,
<?xml version="1.0"?>
<message id=u201DmessageIDu201D>
<header>
<filename>D:\\inputfile.txt</filename>
</header>
<body>
FileContent
</body>
</message>
Any help would be appreciated. Do I need to create any UDF. If So please provide.
Regards,
Varun
Hii,
Thanks everyone for your replies. If I use the specified UDF, I am getting error as
key is already defined in FnameDir$(java.lang.String,com.sap.aii.mappingtool.tf3.rt.Container)
Regards,
Varun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
are u using the same UDF that I replied. also note that the variable key should be declared only once.
Use this without changing any thing. It works for me...
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);
key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String dir = conf.get(key);
return dir+'/'+ourSourceFileName;
Also let us know where do you het this error..
Thanks
SaNv...
correction to 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);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String directory = conf.get(key);
//concatenate directory and filename
return concatenatedString;
still if same problem comes then use 2 different UDF and split filename and directory code.. then using concat function you can get final string
Hi Varun,
Please check whether the Message type attribute of the file adapter is rightly configured or not.Please do the needfull over there also.
Thanks,
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After performing the above said functions.
perform a variable substitution at the receiver channel
File name scheme %var%.extension
Enable Variable substitution
var -->payload:messageid,1,header,1,filename,1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
dont refer the above link..it appers to be broken
prashant
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.
use 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);
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String directory = conf.get(key);
//concatenate directory and filename
return concatenatedString;
UDF---> filename
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>Do I need to create any UDF. If So please provide.
Yes. You need to use UDF.
1. In the sender File cc check the option Set Adapter-Specific Message Attribute, Filename and Directory.
2.Use 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);
key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String dir = conf.get(key);
return dir+'/'+ourSourceFileName;
map the output of the UDF to the target structure
Thanks
SaNv...
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.
User | Count |
---|---|
86 | |
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.