Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member188972
Active Contributor
0 Kudos
The instruments of monitoring in XI gives good possibility to display the state of the messages in the different persistence layers in which they are stored in XI.    But often the main issue from the customers is not easy tenable through the standard instruments of the monitor.   Normaly, the question is:  “every day an external system sends a colplete elaboration to XI into a unique file, in the file there are many messages that will be elaborated in XI and then posted in an application (es. an R/3). How we can understand when the complete elaboration of these messages in XI is finished? I'd like to know that with a message or an event in order to start a second elaboration and so on.” I premise that for a narrow number of messages this job could be carried out from a BPM, but normally the previewed volume is critical for the performances of the BPM and so it isn't a reasonable way.   I introduce in this blog which is the smart and simple solution that I found in different experiences.       The basis idea is to identify an elaboration with a key to the correspondent flow, the key can be defined gives:   •     Business system sender   •     Interface name sender   •     Business system receiver   •     Interface name receiver   •     Party sender   •     Party receiver    For every elaboration we must know in advance how many records the Legacy system have been sended to XI. In base of the used source system or the adapter different ways can be followed, as an example:   1. Is the same source system that with a separate message transmits how many messages has been sended.   2. In the file adapter can be inserted a script that counts how many records are contained and calls  XI in RFC to transmit how many records must expect.  In this example the number of records is identified by a particular string: # FILENAME=$1 # STRING_TO_SEARCH=$2 cc=`cat $1 | grep ^$2 | wc -l` /usr/sap/XI1/SYS/exe/run/startrfc -h SYSTEMNAME -s 02 -u USERNAME -p PASSWORD -c 100 -l EN -F Z_CUSTOMFUNCTION_MSG_IN -E KEYOFFLOW -E NRMSG_IN=$cc    3. For SAP systems, it will be one function ad hoc to count the messages to send in one single elaboration. In the case of Idocs, is necessary to to create a copy of the standard program RSEOUT00 which counts the messages and send the information to XI.    4. If the sender is an Integration engine, the same BPM will count and send the information to XI.      The information of the flow and the expected messages for the elaboration is inserted in one custom table. We're going to know when the messages have finished the elaboration.      Normally we use two custom table, one to define the flow to monitor (and understand which are active) and one to write the logs of the single flows. In this way is possible to make a smart monitor for our scope.  In order to control how many messages have been elaborates a batch program runs periodically. The program uses the standard function SXMB_SELECT_MESSAGES, pay attention to the correct call to optimize the performances. The function will be called many times to know if the elaboration is ended also in sender adapter or there are errors.   Here some samples of call:  * Check message with status group "Processed Successfully" and Technical * Inbound/Outbound Channel Type" = "IDOC" (IDoc Adapter) and "Outbound * Status" = '006' (Message executed successfully on outbound side)

  STATTYPE = '1'.
  CALL METHOD CL_XMS_PERSIST_ADM=>GET_MSTAT_TABLE
    EXPORTING
      IM_STAT_TYPE = STATTYPE
    IMPORTING
      EX_MSTAT_TAB = STAT_OK.
  CALL FUNCTION 'SXMB_SELECT_MESSAGES'
    EXPORTING
      IM_EXEDATE           = FLOW-DATE_START
      IM_EXETIME           = FLOW-TIME_START
      IM_EXE2DATE          = TOMORROW
      IM_PIDS              = LT_PIDS
      IM_ADAPTER_TYPE      = 'IDOC'
      IM_ADAPTER_STATE     = '006'
      IM_S_SENDER_RECEIVER = LS_SXMSPEMAS
      IM_MSGSTATE_TAB      = STAT_TAB_OK
      IM_NUMBER            = '9999999'
    IMPORTING
      EX_MSGTAB            = GT_MSGTAB
      EX_RESULT            = L_RESULT

.......................
.......................
* Check message with status group "Processed Successfully" and Technical
* Inbound/Outbound Channel Type" = "AENGINE" (Adapter Engine) and
* "Outbound Status" = '000' (Not defined)
  CALL FUNCTION 'SXMB_SELECT_MESSAGES'
    EXPORTING
      IM_EXEDATE           = FLOW-DATE_START
      IM_EXETIME           = FLOW-TIME_START
      IM_EXE2DATE          = TOMORROW
      IM_PIDS              = LT_PIDS
      IM_ADAPTER_TYPE      = 'AENGINE'
      IM_ADAPTER_STATE     = '000'
      IM_S_SENDER_RECEIVER = LS_SXMSPEMAS
      IM_MSGSTATE_TAB      = STAT_TAB_OK
      IM_NUMBER            = '9999999'
    IMPORTING
      EX_MSGTAB            = GT_MSGTAB
      EX_RESULT            = L_RESULT
........................
.......................
* Check message with status group "Errors"
* Channel type = any
  STATTYPE = '4'.
  CALL METHOD CL_XMS_PERSIST_ADM=>GET_MSTAT_TABLE
    EXPORTING
      IM_STAT_TYPE = STATTYPE
    IMPORTING
      EX_MSTAT_TAB = STAT_TAB_KO.

  CALL FUNCTION 'SXMB_SELECT_MESSAGES'
    EXPORTING
      IM_EXEDATE                 = FLOW-DATE_START
      IM_EXETIME                 = FLOW-TIME_START
      IM_EXE2DATE                = TOMORROW
      IM_PIDS                    = LT_PIDS
*     IM_ADAPTER_STATE           =
      IM_S_SENDER_RECEIVER       = LS_SXMSPEMAS
      IM_MSGSTATE_TAB            = STAT_TAB_KO
      IM_NUMBER                  = '9999999'
   IMPORTING
      EX_MSGTAB                  = GT_MSGTAB
      EX_RESULT                  = L_RESULT
*       EX_FIRST_TS                =
............................
............................
Others call are required in function of the adapters involved, normally is necessary to manage the parameters IM_ADAPTER_TYPE and IM_ADAPTER_STATE.  Many thanks to my colleague Francesco Menchise that help me much about the realization of this kind of monitor.
7 Comments