When I first read the excellent blog of Sravya Talanki at Speaking Widget: Warns you about Error Messages in SAP XI, I think "It would be nice to have something like this to keep under control at runtime the flow of messages in XI"
With the publishing of the SAP Widget Foundation this became easy to achieve!!!
but let's we go through the installation steps:
1: Install Yahoo Widget engine, release 4.0.5 or above
* Yahoo widget engine can be downloaded at http://widgets.yahoo.com/download/ </p><p> 2: Install SAP Widget Foundation</p><p> *SAP widget foundation can be downloaded at http://www.sdn.sap.com/irj/sdn/downloads under thenWidgets section
3: Create on your SAP XI system a function named ZZ_GET_MESSAGE_LIST
* *Here is the source code
FUNCTION ZZ_GET_MESSAGE_LIST.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(PERIOD) TYPE CHAR5 OPTIONAL
*" EXPORTING
*" VALUE(CMESSAGEOK) TYPE NUMC5
*" VALUE(CMESSAGEWAIT) TYPE NUMC5
*" VALUE(CMESSAGEKO) TYPE NUMC5
*" VALUE(CMESSAGEKOSYS) TYPE NUMC5
*"----
data: datefrom like sy-datum,
timefrom like sy-uzeit,
dateto like sy-datum,
timeto like sy-uzeit.
data: periodn(5) type n.
data: begin of tmsg occurs 0,
msgguid like sxi_message_data-msgguid,
msgstate like sxi_message_data-MSGSTATE,
end of tmsg.
data: listames type SXI_MESSAGE_DATA_LIST,
sdata type SXI_MESSAGE_DATA.
DATA: timestampfrom TYPE timestampl,
timestampto type timestampl,
dat TYPE d,
tim TYPE t,
tz TYPE ttzz-tzone,
filter type SXI_MESSAGE_FILTER.
periodn = period.
tz = 'CET'.
datefrom = sy-datum.
dateto = sy-datum.
timefrom = sy-uzeit - periodn.
*} REPLACE
if timefrom(2) eq '23'.
datefrom = sy-datum - 1.
endif.
timeto = sy-uzeit.
CONVERT DATE datefrom TIME timefrom DAYLIGHT SAVING TIME 'X'
INTO TIME STAMP timestampfrom TIME ZONE tz.
CONVERT DATE dateto TIME timeto DAYLIGHT SAVING TIME 'X'
INTO TIME STAMP timestampto TIME ZONE tz.
filter-from_time = timestampfrom.
filter-to_time = timestampto.
CALL FUNCTION 'SXMB_GET_MESSAGE_LIST'
EXPORTING
IM_FILTER = filter
IMPORTING
EX_MESSAGE_DATA_LIST = listames
EX_RESULT =
EX_FIRST_TS =
EXCEPTIONS
NOT_AUTHORIZED = 1
INTERNAL_ERROR = 2
TOO_MANY_MESSAGES = 3
NO_MESSAGE = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
ENDIF.
loop at listames into sdata where ref_to_msg
eq '00000000000000000000000000000000'.
move-corresponding sdata to tmsg.
collect tmsg.
endloop.
loop at tmsg.
case tmsg-msgstate.
when 001.
add 1 to cmessagewait.
when 003.
add 1 to cmessageok.
when 020 or
022 or
023 or
024 or
025.
add 1 to cmessageko.
when 021.
add 1 to cmessagekosys.
endcase.
endloop.
ENDFUNCTION.
imgTitle.data = " SAP XI Message Stats";
//messageOK.data = "message";
function callRFC(seconds)
{
include("PlatformUtil.js");
include("Common.js");
//timer function, used by the HTTP request class (DataLoader)
include("Timer.js");
//class for making HTTP requests
include("DataLoader.js");
//RFC request abstraction
include("RFCRequest.js");
//Class for all business logic
RFCRequest.setDefaultServiceProviderId("PXI");
_rfcReq = new RFCRequest();
rfcReq.setFunctionName("ZZGET_MESSAGE_LIST");
_rfcReq.addParam("PERIOD",seconds);
_rfcReq.execute(function(response){
// check response status
if (response.getStatus() != "S"){
// status is not "Success" show error message
alert(response.getStatusMessage())
return;
}
// status check success - set data to message label
messageOK.data = "Message correctly processed :"+response.getParam("CMESSAGEOK");
messageKO.data = "Message with application error:"+response.getParam("CMESSAGEKO");
messageKOSYS.data = "Message with system error :"+response.getParam("CMESSAGEKOSYS");
messageWait.data = "Message in waiting :"+response.getParam("CMESSAGEWAIT");
if (messageKO.data != 00000 || messageKOSYS.data != 00000) beep();
updateNow(); // force engine to redraw updates
});
}
callRFC(preferences.period.value);