on 04-22-2009 8:18 AM
Hi everybody,
how can I write into trace in java mapping.
final AbstractTrace trace = null;
trace.addInfo("test Trace");
causes a null-pointer exception
Thanks regards
Mario
> Hi everybody,
>
> how can I write into trace in java mapping.
>
>
final AbstractTrace trace = null; > trace.addInfo("test Trace");
> causes a null-pointer exception
>
> Thanks regards
> Mario
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
refer the sample code in the sap help link.
You will get an idea then
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
we got it.
You have to override/add new method:
/***************************************************************************
* private class MyTrace extends AbstractTrace {
**************************************************************************/
private class MyTrace extends AbstractTrace {
@Override
public void addInfo(String arg0) {
System.out.println(arg0);
}
@Override
public void addWarning(String arg0) {
System.out.println(arg0);
}
}//private class MyTrace extends AbstractTrace
In the main-method, that is used for local tests, you have to add:
(Info: InputStream_2_OutputStream is the name of the class)
InputStream_2_OutputStream mapping = new InputStream_2_OutputStream();
HashMap map = new HashMap();
map.put(StreamTransformationConstants.MAPPING_TRACE, mapping.new MyTrace());
mapping.setParameter(map);
If I have time, I will blog this.
Regards Mario
I dont think you really have to override addInfo() addWarning methods etc.
below are the steps to use AbstractTrace Object in Java Mapping
...
// import the AbstractTrace object
import com.sap.aii.mapping.api.AbstractTrace;
...
//create object reference variables
private AbstractTrace trace = null;
private Map map = null;
//initialize the map object of the current mapping using setParameter
public void setParameter (Map param) {
this.map = param;
}
...
//get the AbstractTrace object into the trace object.
trace = (AbstractTrace)map.get( StreamTransformationConstants.MAPPING_TRACE );
//use the trace ojbect.
trace.addInfo("the info to be printed");
Try this,
private AbstractTrace trace = null;
trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
trace.addInfo("test Trace");
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 | |
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.