Show TOC

Example documentationExample: Writing, Configuring, and Executing a Hook Extension

 

Prerequisites

You have working knowledge about SAP ME API and SAP MII Workbench.

You have downloaded the examples that are attached to SAP Note 1908404Information published on SAP site and imported SAPMEServiceExt/PreStartHook_CreateSFC to SAP MII Workbench. You can copy and use this extension as a template.

Writing a Hook Extension

Follow the process for Writing a Service API Extension described in Example: Writing, Configuring, and Executing a Service API Extension.

The input_xml property must be set based on the hook DTO corresponding to the hook point being extended. For example, StartHookDTO is associated with PRE_START and POST_START hook points (see Hook Points).

The output_xml property is not supported for hook extensions.

Configuring the Hook Extension
  1. In SAP ME, open the maintenance activity for the hook point to be extended. For example, use Operation Maintenance for PRE_START and POST_START hooks.

  2. Specify MII_TRANS_EXT as the hook point activity (see SAP MII Transaction Extension and Setting Up Activity Hooks).

  3. Specify the target SAP MII transaction name as well as input parameters in the User Argument field as follows: transactionName=SAPMEServiceExt/PreStartHook_CreateSFC;material_name=M1;material_version=A

    Each parameter assignment must be separated by a semicolon.

Executing the Hook Extension

To execute the hook extension, invoke an activity or plug-in in SAP ME that triggers the hook point. For example, adding an NC record and dispositioning triggers the PRE_DISPOSITION and POST_DISPOSITION hooks. In addition, the public API web services can be used to invoke the service methods which correspond to certain hook points.

The SAP ME user that is executing the transaction must have a role (for example, SAP_XMII_USER) that is authorized to read the SAP MII transaction.