on 12-19-2006 10:51 AM
Hi All,
My file name is dependent on the payload.The file name is not based on a fixed element in the payload but varies with the payload type (although the schema is the same for all).
Variable Substitution will not work as the substitutation itself is not fixed.
I thought of writing a module and change the file name before CallSAPAdapter is invoked.
Basically I am planning to use Adapter Specific Attibute.This way the Dynamic configutaion will be filled and I an provide the value in my module.
Has anyone tried this.
Any other idea on how to manipulate the Filename otherwise without having multiple Receiver defined.
Please note ,the Sender Adapter in this case is IDoc and using UDF (in mapping) to update DYNAMIC_CONFIGURATION using Adapter Specific Atribute may not work.
Thanks in Advance,
Regards,
Bikram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudarshan,
The reason I am looking at setting file name in adapter module is because in mapping ConfigurationObject is null .How do I set the file name without the ConfigurationObject ?
However,as per your comment in the referred thread following code should work.
I will try this but if you have any alternative idea about setting the name in Mapping,I would prefer that.
Thanks and regards,
Bikram
public ModuleData process(ModuleContext moduleContext,
ModuleData md)
throws ModuleException {
Object obj = md.getPrincipalData();
com.sap.aii.af.ra.ms.api.Message msg = (Message) obj;
msg.setMessageProperty("http://sap.com/xi/XI/System/File", "FileName","FileNameModule");
}
Sridhar,
In ur UDF
String nameofFile = "your FileName" ;
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http:" + "/" + "/" + "sap.com/xi/XI/System/File", "FileName");
conf.put(key, nameofFile);
return "dummy";
Dont test it in mapping.
Execute the scenario and make sure that u have set the Adapter Specific Attributes for File type in receiver communication channel
Regards,
Sudharshan
Hello Sudharshan
I m tryin to use your code. But I ve stuck.
In the code line
"DynamicConfiguration conf = (DynamicConfiguration) <b>container</b>.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); "
How do we declare container ? I m gettin error, that variable container is unresolved ?
can you help me with this ?
awaiting your reply.
Regards
Kapil
Bikram,
I think the key we will create in DynamicConfigurationKey object and we use put and not get method as you donot have sender file adapter and the technical name is FileName in the reciever adapter and name space remains the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont think I understood what you mean.Please explain.
This is the code I will use.
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
//set the new filename
conf.put(key, valueNew);
Now if "conf" is null,this will not work.
Regatrds,
Bikram
Bhavesh,
We donot require to write the adapter module for that.
https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html
check that out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravya,
In the example you mentioned, "conf" or the "valueOld" will be null as there is no dynamic configuration defined in the sender adapter (IDoc in my case).
// access dynamic configuration
DynamicConfiguration conf = (DynamicConfiguration) param.get(
StreamTransformationConstants.DYNAMIC_CONFIGURATION);
// read value
String valueOld = conf.get(KEY_FILENAME);
if (valueOld == null) {
throw new StreamTransformationException(
"Filename is missing. ");
}
I tried the following in UDF and "conf" is null.
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
Any other idea ?
How Can I access the DynamicConfiguration in a module ?
Regards,
Bikram
You can do that.See the java test mapping closely.you can use and put that
https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you seen in this blog?
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
It discusses Access of adapter specific attributes in a module.
Regards
Bhavesh
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 | |
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.