Skip to Content
Author's profile photo Adithya K

How to use MII transaction extension as an Activity Hook inside SAP ME


The objective of this blog is to showcase “How to use MII transaction as an extension inside SAP ME?”. In this blog, I will take a simple example of sending an email upon Completion of an operation in ME leveraging MII transaction as an extension in Activity Hook.


  • Basic knowledge of MII transaction creation
  • Basic knowledge of SAP ME usage and execution
  • Email server setup in SAP MII server
  • SAP ME should be greater than version 6.1

Example Scenario setup

Talking about example scenario, I have got a requirement where we need to send an Email upon Completion of last operation. So, I was exploring multiple options for the same. Out of which, Steve Stubbs help me figured out this method. First, I have created a simple BLS transaction in SAP MII, which has minimal steps.  It will send an Email in the following format:

Final Email Format.jpg

In order to get the individual field values like Plant,  SFC number, Processed By and Timestamp, we need to create few Assignment steps in BLS to transform input data to required fields.

MII Transaction setup:

Create  a new BLS transaction creation and set the following properties shown below.

Transaction properties:

Transaction properties.jpg

Input_XML attributes:

          Input XML.jpg

As mentioned before, we need to send an email after completion of an Operation in ME. So, in order to achieve that, we need to use “postCompleteHookDTO” related XML content. You can get the information about the XML from Java Docs of SAP ME help. Here is the sample XML for the same.

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?><production:postCompleteHookDTO xmlns:production=”“>












































Output XML attributes:

          Output XML.jpg

We can map the same XML content mentioned for Input_XML as value here.

Local transaction properties:

Local Properties.jpg

All the properties mentioned in the above snapshot are of type “String”.

Here is the snapshot of the new MII transaction create with various steps information.

MII BLS transaction details.jpg

Table of parameters mapped in each step

Step name










stringpart(Transaction.input_xml{/production:postCompleteHookDTO/production:sfcBO/value},Local.lv_sfcRefprefix+1,Local.lv_sfcRefCommaPosition – Local.lv_sfcRefprefix – 1)






stringpart(Transaction.input_xml{/production:postCompleteHookDTO/production:sfcBO/value},Local.lv_sfcRefCommaPosition+1,Local.lv_sfcBOlen – Local.lv_sfcRefCommaPosition)






stringindexof(Transaction.input_xml{/production:postCompleteHookDTO/production:userBO/value}, “,”)



stringpart(Transaction.input_xml{/production:postCompleteHookDTO/production:userBO/value},Local.lv_userBORefcompos+1,Local.lv_userBOlength – Local.lv_userBORefcompos)



“SFC  ”  &Local.lv_sfc  &” processing is completed”



“Local SFC:” &Local.lv_sfc & crlf & crlf &

“SUMMARY: SFC is completed SEE DETAILS BELOW.” & crlf & crlf &

“Plant:”& Local.lv_site &crlf &

“SFC Number:” &Local.lv_sfc &crlf &

“Processed By: ” & Local.lv_user& crlf & “DateTime:” &Transaction.input_xml{/production:postCompleteHookDTO/production:txnStartDateTime}   &crlf &

“Status:” &Transaction.input_xml{/production:postCompleteHookDTO/production:sfcDone}





SAP ME configuration:

As mentioned in my objective,  we can achieve the requirement of sending email upon completion of operation by setting up the MII transaction as Activity hook. It’s a very simple step of setting up this on ME side, but it does good job of performing the action we need.

Choose Activity as MII_TRANS_EXT and user argument should be of format transactionName=project/folder/folder2/trxname;

Here is the snapshot of the configuration in the Operation Maintenance step of SAP ME

Operation maintenance - Activity hook properties.jpg

Once the setup is saved. You can continue testing your SFC execution in the operation configured. It will try to send an email as shown in the beginning of the blog.


  • For getting the complete postCompleteDTO xml, you can refer to Java docs. It can be found in service market place – -> Installation guies->SAP Business Suite Applications->SAP Manufacturing->SAP Manufacturing Execution->SAP Manufacturing Execution 6.1

Thus, I would conclude that MII service extension is one of the powerful tool provided by SAP in SAP ME, where we can leverage it numerous ways for custom processing logic handling similar to User Exits, BADI’s or any other enhancements provided by SAP. I would like to Thank once again Steve Stubbs for helping me solving the issues when I started working on this requirement. Since, it was pretty new system for us, there were number of OSS notes that we need to go through in order to setup the Service extensions successfully. However, at the end we realized its fruitful.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member


      I have been trying the same thing. I have a transaction, which i am trying to call through SAP ME on POST_COMPLETE hook using MII_TRANS_EXT

      However, i am getting this error saying:

      SAP MII transaction PROJECT/TRANSACTION_NAME failed with message: Unable to execute transaction: PROJECT/TRANSACTION_NAME.trx (Message 10059)

      can you help me out with this?

      Author's profile photo Steve Stubbs
      Steve Stubbs

      Hi Anuj,

      Did you follow SAP Note 1908404 about MII Transaction Extensions?

      Which versions of MII and ME?

      Which DB is used for ME WIP and ODS?

      Regards, Steve

      Author's profile photo Former Member
      Former Member

      Hey Steve,

      Thanks for the reply. We went through the 1908404 Note, and found that the wipPool was not configured as XA datasource.


      Anuj Jain

      Author's profile photo Former Member
      Former Member

      Hi All,

      I am calling a MII transcation from activity hook as mentioned above. I have attached it to PRE_START of the opeartaion.

      Now, Based on the Transaction result, I want to start/abort the START activity.

      Is that possible?