Skip to Content

Super Message Monitor for SAP XI

h3. Introduction   Once I was asked: “Hey Alex, is there a standard way we can use for searching XI messages in SXMB_MONI given the SAP IDoc number?”. So I looked a little bit around in the XI ABAP stack, without success. That’s a why I decided to enhance the message monitor and make this and other search ways possible.  This weblog assumes you are a little bit familiar with ABAP coding, but I will try – as usual – to keep so simple that even without this knowledge one should be able to replicate it! By the way, if you have a look at this forum thread  (Creating/Modifying adapter?), you’ll see that the need for ABAP skill in XI it’s still a matter of deep controversy, partially deriving from the stimulating ABAP/Java+ war+, and you could also read a couple of opinions o’ mine, for what it’s worth. I think the job I’m about to describe here it’s kinda proof for my (and others’) position, but this is another story.   Let’s get built our XI Super Message Monitor!    *When you’ll be finished coding up (approx. time needed 60 minutes), you’ll be able to search XI messages for IDoc number and IDoc type both sender and receiver, and – believe to the unbelievable – even for message content (payload)!! *This first version only searches the Inbound payload, that is before mapping takes place, but I will soon release a new one with the ability to choose it.    Image   No standard code will be opened to changes, just a copy it’s made, so don’t worry about it. 🙂  h3. Let’s go   First of all your user needs to be registered as a developer in XI ABAP stack: check out SCCR   (http://service.sap.com/sscr)for this purpose.  Now that you have the power of building ABAP stuff, go to ABAP Developmemt Workbench (trx SE80) and create a new package that will contain all our custom objects.    Image  Image   You’ll be asked for a workbench change request (which is basically a container for things we’ll create that you will use when you want to transport everything to consolidation and production box): I suggest you create a new one, give it a meaningful name (such as “XI Super Monitor”) and choose it. It will be automatically proposed afterwards.  The big ABAP program behind trx SXMB_MONI is RSXMB_SELECT_MESSAGES, which we need (along with other includes) to duplicate. To do this – always from SE80: we’ll never move from here more or less! – choose +Program +from the upper left combo, type RSXMB_SELECT_MESSAGES in the edit box below it and press enter. Now right click on the program name, choose Copy… and a popup will ask you the name of your new program. Choose a suitable prefix for all the objects, +ZXIMONI+ could be a good choice as it also reflects the package name (a warning will popup: if you don’t like its message choose somthing else like +ZMONI+, otherwise just confirm).    Image   In the next popup you’re asked for which components of the program you’d like to copy: flag everything and confirm.   Image   In the next popup you’re asked to give new names to include programs: we need to duplicate only 2 of them actually (flagged in the picture below), but if you feel more confortable by working on custom objects only, just copy all of them and give them the same name with the above said prefix (+ZXIMONI_+ or +ZMONI_+).   Image
28 Comments
You must be Logged on to comment or reply to a post.
  • hi Alessandro:)

    I thought about similar solution many times
    before trex indexing but it looks like you did it 🙂
    (I’ll check it first thing in the morning)

    but it looks great 🙂
    the thing that worries me is the performance
    just like WE09 for idocs it searches
    from the database which might not be the
    best option if you have 20.000 messages a day…

    but great contribution anyway! 🙂
    can’t wait till morning! 

    BTW
    did you have a look at IDX5 ?

    Regards,
    michal

    • I assumed it’s day already :P:))

      It seems to work if you search messages
      which have the xpath if the message does not
      have it I can see an exception
      but it’s not a problem 🙂

      great! 🙂

      Regards,
      michal

      • Hi Michal,
        Yes I know IDX5, but I wanted something integrated…
        About exception on xpath, can you tell me exactly in which situation it occurs so that I can fix it for everybody?
        Appreciate your help.

        Thanks,
        Alex

        • hi,

          I’m not sure but try to search through
          messages which do not have the xpath
          the you give (so 2 different structures)

          but I only did a few test so I’m not sure if this is – but does it work on your system when the message does not have the xpath ?

          Regards,
          michal

          • Actually yes. These lines of code…

            IF NOT el IS BOUND.
            * Element not found, so delete message
            DELETE gt_msgtab.

            … should ensure that if the path is not found the message is deleted (correctly, ’cause filter doesn’t match).
            The only big thing that I have not protected is DOM creation, for which a non-xml payload (e.g. plain text) could make the code crash… I’ll just surround it with a try-catch.

            Regards,
            Alex

          • Very good Blog Alex.
            As a matter of fact,i m having the exact same issue whcih you mentioned above,i m getting exception “CX_SY_REF_IS_INITIAL” when the incoming payload is a flat file.
            Could you please let me know how to add the Try-Catch block to handle this.
            Really appreciate your effort.
            Thanx
            Saif
  • This is some thing which I actually want to try it out but was lazy to code in ABAP..:)…
    We can actually enhance it such that we can search the payload by any field of XSD…;)
  • Bless you!  

    We send PO’s out to a third party and at any point they can send the response.   We send about 300 PO’s a day and the responses can come back at any time.   We would have to search payloads to find the response and if one had not come back we could search for days.

    This has taken the search from hours and days to minutes and seconds.

    Perfect!.
    Thanks,
    Dave

          • Hey Alex,

            First of all, let me tell you that the super monitor is a great feature. Really happy with it. I had a question though for seacrhing within multiple nodes, in your example


             

                 00123
             

             
                 123
             

             
                 456
             

             
                 …
             

            If I want to search for Number with value ‘456’. How can one search within multiple Item Nodes for a particular value?

            Any suggestion would be great.

            Thanks,
            Hash

          • Hash,
            I don’t think it’s gonna work “as-is”…
            You’ll need to play around a bit with the FIND_FROM_PATH method of the IF_IXML_ELEMENT interface…

            Regards,
            Alex

  • Hi,

    This is really an excellent stuff..Thanks so much..But when I tried to search for archived messages it was not able to search for it..Any solution to this as well plz? This is necessary as at times we need to find PO’s w for messages which have been archived.

    Thanks.

    • Sorry, search in archives is based on a completely different transaction and method…
      You should try to code something yourself, by crossing my code with RSXMB_READ_ARCHIVED_MESSAGES standard program.

      Regards,
      Alex

  • Hi Alex,

    I was searching for payloads. But whatever I type into the search filed I am alway getting the same messages. Even then if I type words which are definately not in the payload.
    Maybe I did someting wrong while creating all thhis stuff… 🙁 Do you have an idea?

    Thanks and Regards,
    Sebastian