on 08-07-2008 6:05 AM
Hi Everyone,
I was doing file to file scenario, i want to get the same source file name in target also.
I created the structure as FileName, Company, Address. I did direct mapping for Company and Address
but for field FileName, i created a userdefined function as i want the same file name.
I mentioned the following code in Used defined function
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;
When i test the mapping in IR, with sample data, i am getting this error.
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Target_File_MT/FileName. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Source_File_to_Target_File_MM_ method DynamicFile$[, com.sap.aii.mappingtool.tf3.rt.Context@1763e46]
Could anyone please help me with the issue.
I have done only IR part, I didnot configured ID.
Regards,
Varun.
Hi Varun,
Are you trying to access the ASMA values from the SOAP header of the XI message for the source file name?
First of all you need to Set the Sender File Adapter for Set ASMA and then file name. So it will work fine when you actually run the scenario end to end.
But in the mapping tool when you test the mapping - there is not message header updated with the actual source filename - and whenever you try to read the FileName attribute in the message header from the UDF - it cannot find the object and returns a NullPointerException.
I would suuggest for your mapping tool testing to be successful, have a check in the java code for null values,
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);
If (ourSourceFileName != null)
{
Return ourSourceFileName;
}
Return "NoFileName.txt";
Let us know if this works.
Regards,
Suddha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>I was doing file to file scenario, i want to get the same source file name in target also.
For this you dont need to use the UDF retrieve the file name and use it as variable substution.
Just check the option Set Adapter-Specific Message Attribute and Filename in both the sender and receiver file communication channel.
>>When i test the mapping in IR, with sample data, i am getting this error. I have done only IR part, I didnot configured ID.
You cant test this in the IR. Source file name will be passed only during the runtime. So configure the entire scenario and test it by posting the file.
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Check Adapter Specific Message attributes.This blog will help you
You can also go for variable substitution :-
When you specify the target directory and file name schema, you have option of setting variables and defining them in a table. The variables are replaced by elements from the XML structure at runtime.
http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/464442c1a1c253e10000000a1550b0/content.htm
links on the dynamic variable substitution
Dynamic File Name Part 1
Dynamic File Name Part 2
Thanks
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 substituion mechanism to generate target file, in this mechanism we can get value from source strucutre and generate as a file. No need UDF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please check the message type attribute in the file adapter configuration.Check whether it has been correctly configured or not !!
Thanks
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.