on 07-04-2008 3:04 PM
Hi,
I need to do some custom logging for which i need to log the data using the message Id. This id is passed to an RFC fm from the UDF using the lookup service to XI itself.
I am getting the message id using
java.util.Map map = container.getTransformationParameters();
String messageId = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
The issue is, I get a different message id than that I see from the moni/ message monitoring.
Regards
Unni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
No entry corresponding to that.
regards
Unni
Below i my UDF function(variables in caps are parameters for the udf)
GlobalContainer globalContainer1 = container.getGlobalContainer();
Map map;
map = container.getTransformationParameters();
String messageId = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
String content = "";
String actionCode = "";
if(null !=WM_NOTIFNUM && WM_NOTIFNUM.equals("")){
actionCode = "A";
}else /if(null !=WM_NOTIFNUM && !WM_NOTIFNUM.equals(""))/{
actionCode = "U";
}
MappingTrace importanttrace;
importanttrace = container.getTrace();
GregorianCalendar cal = new GregorianCalendar();
ParsePosition pos = new ParsePosition(0);
String strDT = cal.get(cal.YEAR) "-"cal.get(Calendar.MONTH)"-"cal.get(Calendar.DAY_OF_MONTH)" "cal.get(Calendar.HOUR_OF_DAY)":"cal.get(Calendar.MINUTE)":"cal.get(Calendar.SECOND);
String strDT1 = cal.get(Calendar.YEAR) "-"cal.get(Calendar.MONTH)"-"cal.get(Calendar.DAY_OF_MONTH);
Date dt =(new SimpleDateFormat("yyyy-mm-dd HH:mm:ss")).parse(strDT,pos);
pos = new ParsePosition(0);
Date dt1 =(new SimpleDateFormat("yyyy-mm-dd")).parse(strDT1,pos);
String dtOut = (new SimpleDateFormat("yyyymmdd")).format(dt1);
String timOut = (new SimpleDateFormat("HHmmss")).format(dt);
String ignoreValue = "Ignore";
StringBuffer sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<ns0:ZWM_XI_LOGGING xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">"+
"<P_LOG>");
sb.append("<WM_SEQNUM></WM_SEQNUM>");
sb.append("<WM_MSGID>" + messageId +"</WM_MSGID>");
sb.append("<WM_PREMISE>" + WM_PREMISE +"</WM_PREMISE>");
sb.append("<WM_NOTIFNUM>" + WM_NOTIFNUM +"</WM_NOTIFNUM>");
sb.append("<WM_ACTION>"+ actionCode +"</WM_ACTION>");
sb.append("<WM_NOTIFTYPE></WM_NOTIFTYPE>");
sb.append("<WM_NOTIFCODE>"+ WM_NOTIFCODE +"</WM_NOTIFCODE>");
sb.append("<WM_WRNUM>"+ WM_WRNUM +"</WM_WRNUM>");
sb.append("<WM_DIST>"+ WM_DIST +"</WM_DIST>");
sb.append("<WM_XIORDPRCDT>"+dtOut +"</WM_XIORDPRCDT>");
sb.append("<WM_XIORDPRCTIM>"timOut"</WM_XIORDPRCTIM>");
sb.append("<WM_SAPORDCDT></WM_SAPORDCDT>");
sb.append("<WM_SAPORDCDTIM></WM_SAPORDCDTIM>");
sb.append("<WM_STORMORDCDT></WM_STORMORDCDT>");
sb.append("<WM_STORMORDCDTIM></WM_STORMORDCDTIM>");
if(null !=WM_IS_ACK && WM_IS_ACK.equals(ignoreValue))
sb.append("<WM_IS_ACK>"+ WM_IS_ACK +"</WM_IS_ACK>");
else
sb.append("<WM_IS_ACK></WM_IS_ACK>");
sb.append("<WM_EVENT_ID>"WM_EVENT_ID"</WM_EVENT_ID>");
sb.append("</P_LOG></ns0:ZWM_XI_LOGGING>");
importanttrace.addInfo(""+sb.toString());
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try{
importanttrace.addInfo("Calling Look Up Service ");
Channel channel = LookupService.getChannel("IntegrationServer_XD1","GeneratedReceiverChannel_RFC");
importanttrace.addInfo("Channel "+channel);
accessor = LookupService.getRfcAccessor(channel);
InputStream inputStream = new ByteArrayInputStream(sb.toString().getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload result = accessor.call(payload);
importanttrace.addInfo("Payload "+result);
InputStream in = result.getContent();
out = new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
out.write(buffer, 0, read);
}
content = out.toString();
}catch(Exception ex){
ex.printStackTrace();
importanttrace.addInfo("Exception "+ex.getMessage());
}
return "";
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.