on 02-24-2009 7:18 AM
Hi,
we are using a Java Mapping step in XI (not UDF). We need to have access to the filename. In the File Adapter we set the message attributes and can see the filename value in the SXMB_MONI.
We use the following code fragment to have access to the filename:
Container container = new Context(new FunctionWrapper(0));
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);
This doesn't work. We think the declaration of the container class is wrong. Does anybody have some information about using the dynamic attributes in Java Mappings?
Thanks in advance
Michael
import com.sap.aii.mapping.api.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
public class JavaProgram
implements StreamTransformation
{
public JavaProgram()
{
}
public void setParameter(Map map)
{
param = map;
if(param == null)
param = new HashMap();
}
public void execute(InputStream inputstream, OutputStream outputstream)
{
try
{
DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String s = dynamicconfiguration.get(dynamicconfigurationkey);
//Your logic
}
catch(Throwable throwable)
{
throwable.printStackTrace();
}
}
private Map param;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
thanks a lot. Your solution solved our problem.
Where can I find information about this kind of stuff (Java Mapping ...)?
Cheers
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The required APIs are listed here
http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/content.htm
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.