on 09-21-2011 4:41 PM
Hi Experts,
As per the requirement needs to supress the numeric extensions of the files and transfer to the receiver.
Example: file name is XXX123.txt , but after picking up by sender communication channel in XI that file needs to converts XXX.txt and transfer to the receiver. Finally in the receiver end the file name should be Mahesh.txt only.
Please share the inputs how to do dynamic configuration in XI in File to File scenario.
Hi Mahesh,
Take a look in the link :[ASMA|http://www.saptechnical.com/Tips/XI/ASMA/Index.htm]
Regards,
Naveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
First you need to have a UDF as shown below. No need to put any arguments in the UDF.
public String getFileName(Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
//get file name in string s
String s = conf.get(key);
//remove all numeric values
int i,l;
l=s.length();
String a="";
for(i=0;i<l;++i)
{
if(s.charAt(i)>='0' && s.charAt(i)<='9')
{
continue;
}
a=a+s.charAt(i);
}
s=a;
conf.put(key, s);
return s;
}
Now you need to map this UDF to any root element or dummy element of the target XML structure.
Ensure that
1. Sender Comm Channel has ASMA and file name ticked
2. Receiver Comm Channel has ASMA and file name and "fail if ASMA missing" ticked
3. in receiver communication channel -> File access parameters-> File name scheme -
> put any value say "*". This step is not compulsory.
Hope this solves your problem.
regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have a scenario where I need to take the month and year from the file name and map it to suitable fields in the target. Ex - filename_apr2014 from this i should be able to read the month and year and map it. How to do this? I tried the udf -
public String getFileName(Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
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;
got this error while testing the mapping -
Runtime exception when processing target-field mapping /ns0:MT_Aries_RmngRsrvs_Output/Impairment_Details; root message: Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.get(com.sap.aii.mapping.api.DynamicConfigurationKey) of a null object loaded from a local variable at slot 2] in class com.smenergy.https_.common.ZSMART method getSourceFileName[com.sap.aii.mappingtool.tf7.rt.Context@5b04fc0f]
See error logs for details
Hi,
1. You have check the Adapter Specific Parameter in Sender File comm. channel.
This link will help for your step 1: /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
2. In UDF mentioned in the above blog suppress the numbers in the file name.
That's all
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Set ASMA settings as described in this blog.
Now create an UDF with one argument let's say 'a', could be something like this:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = a;
for (int d=0; d<nameLen;d++)
{
Character check = (SourceFileName.charAt(d));
removeChar = check.toString();
if (Character.isDigit(check))
{
SourceFileName = SourceFileName.replace(removeChar, "");
}
return SourceFileName;
UDF---->Some RootNode.
Take a look here:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.