Skip to Content

Objective:

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.

Pre-requisites:

  • 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=”http://www.sap.com/me/production“>

  <production:contextList>

    <contextGBO>

      <value>OperationBO:SITE,O1,A</value>

      <handleClassName>com.sap.me.frame.BOHandle</handleClassName>

    </contextGBO>

    <contextGBO>

      <value>ResourceBO:SITE,DEFAULT</value>

      <handleClassName>com.sap.me.frame.BOHandle</handleClassName>

    </contextGBO>

    <contextGBO>

      <value>sfcStepBO:sfcBO:SITE,SFC001</value>

      <handleClassName>com.sap.me.frame.BOHandle</handleClassName>

    </contextGBO>     

    <contextGBO>

      <value>RouterStepBO:RouterBO:SITE,O1,U,A,010</value>

      <handleClassName>com.sap.me.frame.BOHandle</handleClassName>

    </contextGBO>

  </production:contextList>

  <production:hookPoint>POST_COMPLETE</production:hookPoint>

  <production:sfcDone>true</production:sfcDone>

  <production:qtyDone>10</production:qtyDone>

  <production:sfcBO>

    <value>SFCBO:SITE,SFC001</value>

    <handleClassName>com.sap.me.demand.SFCBOHandle</handleClassName>

  </production:sfcBO>

  <production:operationBO>

    <value>OperationBO:SITE,O1,A</value>

    <handleClassName>com.sap.me.productdefinition.OperationBOHandle</handleClassName>

  </production:operationBO>

  <production:resourceBO>

    <value>ResourceBO:SITE,DEFAULT</value>

    <handleClassName>com.sap.me.plant.ResourceBOHandle</handleClassName>

  </production:resourceBO>

  <production:routerStepBO>

    <value>RouterStepBO:RouterBO:SITE,O1,U,A,010</value>

    <handleClassName>com.sap.me.frame.BOHandle</handleClassName>

  </production:routerStepBO>

  <production:userBO>

    <value>UserBO:SITE,USER</value>

    <handleClassName>com.sap.me.user.UserBOHandle</handleClassName>

  </production:userBO>

  <production:txnStartDateTime>2013-04-16T10:18:11.160-04:00</production:txnStartDateTime>

</production:postCompleteHookDTO>

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

Source

Target

Site_SFC_assignment

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

Local.lv_sfcRefCommaPosition

Site_SFC_assignment

stringlength(“SFCBO:”)

Local.lv_sfcRefprefix

Site_SFC_assignment

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

Local.lv_site

Site_SFC_assignment

stringlength(Transaction.input_xml{/production:postCompleteHookDTO/production:sfcBO/value})

Local.lv_sfcBOlen

Site_SFC_assignment

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

Local.lv_sfc

Userassignment

stringlength(Transaction.input_xml{/production:postCompleteHookDTO/production:userBO/value})

Local.lv_userBOlength

Userassignment

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

Local.lv_userBORefcompos

Userassignment

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

Local.lv_user

Send_Mail_0

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

Send_Mail_0.Subject

Send_Mail_0

“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}

Send_Mail_0.Message

Assignment_0

Transaction.input_xml

Transaction.output_xml

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.

References:

  • For getting the complete postCompleteDTO xml, you can refer to Java docs. It can be found in service market place – service.sap.com/swdc -> 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.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Anuj Jain

    Hi,

    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?

    (0) 
    1. 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

      (0) 
      1. Anuj Jain

        Hey Steve,

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

        Regards

        Anuj Jain

        (0) 

Leave a Reply