Skip to Content

This document explains how to write custom plugins (XSLT / JAVA plug-in / MII Transaction) in SAPMEINT workflow for SAP ME 6.1

There are three types of workflow in SAP MEINT as listed below.

  • Standard Workflow
  • Split Workflow
  • Correlation Workflow

Detalied explanation of each workflow is not in scope of this document. Please see SAPMEINT application help on http://help.sap.com for details. Each of these workflow types has certain set of attributes. Below is an example of BOMMAT03 workflow, a Standard workflow, which is used for BOM integration.

/wp-content/uploads/2013/11/image2_329177.png

As shown in the above figure, each transaction or XSLT attribute is divided into three categories:

  • Default (optionally pre-shipped as part of SAPMEINT)
  • Partner (can be provided by partners and takes priority over default)
  • Customer (can be provided by customers and takes priority over default as well as partner)

Partners/Customers can write their own custom XSLT or transaction/java plug-in class and use it in the existing workflows. Details on how it can be achieved are covered in document below. 

Writing Custom XSLT

The custom XSLT’s are written in a similar way how it was done in SAP ME 6.0.

Steps to create and upload custom XSLT.

  1. Create a valid new XSLT using any of the XSLT editors for e.g. Altova XMLSpy, EditiX, Stylus Studio etc. Or copy and modify the existing xslt provided by SAPMEINT. 
  2. Open SAP MII workbench. Create a new local project say MEINTExtensions and upload the custom XSLT under WEB folder of WEB tab as shown below. You may choose to create a different directory structure.

   /wp-content/uploads/2013/11/image3_329178.png

 

Note: The MII workbench can also be used to customize the XSLT’s. The XSLT’s provided by SAPMEINT under Web tab will be available in read-only mode. For doing customizations on top of it, the user has to copy the XSLT under a local project manually. The XSLT then can be edited and saved.

3.   To use the custom XSLT in the workflow, just specify the fully qualified path in the following format as partner/customer XSLT.

WEB://<Project name>/<Folder Structure>/<XSLT name>

              

EXAMPLE

This example shows where in customer is trying to integrate custom Z_BOMMAT03 instead of BOMMAT03 which has an additional user field Z_BOMMAT03 /IDOC/ E1STZUM /Z_USER) which needs to be mapped to custom data in SAPME BOM as CUSTOM_FIELD.

/wp-content/uploads/2013/11/image4_329179.png

So the corresponding BOMRequest.xslt also needs to be modified to map the Z_USER field from idoc to custom field. Please see the snippet below, how the xslt needs to be modified.

/wp-content/uploads/2013/11/image5_329180.png

Now the xslt can be upload as specified in step 3.

Writing Java Plug-in Class

From SAP ME 6.1, with co-located enviornment (SAP ME and SAP MEINT running on same server), SAPMEINT is enabled to call SAP ME PAPI’s directly. There is no need to make a web service call to PAPI’s using SAPMEINT transactions. So in SAP ME 6.1 all the service transaction plugins are replaced from MII transaction to JAVA plug-in for all the existing inbound workflows.

The custom java plug-in can be used for various purposes except for making RFC/BAPI calls. Custom transaction (explained later in the document) is recommended for making RFC/BAPI calls to ERP because SAP MII framework provides a set of action blocks JRA/JCO for doing this.

Steps to create and upload custom java plug-in class.

  1. Open SAP NWDS (Netweaver Developer Studio), go to local development, right click and import SAPMEINT software component (SAPMEINT00_0.sca). Click Next and then Finish. SAPMEINT software component can now be added as a dependency to the local project.

  /wp-content/uploads/2013/11/image7_329182.png  

 

2. Navigate to “MyComponents” software component and add SAPMEINT as dependency.

/wp-content/uploads/2013/11/image8_329186.png

3. Create a new development component of type Java “meintextension” as shown below. Right click MyComponents -> New -> Development Component.

 

/wp-content/uploads/2013/11/image9_329187.png

/wp-content/uploads/2013/11/image10_329188.png

/wp-content/uploads/2013/11/image11_329192.png

4. Add xapps/me/integration/action DC and xapps/me/integration/libraries DC as a dependency to the newly created “meintextension” DC as shown below.

/wp-content/uploads/2013/11/image12_329193.png

5. Now a new java plugin class can be created.  The new class should implement processMessage method of PluginInterface. The signature of processMessage method is shown below

    /wp-content/uploads/2013/11/image13_329194.png

All the business logic should be written inside processMessage method of the plugin. Below are some usecases for this plugin.

  1. XML document enrichment (for e.g. enriching IDOC with supported plant data).
  2. PAPI calls to SAPME. Similar to SAPMEINT SCA, SAPME SCA (me.app.sca-6.X.X.X.sca) can also be added as a dependency and the required PAPI’s can then be used.
  3. Post processing if required (for e.g. as a Pass handler transaction or Fail handler transaction).

    

Code snippet for Java plugin

Package Name: com.sap.meint

Class name: ERPItemHandlerExtension

                Implements processMessage method of PluginInterface

/wp-content/uploads/2013/11/image14_329195.png

6. After creating the java plug-in class, export the project as a JAR. Select export destination as JAR file and click Next.

/wp-content/uploads/2013/11/image15_329196.png

Browse and specify the jar name and click on finish as shown below. Leave other entries as default.

/wp-content/uploads/2013/11/image16_329197.png

