on 12-30-2008 4:32 AM
Hi Master,
I written the UDF for Getting the Dynamic File name.
DynamicConfiguration conf = (DynamicConfiguration) container.getParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
// Retrieve the filename
String FileName = conf.get(key);
This is working ok - but I want to return these values so I can be used in mapping.
when I try to add the statement return FileName; , the compiler then complains with the following error:
cannot return a value from method whose result type is void return FileName;
Please help me,
Thanks,
Anu
Hi,
>
>For this code to work make a small change in your communication channel.
>Goto Adapter-Specific Message Attributes (Tick it)->File Name(Tick it).
>
>After that you can access File Name...there are also some more parameters you can access. Without >checking it File Name will be null.
>
Have you done this?
Are you getting any error when you run the scenario...Then what is it?
Or you are getting null as FileName..in that case check the above quoted reply.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly,
I tested put(key,a);
it gave the same error.
But as i said earlier your original code is perfectly fine, unless you do any formatting error.
In which you used String FileName = conf.get(key); use that only please.
I have tested the same and it's working for me....
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anu
your code seeems to be right just do this small configuration in ID
If you want the dynamic file name then you ned to make a small configuration
Go to your communication channel ->Adapter-Specific Message Attributes (check the radio button)->File Name(check it).
With out checking these boxes you can not receive dynamic file name and it will return NULL
After doing this configuration you can get the dynamic file name that .
Regards
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For this code to work make a small change in your communication channel.
Goto Adapter-Specific Message Attributes (Tick it)->File Name(Tick it).
After that you can access File Name...there are also some more parameters you can access. Without checking it File Name will be null.
Your code is perfectly fine.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anu,
Use this code,
it will return the file name as a field:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
String Outputfile = conf.put(key,a);
return Outputfile;
Regards,
Nithiyanandam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Nithiyanandam,
I am using the Same code. But i am getting the Syntax error:
Source code has syntax error: E:/usr/sap/DX1/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapaf708c00d6bb11dd83ee00101816a382/source/com/sap/xi/tf/_MM_I_FF_O_RFC_.java:13: cannot resolve symbol symbol : class variable location: class com.sap.xi.tf._MM_I_FF_O_RFC_ variable a; ^ 1 error
-
UDF Name: FileName
while creating the UDF, I select the first radio button(Value). not Context and Queue.
I written 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 FileName = conf.put(key, a);
return FileName;
-
Thanks,
ANU
Hi Anu,
Use exactly the following code with radio button at Value
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");
String SourceFileName = conf.get(key);
return SourceFileName;
Thanks!
I am using Same Code,
//write your code here
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File",
"FileName");
String SourceFileName = conf.get(key);
return SourceFileName;
But i am not able to get the file name as a source field.
I want to map the Dynamic file name to my RFC input.
If i am passing the constant file name Scenario working fine.
When i am using the UDF, my file name is mapping empty. Means my udf is not working.
My UDF is not returning the File name as a source field.
i appricate your help,
Thanks,
Anu.
Hi,
For this you need to know the constant timestamp length also. lets say its of 20 chars.
for e.g. testfile_01032009 11:02:20:300
Then Just add below statement in your code before the Return statement.
String SourceFileName1 = new String("");
//select last 20 chars
SourceFileName1 = SourcefileName.substring((SourceFileName.length()-20), SourceFileName.length);
return StringFileName1;
Thanks
swarup
While creating the UDF, Please select the first radio button(Value). dont select the Context and Queue. Then the return statement will work.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this...
String FileName = "" + conf.get(key);
This wont give error even if FileName is null.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.