Skip to Content
Technical Articles
Author's profile photo Andrew Hopwood

Using MII to send an IDoc XML directly to SAPMEINT

How to send an IDoc to SAPMEINT queue simulating the connection from SAP ERP

SAPMEINT, built with SAP MII is the standard connector between S/4 or ECC and SAP ME. It is a very flexible, customisable and extendable middleware application providing two-way integration of Messages. These Messages consist of IDocs in the direction from ERP to ME (called “inbound”) and RFC BAPI calls from ME to ERP (“outbound”). All IDoc Messages sent from ERP are stored to the SAPMEINT Message Queue and then processed by special MII scheduler job, called MessageDispatcher. The SAPMEINT Queue Monitor shows the status of each Message and the transformed request and response can be opened

Why might we want to?

For various reasons it can be useful to send IDocs that don’t come from SAP ERP: For example, we might want to test and debug a customised XSLT or SAPMEINT workflow such as a PRE_XSLT transaction, to reproduce a customer’s issue or a production issue on a non-production environment, or to measure performance impact of certain changes in a controlled way, or just to create testing master data in ME only without sullying ERP. Of course, since we’ve bypassed creating the data in ERP, then any outbound Messages associated with our data is likely to fail, but normally the error message will make the reason obvious.

What do we need?

We need SAP MII, ME and SAPMEINT installed, the version doesn’t matter very much, and developer access to the SAP MII Workbench.  And finally, we need the IDoc structure. The easiest way to get a sample IDoc is to open the Document Trace for a Message in the SAPMEINT Queue Monitor, and view the Original Document. But don’t copy directly from the browser or it won’t be valid XML; instead use “Save As” (Chrome or Firefox) or View Source then copy (all browsers)  and paste into a text editor. “WERKS” field in IDoc means the plant value, so to test with a different site from the source IDoc sample, simply change WERKS value to a supported Site in your system. For Shop Orders (LOIPRO IDocs), my preference is to add a rolling suffix letter to the AUFNR field. Copy the entire XML into your Clipboard ready for pasting later.

Are you sitting comfortably? Then let’s begin!

1. Login to SAP MII and open the Workbench.

2. Choose the desired folder and create New Transaction, save it and give it a name such as “SendingIDoc”.


3. Drag and drop Enqueuer action from SAP ME Integration group to transaction block.


4. In the Transaction tab, double click Transaction and press Add.


5. Set Data Type to XML and paste the IDoc XML into Value field.


6. We’re almost done! Double click on the Enqueuer action and press Configure Links button


7. You will see the Link Editor screen.

Here you should choose “document” property of Enqueuer_0 (1)

Expand “Transaction” and drag and drop “IDOC” to Expression or double click it (2)

Check that Target XPath and Expression looks exactly as below (3)

Then press Add button (4) (easy to forget to press this vital button!)

and then Close button (5) and Press OK


8. Save your transaction and we’re ready to execute it!


9. Either press the Test icon and OK, or from Transaction menu, choose Execute, then OK (or Cancel).


Expected result: IDoc message is immediately queued in the SAPMEINT Queue Monitor, just as if it was sent from ERP by DRFOUT, and will be processed the next time MessageDispatcher runs!


I hope you found this tip useful and simple to follow!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.