Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hi

In my previous blog post (Working with SAP NW BPM and SAPUI5: Using SAP NW BPMs OData-Services) I wrote about SAPUI5, and how to use the new OData Services provided by SAP.

I also wrote about problems using the OData-Service for starting a new SAP NW BPM Process. This blog posts provides the solution for these problems. We investigated the issue with Andre Backofen (andre.backofen) and it turns out the problem was our WSDL / Web Service used as Start service. It seems as a combination of anonymus complex types and naming clashes between operation and parameter caused the problem. When creating the demo I assembled the service and data type using eclipses defauld xsd / wsdl tools and haven't checked it again as it was validated by eclipse.

However, I'd like to share the new WSDL as well as the SAPUI5 view / controller with which I was able to successfully start a Process using BPM's OData Service.:

XSD Type:


<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Antrag" xmlns:tns="http://www.example.org/Antrag$" elementFormDefault="qualified">
    <complexType name="Antrag">
    <sequence>
    <element name="Mitarbeiter" type="string"></element>
    <element name="Vorgesetzter" type="string"></element>
    <element name="Titel" type="string"></element>
    <element name="Beschreibung" type="string"></element>
    <element name="Status" type="string"></element>
    </sequence>
    </complexType>
</schema>

WSDL:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/Start_Bewilligung_Async/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Start_Bewilligung_Async" targetNamespace="http://www.example.org/Start_Bewilligung_Async/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.example.org/Start_Bewilligung_Async/" xmlns:Q1="http://www.example.org/Antrag">
            <xsd:import schemaLocation="Antrag.xsd" namespace="http://www.example.org/Antrag"></xsd:import>
            <xsd:element name="Antrag" type="Q1:Antrag">
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="StartBewilligungRequest">
    <wsdl:part element="tns:Antrag" name="parameters"/>
  </wsdl:message>
  <wsdl:portType name="Start_Bewilligung_Async">
    <wsdl:operation name="StartBewilligung">
      <wsdl:input message="tns:StartBewilligungRequest"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="Start_Bewilligung_AsyncSOAP" type="tns:Start_Bewilligung_Async">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="StartBewilligung">
      <soap:operation soapAction="http://www.example.org/Start_Bewilligung_Async/StartBewilligung"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="Start_Bewilligung_Async">
    <wsdl:port binding="tns:Start_Bewilligung_AsyncSOAP" name="Start_Bewilligung_AsyncSOAP">
      <soap:address location="http://www.example.org/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

SAPUI5 view:


<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:c="sap.ui.commons"
  controllerName="demo.StartAntrag" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:html="http://www.w3.org/1999/xhtml">
  <Panel id="Panel">
  </Panel>
  <l:Grid
    defaultSpan="L12 M12 S12"
    width="auto">
    <l:content>
    <f:SimpleForm id="Formular"
        minWidth="1024"
        maxContainerCols="2"
        editable="true"
        layout="ResponsiveGridLayout"
        title="Antrag"
        labelSpanL="4"
        labelSpanM="4"
        emptySpanL="0"
        emptySpanM="0"
        columnsL="2"
        columnsM="2"
        class="editableForm">
        <f:content>
          <core:Title text="Antragsdaten" />
          <Label text="Titel" />
          <Input id="Titel" value="{/Titel}" />
          <Label text="Status" />
          <Select id="Status" selectedKey="{/Status}" width="100%">
            <items>
              <core:Item text="" key="" />
              <core:Item text="Entwurf" key="Entwurf" />
              <core:Item text="Beantragt" key="Beantragt" />
              <core:Item text="Bewilligt" key="Bewilligt" />
              <core:Item text="Korrektur" key="Korrektur" />
              <core:Item text="Abgelehnt" key="Abgelehnt" />
            </items>
          </Select>
          <Label text="Beschreibung" />
          <TextArea id="Beschreibung" value="{/Beschreibung}" rows="8" />
          <core:Title text="Beteiligte" />
          <Label text="Mitarbeiter" />
          <Input id="Mitarbeiter" value="{/Mitarbeiter}" />
          <Label text="Vorgesetzter" />
          <Input id="Vorgesetzter" value="{/Vorgesetzter}" />
        </f:content>
      </f:SimpleForm>
    </l:content>
  </l:Grid>
      <Bar>
        <contentRight>
           <Button id="Abschliessen" text="Bewilligungsprozess starten" press="handleAbschliessenPress" />
        </contentRight>
      </Bar>
</core:View>

SAPUI5 controller:


jQuery.sap.require("demo.Util");
jQuery.sap.require("sap.m.MessageBox");
sap.ui.controller("demo.StartAntrag", {
  getFormFragment : function() {
  return sap.ui.xmlfragment("demo.Antrag", this);
  },
  /**
  * Called when a controller is instantiated and its View
  * controls (if available) are already created. Can be used
  * to modify the View before it is displayed, to bind event
  * handlers and do other one-time initialization.
  *
  * @memberOf demo.Antrag
  */
  onInit : function() {
  var oPanel = this.getView().byId("Panel");
  this.antragModel = new sap.ui.model.json.JSONModel();
  this.getView().setModel(this.antragModel);
  var oMitarbeiter = this.getView().byId("Mitarbeiter");
  oMitarbeiter.setValue("Nyfeler Jan");
  oMitarbeiter.setEnabled(false);
  var oVorgesetzter = this.getView().byId("Vorgesetzter");
  oVorgesetzter.setValue("Nyfeler Jan");
  oVorgesetzter.setEnabled(false);
  var oStatus = this.getView().byId("Status");
  oStatus.setSelectedKey("Entwurf");
  oStatus.setEnabled(false);
},
handleAbschliessenPress : function() {
  var that = this;
  var startProcessSvcURL = "/bpmodata/startprocess.svc/novobc.ch/pr~pm~demo/Bewilligung";
  var oModel = new sap.ui.model.odata.ODataModel(startProcessSvcURL, true);
  var startData = {};
  startData.ProcessStartEvent = {};
  startData.ProcessStartEvent.Antrag = this.antragModel.getProperty("/");
  oModel.create("/StartData", startData, null, function(oData, oResponse) {
  sap.m.MessageBox.show("Der Prozess wurde erfolgreich gestartet. Sie können das Fenster schliessen.", sap.m.MessageBox.Icon.SUCCESS, "Prozess erfolgreich gestartet");
  }, function(oEvent) {
  sap.m.MessageBox.show("Fehler beim Prozessstart.", sap.m.MessageBox.Icon.ERROR, "Fehler beim Prozessstart");
  });
}
});

I'd like to thank Andre Backofen (andre.backofen) as well as my colleagues Patrick Wenger (patrick.wenger) and Werner Schwarz (werner.schwarz2) for their support.

Cheerio

Jan

Edit:

I'd like to mention that you have to use not the data object as mentioned in the official documentation BPM OData Service for Starting BPM Processes - Modeling Processes with Process Composer - SAP Librar... for starting a process but the used data type name instead

In  example I provided, data object name as well as data type name were the same so it worked.....

5 Comments
Labels in this area