Show TOC

Procedure documentationExample: Writing, Configuring, and Executing a Service API 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/PreCreateStart_CreateSFC to SAP MII Workbench. You can copy and use this extension as a template. After copying, the SAP ME public API actions in this example must be configured with the correct site.

Procedure

Writing a Service API Extension

You write service API extensions in SAP MII Workbench (see SAP MII Workbench).

  1. In SAP MII Workbench, create a new transaction.

  2. Add a transaction property with the name input_xml and data type xml.

  3. Set the value of the input_xml property.

    The value is set as follows based on the incoming request DTO of the service method being extended. For more information, see SAP ME Javadoc at Start of the navigation path http://service.sap.com/instguidesInformation published on SAP site Next navigation step SAP Business Suite Applications Next navigation step SAP Manufacturing Next navigation step SAP Manufacturing Execution End of the navigation path.

    Example Example

    Module: com.sap.me.production

    Service: SfcStartService

    Method: createAndStart

    DTO: CreateAndStartSfcRequest

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <createAndStartSfcRequest xmlns="http://www.sap.com/me/com.sap.me.production">

    <sfc>SFC1</sfc>

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

    <resourceRef>ResourceBO:SITE,DEFAULT</resourseRef>

    <confirmed>false</confirmed>

    <checkWorkCenterAssignment>true</checkWorkCenterAssignment>

    <workStationRef>WorkstationBO:SITE,O,OPERATION_DEF</workStationRef>

    </createAndStartSfcRequest>

    End of the example.
  4. Add a transaction property with the name output_xml and data type XML and select the Output Parameter checkbox.

  5. Set the value of the output_xml property to the same value that was set in step 3 for the input_xml property.

  6. Create actions in the SAP MII transaction that are needed to carry out the custom logic. You can reference incoming values as needed in the input_xml property.

  7. If the SAP MII transaction needs to pass modifications to the incoming request back to the service, then create an action that modifies the output_xml property.

  8. Configure the security for the transaction by assigning the appropriate Reader Roles. The SAP ME user that will trigger the transaction must have a role (for example, SAP_XMII_USER) that is authorized to read the SAP MII transaction.

Configuring the Service API Extension

You configure service API extensions in Service Extension Maintenance (see Service Extension Maintenance).

  1. In SAP ME, in Service Extension Maintenance, search for the target service method to be extended.

  2. Select the method in the search results.

  3. Choose New Extension.

  4. Select the execution point.

  5. Enter a name for the extension.

  6. Enter MII_TRANS_EXT as the extension activity (see SAP MII Transaction Extension).

  7. On the Options tab page, enter the parent translation folder and the name of the transaction created above in the TRANSACTION_NAME field.

  8. Enter any parameters to be passed to the SAP MII transaction in the PARAMETERS field as follows: material_name=M1;material_version=A

    Each parameter assignment must be separated by a semicolon.

  9. Save your entries.

Executing the Service API Extension

To execute the extension, start an activity or plug-in in SAP ME that triggers the service extension method.

For example, adding an NC record calls createNC().

In addition, the public API web services can be used to invoke the service methods directly.

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.