cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong Message ID

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181962
Active Contributor
0 Kudos

check this link:

Former Member
0 Kudos

Ravi,

If you read my message, I am doing the same thing. But I get a different messageid in the runtime.

regards

Unni

former_member181962
Active Contributor
0 Kudos

what do you see when you copy the message id that u get in UDF in SXMB_MONI?

Former Member
0 Kudos

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 "";

former_member181962
Active Contributor
0 Kudos

How are you testing the map?

I hope you are not testing it in IR.

Former Member
0 Kudos

Hi Ravi,

As I said earlier, its runtime.

Any Thoughts?

regards

Unni

Former Member
0 Kudos

Was using SYSUUID, in my RFC, which was internally using 64byteInteger while importing to XI. There was some conversion related issue. Changed it to Char in the function module and then reconverted to SYSUUID.