The exported JAR will now be available in the file system at the specified directory structure.

7. Upload the JAR in SAP MII.

     a. Go to SAP MII Admin screen. Navigate to System Resources -> Custom Actions.

     b. SAP MII has extended the functionality to upload dependency for the already deployed actions. Select the deployed SAPMEINT custom

         action named sap.com~xapps~me~integration~action~actions.mii-actions.jar and click on Upload Dependency.

     c. Browse and choose the JAR created in Step 6. The dependency is added as shown below.

  

   /wp-content/uploads/2013/11/image17_329202.png

8. The java plug-in created in Step 5 can now be used in SAPMEINT workflows. The URL has to be in the following format.

java:<Package Name>.<Class Name>

  1. Navigate to SAPMEINT Configuration -> Workflow Configuration
  2. Choose the workflow for which you want the custom implementation. For example Z_MATMAS03.
  3. Specify the java plug-in class as a Partner or a Customer transaction as shown below.

      /wp-content/uploads/2013/11/image18_329203.png

  d.   Save the changes made to the workflow. At the run time, the custom java plugin will get executed instead of the default Service transaction.

    

Note: MII transactions can still be used in SAPMEINT workflows. Java plugin’s don’t completely replace MII transactions rather it is another way of doing customizing in SAPMEINT. Java plugin’s are recommended over MII transaction because of better performance.

Writing Custom Transaction

The custom MII transactions are written in a similar way how it was done in SAP ME 6.0. But from SAP ME 6.1 there is a new custom action block available to call SAP ME API’s directly from SAPMEINT instead of making a web service call.

The custom transaction can be used for various purposes depending upon the requirement. Some of the use cases are as follows:

  1. It can be used for data enrichment. For example if the idoc sent by ERP to SAPMEINT is missing some information and needs to be enriched with some additional information. User may choose to retrieve this information from various other sources like by making a BAPI call, or from SAPMEINT DB, or from some third-party web service etc.
  2. It can be used for making PAPI calls to SAPME. User can write a custom transaction to make a PAPI call to SAPME (the same can be achieved via writing a java plug-in class, which is explained above in the document). SAPMEINT provides new custom action block named SAPME PAPI Interface in MII for making PAPI calls to SAPME. Writing a custom transaction is recommended when a user wants to call a BAPI and a PAPI in a single transaction, but If only SAPME PAPI is required then writing a Java plug-in class is recommended.
  3. It can be used for doing post processing. For example as a pass handler transaction or a fail handler transaction in SAPMEINT workflow.

   

  Steps to create and upload custom transaction. 

  1. Open SAP MII workbench.
  2. Create a new local project “MEINTExtensions” under Catalog tab. Create folder structure as desired to group the transactions. Then create a custom transaction
    1. By implementing the IPluginHandler: IPluginHandler transaction ensures, the input and output variable for a transaction remains consistent with other transactions of SAPMEINT which are used in workflows. IPluginHandler transaction available at following path

                      Visiprise/ERPShopFloorIntegration/frame/workflow/IPlunginHandler 

          b.   By modifying the existing transactions: Copy and paste the existing transaction in the local project structure and do the customizations on top of

                it. In this case, user will not have to write the entire implementation from scratch.

Transaction Input/Output Parameters

Property Name

Type

Description

inputXML

Input

The input XML passed to “custom transaction” by SAPMEINT.

params

Input

The value of the “custom transaction Params” passed to  “custom transaction” by SAPMEINT.

plant

Input

The plant value passed to “custom transaction” by SAPMEINT.

recordId

Input

The id of the Message Queue passed to “custom transaction” by SAPMEINT. It is nothing but SAPMEINT_MESSAGE _QUEUE_ID.

typeId

Input

The document type value passed to “custom transaction” by SAPMEINT.

status

Output

The status of “custom transaction”. Developer should set this to one of the following values:

  • PASSED – when “custom transaction” executes successfully without any error.
  • APP_ERROR – set the status to “APP_ERROR” when this “custom transaction” failed on business application error. In this case, the message will not be retried.
  • SYS_ERROR – set the status to “APP_ERROR” when this “custom transaction” call failed on system error. In this case, message will be retried.

  

message

Output

Developer can set the correct error message when this transaction fails for some reason.

outputXML

Output

Developer should set the outputXML and this outputXML will be used as an input for further steps in the workflow.

/wp-content/uploads/2013/11/image6_329181.png

     3. To use the newly created transaction in the workflow, just specify the fully qualified path in the following format as partner/customer transaction.

<Project name>/<Folder Structure>/<Transaction name>

To report this post you need to login first.

2 Comments

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

  1. Salvatore Castro

    Nice job on the BLOG and this does clearly outline what is required and extensible the ME-INT interface really is.

    One comment though on this note in the above:

    Note: MII transactions can still be used in SAPMEINT workflows. Java plugin’s don’t completely replace MII transactions rather it is another way of doing customizing in SAPMEINT. Java plugin’s are recommended over MII transaction because of better performance.

    The operation of your custom Java code will likely perform better than the MII Logic Engine but the operation of the Logic Engine transactions is supported by SAP standard support but your custom Java code will not be part of standard support.  So this is one thing to consider and I would weigh this against how fast the asynchronous message processing needs to be as shaving milliseconds off of a background process will likely not impact the overall system.

    Sam

    (0) 

Leave a Reply