Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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.

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.

  

 

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.

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.

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.

    

 

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

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

 

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.

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

   

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

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

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

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.

  

  

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.

     

  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.

     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>

2 Comments
Labels in this area