on 02-10-2011 10:32 AM
Hello,
I have to configure the file adapter such that the file name is configured dynamically.
I wrote a UDF which gives the following error.
<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_GSFt_AccountReconciliation_Format_: RuntimeException in Message-Mapping transformatio</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
The code is :
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http//sap.com/xi/XI/System/File","FileName");
String FileName = conf.get(key);
String newFN = FileName.substring (11,15) ;
String FN = "<abc>+ newFN + "_" + ".dat";
conf.put(key,FN);
return FN;
Am I missing something here?
I have also specified the variable substitution in Receiver Channel.
Kindly help me out ppl.
Regards,
Sanjay
Modify code as below...
String FN="";
try{
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http//sap.com/xi/XI/System/File","FileName");
String FileName = conf.get(key);
if(FileName != null && FileName !=""){
String newFN = FileName.substring (11,15) ; //make sure u do substring rite way... index 10 is 11th char of the string
FN = "<abc>+ newFN + "_" + ".dat";
conf.put(key,FN);
}catch{
}
return FN;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
When it is taking substring, it is really surprising to see that it is taking a value from the Target Filename
instead of the source.
How can this happen?
Am I missing something in the code or configuration part?
I have enabled ASMA for both adapters.
How should I name the file scheme in ID. I have done that also in a proper way.
Following will fail if you do not process this via file adapter:
String FileName = conf.get(key);
String newFN = FileName.substring (11,15) ;
because FileName then is null and you will get a null pointer exception. So better check for null:
if (FileName != null) {
....
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have also specified the variable substitution in Receiver Channel.
This is wrong.
Enable ASMA in Sender and receiver channels and check on File Name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check in mapping trace for more detials on mapping error.
Regards,
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sanjay,
The Dynamic configuration code seems to be fine but a small change. Test with the below code because the syntax is wrong in your code.
Use the below code"
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http//sap.com/xi/XI/System/File","FileName");
String newFN = FileName.substring (11,15) ;
String FN = "<abc>" + newFN + "_" + ".dat";
conf.put(key,FN);
return FN;
Thanks,
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In addition to the above suggestion, please chk ur code syntax:
Should be like this:
String FN = "<abc>" + newFN + "_" + ".dat";
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you testing this in message mapping or are you doing an end to end testing?
/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I hope you following below steps
- Create an UDF and include the piece of code that captures the Filename and Timestamp from source side via ASMA.
- Map the UDF to any of the top level node so that the modified filename will be available for the target communication channel
test mapping also from test tab in Message mapping
regards
Aashish Sinha
Hi Sanjay,
There are many solutions to set target filename.
refer this link for more info
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.