SAPUI5 and oData: Task completion problem

Dear all,
We've got a BPM process which is based on WDJ approval screens.
Now I would like to replace WDJ by SAPUI5.
I've succeeded to display some task input data in my SAPUI5 application:
oPanel.bindElement("/InputData('"+taskId+"')", {expand:"ContextTypeINPUT/Context/Requester"});
var oInputFirstName = new sap.ui.commons.TextField("textFirstName", {
    value : "{ContextTypeINPUT/Context/Requester/FirstName}"
var oInputLastName = new sap.ui.commons.TextField("textLastName", {
    value : "{ContextTypeINPUT/Context/Requester/LastName}"
But I can't manage to complete the task.
For a simpler example that worked for me.
It seems that I don't fill the output data correctly.
Normally I should fill the Status (fields Action, ChangedBy, ChangedOn and Details) and the Request->ReferenceNumber:
Please find attached the XSD of the task.
I tried the following:
var outputData = {};
var status = odataModel.getProperty("/InputData('" + taskId "') " +
                  "/ContextTypeINPUT/Context/Status");
status.Action = "approved";
status.ChangedBy = "TEST";
status.ChangedOn = "2014-07-29";
outputData.HandleRequestCompleteEventTypeOUTPUT = status;
// send request to BPM Task Data OData service to complete
odataModel.create("/OutputData", outputData, null,
    function sendData_OnSuccess(oData, response) {
        alert("Task has been completed successfully");
    function sendData_OnError(oError) {
        alert("Task could not be completed");
But it stops when executing the second statement (var status = odataModel.getProperty("/InputData('" + taskId "')...).
I would really appreciate if you could help me!
Thanks in advance.
Best regards,
Thorsten.
P.S.: Our system is running NW 7.40 SP07.

Hi again,
As most of the time, I had to solve my issues published on SCN on my own
My mistake was, that I've retrieved the 'handleRequestType' of my OutputData from the InputData.
It seems that having all subtypes in the structure causes trouble, because I fill only to fill two fields.
In the end I build OutputData myself and it works now...
So in fact it's possible to create an proper OutputData without a binding of InputData.
controller.js
completeTask : function() {
// Get TaskID and data model
var taskId = getValueOfURLParameter("taskId");
var odataModel = this.getView().getModel();
// Create OutputData
var outputData = {};
// Create all needed subtypes
var handleRequestType = {};
var status = {};
var request = {};
// Fill values for fields that need to be sent
status.ChangedBy = sap.ui.getCore().byId("inputStatus").getValue();
request.ReferenceNumber = sap.ui.getCore().byId("inputRequest").getValue();
// Build OutputData
handleRequestType.Status = status;
handleRequestType.Request = request;
outputData.HandleRequestType = handleRequestType;
// Complete task with built OutputData
odataModel.create( "/OutputData", outputData, null,
     function sendData_OnSuccess(oData, response) {
          alert("Task has been completed successfully");
     function sendData_OnError(oError) {
          alert("Task could not be completed");
view.js
createContent : function(oController) {
// Text input fields which will feed the OutputData
var oInputStatus = new sap.ui.commons.TextField("inputStatus");
var oInputRequest = new sap.ui.commons.TextField("inputRequest");
// Button to complete the task
var oButton = new sap.ui.commons.Button( {
     text : "Complete",
     style : sap.ui.commons.ButtonStyle.Accept,
     press : (function() {
     oController.completeTask();
Just make sure that you explore your OuputData before via a tool like Postman (Chrome Addon).
First do a GET request:
http://<host>:<port>/bpmodata/taskdata.svc/<taskID>/OutputData
Then look for a "/XYZ" part in the response.
In my case it looked like that:
<link href="OutputData('<TaskID>')" rel="edit" title="OutputData"/>
<link href="OutputData('<TaskID>')/HandleRequestType" .../>
So I could go on to explore my output data, by sending the following GET request in Postman:
http://<host>:<port>/bpmodata/taskdata.svc/<taskID>/OutputData?$expand=HandleRequestType
Now you have to repeat that until you find the data type that you want manipulate.
If you found out how your OutputData looks like, you can build it easily on your own (see my controller.js).
Maybe I'll write my first blog about it

Similar Messages

  • SAPUI5 and OData dynamic Login

    can anybody share some standard code that sapui5 and odata dynamic login screen navigation ?
    Means User has to pass input Username and Password atrun time and get login.
    Thank you in advanced

    I am getting error at validation time but in browser it is working fine.
    The error is Unauthorised credential.
    I want to pass the credential in the following fields when I enter login ,I want to pass the values to SAP.
    I am using the following code:
    var oLayout = new sap.ui.commons.layout.AbsoluteLayout({width:"340px",height:"150px"});
    oLayout.addStyleClass("CustomStyle"); //Add some additional styling for the border
    var oLabel = new sap.ui.commons.Label({text:"User Name"});
    var oNameInput = new sap.ui.commons.TextField({width:"190px"});
    oLabel.setLabelFor(oNameInput);
    oLayout.addContent(oLabel, {right:"248px",top:"20px"});
    oLayout.addContent(oNameInput, {left:"110px",top:"20px"});
    oLabel = new sap.ui.commons.Label({text:"Password"});
    oPWInput = new sap.ui.commons.PasswordField({width:"190px"});
    oLabel.setLabelFor(oPWInput);
    oLayout.addContent(oLabel, {right:"248px",top:"62px"});
    oLayout.addContent(oPWInput, {left:"110px",top:"62px"});
    var oLoginButton = new sap.ui.commons.Button({text:"Login",  press :"login", width:"133px"});
    //oLoginButton.attachPress(login());
    oLayout.addContent(oLoginButton, {left:"110px",top:"104px"});
    // Attach the layout to the page
    oLayout.placeAt("content");
    </script>
      <script>
      login : function(oEvent) {
          jQuery.sap.require("sap.ui.model.odata.datajs");
          var serviceURI = "http://192.168.0.7:8000/sap/opu/odata/sap/YNEW_SRV/";
                    var username = sap.ui.getCore().getControl("oNameInput") .getValue();
                    var password = sap.ui.getCore().getControl("oPWInput") .getValue();
          var request = {
                    headers : {
                                      "X-Requested-With" : "XMLHttpRequest",
                                       "Content-Type" : "application/atom+xml",
                                       "DataServiceVersion" : "2.0",
                                       "X-CSRF-Token" : "Fetch"
                                                                           requestUri : serviceURI,
                                                                           method : "GET",
                                                                           user : username,
                                                                           password : password
                                                                   OData.request(request, function(data) {
                                                                           alert("success");
                                                                 }, function(err) {
                                                                           alert('Error Code:'+ err.response.statusCode);
      </script>
    Thank you Naveenraj

  • Mark waiting and cancelled tasks completed

    Hi All,
    is there sql somewhere that can mark certain tasks that are in waiting and canceled status to Completed?
    Thanx.
    Fred

    I would suggest using the APIs to update the status or use the manuallyComplete API instead.
    -Kevin

  • BPM-API and generic task completion

    Hi experts,
    I want to write an application that allows you to work on different tasks. The problem is that these tasks could include various input and output data. How can I resolve this DataObjects generic and receive all relevant information such as data type, value and name? How is that when the data are nested? You can also then resolve the structure and if so how?
    Regards

    Hi,
    yes, you can do so. The interface common.sdo.DataObject provides methods to introspect the structure and determine the type of the properties. You might take a look at the RESTful service for the BPM API I published on CodeExchange:
    RESTful service for NetWeaver BPM
    Looking at the code in the repository you will definitely samples on how this can be achieved.
    Hope this help you to start on what you are trying to achieve.
    best regards,
    Stefan

  • A contract-manpower and machines -task completed-billing according to hours spent

    Hi friends,
    The business requirement is
    1. participating customer tendering process,
    2. given quotation to customer
    3. once quotation is matured contract will be  awarded
    4. now a crew members and set of equipment will be deployed at customer site and start work, the work contains different phases, once the first phase is completed  invoice is raised to customer
    Questions:
    1. How do i track what are all the eqipments are deployed
    2. how many man power is delpoyed?
    3. how do i book the cost of equipment and man power for the project/ task spent?
    4. how do i raise the bill to customer ?
    experts ,please advice me a clear solution for this requirement
    Regards,
    Pratheep

    1. How do i track what are all the equipment's are deployed
    Equipment's will be installed in functional locations, Plant = Functional location and first install the same when mobilizing @site. You can view in report IH08.
    2. how many man power is delpoyed?
    In HR master data organizational assignment will be there where personal subarea can be the project location. Please check with your HR consultant.
    3. how do i book the cost of equipment and man power for the project/ task spent?
    Depreciation cost of the equipment will be at the company level.It can be apportioned to the project.Other maintenance cost of equipment and running cost can be captured in the order and the same can be settled to the respective WBS periodically.
    4.  how do i raise the bill to customer
    Create the contract once the quanity is certified raise invoice reference to the order [Bill Certfied.
    Regards,
    Senthil Venugopal

  • Create a record using SAPUI5 and ODATA Service

    Hi there,
    since SPS6, SAP HANA should allow CRUD operations using an ODATA Service.
    That sounds nice and so I wanted to give it a try.
    I've started by creating a simple table and set up a tiny application that displays the data in a grid (using a JSON Model) and allows to insert new records by entering data into two textfields and save them as a new record to the databse. That works well, the grid shows the records which I have created using the SAP HANA Studio.
    So I wanted to create new records, and the documentation says very clearly how to create a new record.
    I've tried it this way, but when the request is send I get an 501 Not Implemented error.
    Thats the code I'm using in my SAVE-Button:
    btnSave.attachPress(function() {
       var entry = {};
       entry.id = tfUserId.getValue();
       entry.username = tfUserName.getValue();
       oData.create('/tbl_user', entry, null,
       function() {
          alert("Create successful");
       function() {
          alert("Create failed");
    After that I've tried to create a record using the POSTMAN extension for Chrome browser as mentioned in this cool video by Thomas Jung.
    Unfortunately, this also doesn't work for me. After sending the request I get as respone a sap hana xs login window with Status Code 200 instead of a status code "201 created".
    Here's a screenshot:
    I'm using SAP HANA Cloud Trial.
    Anybody got an idea what I'm doing wrong? Or does ODATA CRUD not work an SAP HANA Cloud Trial?
    Many thanks,
    ben

    Hi Jason,
    exactly, it's the logon page returned that is opened when I open the service URL in the browser. After logging on I can see the results of the ODATA service call.
    The URL must be correctly defined, the grid shows up the data from the ODATA Service.
    And yes, the URL looks OK when expecting in Chrome developer tools...
    Thanks,
    ben

  • Real Finish Date and Task Completion Percentage

    Hi, Working With Project Server 2013,
    User enter Task Progress setting the fields:
    Percent Complete: 100%
    But also changes the Finish Date to a later day.
    And Hit "Send"
    This is the information the PL gets, accepts and publishes.
    If the user sees the task again on Tasks he sees a recalculated % percentage and not the 100% that he entered in the first place.
    If the user doesn't change the finish date the 100% percent is not recalculated.
    This behaviour is not seen on PS2010.
    Is this by design on PS2013? is it configurable?

    Andres --
    In either Microsoft Project 2010 or 2013, if you enter a % Complete value of 100% for a task, and then change the Duration of the task, Microsoft Project will recalculate the % Complete value, reducing it from 100%.  This is the default behavior of
    the desktop tool, and Project Server 2013 mimics that behavior.  I cannot test Project Server 2010 for this behavior, since I do not have an instance available to me where I can change the method of tracking to % of Work Complete.
    To answer your second question, no, the Finish field is NOT the same as the Actual Finish field.  In your situation, I would recommend that you add both the Actual Start and Actual Finish fields to the following views in PWA:
    My Work view in the Timesheet section
    Details view in the My Work section
    My Assignments view in the My Work section
    The process for using the above field with the % Work Complete method of tracking progress would be as follows:
    When a team member begins work on a new task, the team member enters that date in the Actual Start field.
    Each week the team member enters their estimated task progress in the % Work Complete field.
    When a team member completes work on a task, the team member enters that date in the Actual Finish field (they DO NOT need to enter 100% in the % Work Complete field as the software will assume the task is completed by entering an Actual Finish date).
    This is the process that we recommended to all of our clients who use the % of Work Complete method of tracking progress.  Using this method gives you more accurate tracking, and will eliminate the problems you have experienced with Project Server 2013.
    Hope this helps.
    Dale A. Howard [MVP]

  • Events and Jeopardies problems in manual and automated task

    Hi all,
    I have an automated task that has an event in receive state and an internal Xquery automator. The event takes information from de order and send it to a specific queue, then the automator updates the orders to indicate that the information was sent.
    I have noticed that sometimes the update automator is executed first that the event so when the event executes can not find information to send to the queue.
    If a the event is in receive state, why the automator is running first? what type of automator are accepted for each task state?
    Another problem is with Jeopardies in a manual task. In it i have an automator that complete the task to a specific state. The Jeopardy is executed but the task is not completed by the state defined?
    are there any restrictions to Jeopardies in manual tasks?
    Thanks for the help.

    Hi,
    I am not sure whether I understood completely. Lemme try to answer your 2 questions.
    *1) If a the event is in receive state, why the automator is running first? what type of automator are accepted for each task state? So you are saying you have* defined an event when the automated task goes to Receive state ?
    Ans : As you have defined the event on the "Receive" state of an automation task, it will be the event gets executed first. Basically during execution of any order, when you hit submit in the CreationTask, automatically next task will be loaded and its task state will be in Recieve state irrespective of Task type like Automated or Manual. That is why when loading the next task, the task will be in received state and the automator runs first.
    If you want fire the event on different task state like "Accepted" or "Completed" you might have to change the event type.
    *2) i have an automator that complete the task to a specific state. The Jeopardy is executed but the task is not completed by the state defined? Are there any restrictions to Jeopardies in manual tasks?*
    Ans: As you said, Jeopardy is getting executed in the manual task correctly. Also you are expecting that the task should be completed along with jeopardy. But as the task type itself is a Manual Task, one has to manually open the order in worklist and make it proceed to next task. No plugins will make a Manual task to complete. Automation Plugins can be completed using the plugins.
    Thanks
    Naveen Jabade

  • Hi, I upgraded my iphone 4 to iso 5 beta 6, but now it shows "No Service" at top left, and unable to complete your activation. Also tels that this device is not registered as part of the iphone developer programme. How could I fix this problem? Please..?

    Hi, I upgraded my iphone 4 (4.3.3) to iso 5 beta 6, but now it shows "No Service" at top left, and unable to complete your activation. Also tells that "this device is not registered as part of the iphone developer programme." How could I fix this problem? Please help me...,

    I had a similar occurrence with my just activated iPhone 4.
    I had been using the phone for three days when an odd occurrence with voice mail caused me to call tech support. After some discussion they decided to push the activation to my phone (even though I had been using it for three days). When I went to power it back up again I repeatedly got the "no service" notification. I got tech support on a land line and we tried hard reboots and so on. No joy. They told me to take it in to the point of sale and either the SIM card or the phone needed (or both) needed replacing.
    I tried one last hard reboot after dinner and the phone came up with service, but I took it in to the point of sale in the morning and they swapped the SIM card out and I went to a Genius Bar appointment to get the phone checked out. It is supposedly OK, but I am still having some problems when syncing it so I will have to visit the Genius Bar again tomorrow about that. At least I have not experienced the "no service" problem in the roughly 24 hours since the SIM card was replaced. (Fingers crossed)

  • I have a 2009 Macbook Pro with 1T hdd 8GB Ram and ran Maverick without problem...Yosemite installation has me completely frozen, nothing works but the spinning ball...I had to force shutdown last night, and haven't turned it on again...what do you ad

    I have a 2009 Macbook Pro with 1T hdd 8GB Ram and ran Maverick without problem...Yosemite installation has me completely frozen, nothing works but the spinning ball...I had to force shutdown last night, and haven't turned it on again...what do you advise?  During installation emptied cache, etc. Backed up using time machine, fortunately.

    Try these in order testing your system after each to see if it's back to normal:
    1. a. Resetting your Mac's PRAM and NVRAM
        b. Intel-based Macs: Resetting the System Management Controller (SMC)
    2. Restart the computer in Safe Mode, then restart again, normally. If this doesn't help, then:
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the Utilities menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    3. Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the Utilities menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    4. Reinstall Yosemite: Reboot from the Recovery HD. Select Reinstall OS X from the Utilities menu, and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.
    5. Reinstall Yosemite from Scratch:
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    How to Clean Install OS X Yosemite
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.

  • Problems with breadcrumbs in TP4 be bounded and unbounded Task-Flows

    Project scope
      JDev 11g TP4
      jspx - template
      jsff - breadcrumbs
      jspx - forms (using the template)
      bound and unbound task-flow
    .) all forms (and template) are in the unbound task-flow (adfc-confi.xml)
    .) one form can be called with an parameter from another form - problem solved with an bound task-flow (task-flow-definition.xml) - it works very good
    With "Create ADF Menu" (on adfc-confi.xml) the JDev create
      root_menu.xml
      <control-flow-rule> entries in adf-config.xml
      <managed-bean> entrie in adf-config.xml
    The code from the breadcrumbs.jsff looks like
      <af:breadCrumbs value="#{root_menu}" var="rootMenuNode"
                      id="BreadCrumbs">
        <f:facet name="nodeStamp">
          <af:commandNavigationItem text="#{rootMenuNode.label}"
                                    action="#{rootMenuNode.doAction}"
                                    icon="#{rootMenuNode.icon}"
                                    destination="#{rootMenuNode.destination}"
                                    rendered="#{rootMenuNode.rendered}"/>
        </f:facet>
      </af:breadCrumbs>
    I have now two problems:
    1.) by navigation between the pages(in the definition of the unbound task-flow (adfc-confi.xml)) the breadcrumb displayed only the current page but not the history way.
    2.) after call the form with an parameter (need bound task-flow (task-folw-definition.xml)) all breadcrumb informations are cleared - nothing is displayed
    can anybody help?

    Hi,
    the generated menu model only works for unbound flows. You can call a bound flow from such a menu, but this doesn't show breadcrumbs within the bound taskflow. For this you need to specify that the bound taskflow creates a breadcrumb model and then it will only show what is within. Have a look at the taskflow section in the developer guide.
    Frank

  • New pc with windows 8.1, downloaded and installed cs5,no problem open bridge and cs5, but can't read raw file , try to update, can't complete or failed updating, please help

    new pc with windows 8.1, downloaded and installed cs5,no problem open bridge and cs5, but can't read raw file , try to update, can't complete or failed updating, please help

    Sounds like you somehow got the mac version.
    Download the windows 6.7 camera raw update from this link:
    Adobe - Photoshop : For Windows : Camera Raw 6.7 Update

  • I had a problem with my itunes so i had went on itunes website and reinstall itunes for windows and after it complete it said that the feature yoy are trying to use is on a network resource that is unavailable i need help please!!!!!!!!!

    had a problem with my itunes so i had went on itunes website and reinstall itunes for windows and after it complete it said that the feature yoy are trying to use is on a network resource that is unavailable i need help please!!!!!!!!!

    first, head into your Add/Remove programs and uninstall your QuickTime. if it goes, good. if it doesn't, we'll just attend to it when we attend to itunes.
    next, download and install the revo uninstaller http://http://www.revouninstaller.com/revo_uninstaller_free_download.html. use it to clear any existing itunes and/or QuickTime installation configuration information from the PC.
           next download itunes. it worked for me hope this is helpful!!
        oonce you get into the revo uninstallergo thru to delete itunes hit uninstall on the itunes icon then you will go thru to it will tell u the same nmessage about the feature and network hit cancell then go thru and hit scan (make sure bthe advance scan button is pushed) this will take awhile but go thru the list and hit everything associated with itunes. hit delete then install itunes again. it worked for me hope it works for you!

  • HT3702 Yes you placed a hold but then when I went to complete an in app purchase it says I can't. I have no restrictions on this **** thing and never had this problem.. Why won't your iTunes communicate with my games so I can purchase stuff.

    Yes you placed a hold but then when I went to complete an in app purchase it says I can't. I have no restrictions on this **** thing and never had this problem.. Why won't your iTunes communicate with my games so I can purchase stuff. I have an iPad mini just trying to play a **** game.

    We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple.
    If you are getting an error message then what is the full text of it ?
    The temporary store holding charge is standard, it should disappear within a few days or so.

  • I had been using iCould without problems, but recently my tasks have been disappearing from my PC and my tasks and calendar do not sync or update between my iPad and PC.  I have un-installed and re-installed iCloud on my PC twice.  Suggestions?

    I had been using iCould without problems, but recently my tasks have been disappearing from my PC and my tasks and calendar do not sync or update between my iPad and PC.  I have un-installed and re-installed iCloud on my PC twice.  Suggestions?

    I had been using iCould without problems, but recently my tasks have been disappearing from my PC and my tasks and calendar do not sync or update between my iPad and PC.  I have un-installed and re-installed iCloud on my PC twice.  Suggestions?

Maybe you are looking for

  • CLM - Maximum File Size for Contract Documents

    We did a search but did not find an answer for this.  For the CLM system does anybody know SAP's recommendation on the maximum file size that the application can reliably handle for contract documents?  We recently increased the maximum file size fro

  • IDOC_INBOUND_FROM_FILE

    hi, i'm using IDOC_INBOUND_FROM_FILE to read the content of text file, then i want to convert it into idoc. But the idoc generate status is 64 and i want that their status is 51. can anyone help me......this is vey urgent

  • Keynote playing on iPad

    When I transfer my keynote file to my iPad it does not play back properly.  Some of the photos and background images are not showing up in playback mode but they are there on the thumbnails of the slide.

  • Skype video button gone?

    Why is my skype video button gone?

  • External drive not showing up

    Hi everyone, I'm having some problems with my latest upgrade to Mavericks. Since I upgraded my 1 of my external drives is not showing up. I was able to find it in disk utility, but the name is grayed out. I've tried first aid on it which seems to be