Skip to Content

No Items shown in List in custom User Task UI in SAP Cloud Platform Workflow

Hello,

i have a problem implementing a List/Collection/etc. with an EntitySet from an OData Service.

I want to implement it in a custom User Task UI which i implemented in an external SAPUI5 App "decideOrder".

The App itself works perfectly with my Context Model (getting Data via Service Task from my OData Service) in SAP Cloud Platform Workflow

For a Use Case in my Workflow (its a easy Purchase Order Approval btw.), i now need a List which is filled directly via the OData Service and not with my Context Model.

For Testing, i created a simple OData Service with Random User Data. I implemented it in a fresh UI5 App "testtable" and it worked fine without even coding anything.

But when i want to implement it in my Workflow Task UI (which has the same Structure than the above App), there is no data shown. The manifest.json in my "decideOrder"-App syncs the data without problems, and i compared nearly everything in the code with the above shown App. Now here is the screenshot of my User Task Workflow UI, which does not show any items from the same OData Service.

Here is the code for the above shown UI: It is the same code as in the testtable App, but without the use of IconTabFilter.

Could it be that the Context Model i get from my Service Task does have problems with the OData Model via EntitySet? Do I have to init the model separately in Workflow UIs?

I am really out of ideas... Maybe i am missing something?!

Thank you in advance!

Regards,

Stephan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Apr 08, 2019 at 07:23 AM

    Hi Stephan,

    this behavior is by design. It is explained here:

    https://help.sap.com/viewer/f85276c5069a429fa37d1cd352785c25/Cloud/en-US/c628bb07530147c6ad292f03c3b3b700.html

    I guess your Models are instantiated at startup of vour component. As explained in SAP help, you have to prefix you service URLs. So either do not use automatic instantiation of your models and create them by yourself or you may try this:

    In Components.js:

    /** 
    * Overwrite function of UIComponent because if running in MyInbox-App we need a different URL for our oData-Service
    * @param oManifestModels
    * @param oManifestDataSources
     */
    	_initComponentModels: function(oManifestModels, oManifestDataSources) {
    			var service;
    			// running in Inbox?
    			if (this.getComponentData() && this.getComponentData().startupParameters) {
    				var startupParameters = this.getComponentData().startupParameters;
    				if (startupParameters.inboxAPI) {
    					// yes, prefix the oData URL with the path of the Application
    					var prefix = "/" + startupParameters.oParameters.sApplicationPath;
    					for (service in oManifestDataSources)
    						if (Object.prototype.hasOwnProperty.call(oManifestDataSources, service))
    							if (oManifestDataSources[service].uri)
    								oManifestDataSources[service].uri = prefix + oManifestDataSources[service].uri;
    					for (service in oManifestModels)
    						if (Object.prototype.hasOwnProperty.call(oManifestModels, service))
    							if (oManifestModels[service].uri)
    								oManifestModels[service].uri = prefix + oManifestModels[service].uri;
    				}
    			}
    
    	UIComponent.prototype._initComponentModels.call(this, oManifestModels, oManifestDataSources);
    },
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 01:07 PM

    Hello Stepan,

    not knowing what exactly you are trying, but I guess this is the same problem. You have to prefix every URL that points to a document that is stored in your backend with "startupParameters.oParameters.sApplicationPath" from my previous answer. I had this problem with a sap.m.UploadCollection containing URLs pointing to documents in my SAP Backend. When running in Inbox, I had to prefix every URL with the application path.

    Regards,

    Jürgen

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 03:59 PM

    Hello Stephan,

    Let me try and explain you here with your use case.
    For Example, you want to load the list of items from S4HANA OData call say: https://my.s4hana.ondemand.com/sap/opu/odata/sap/ODataService/DokumentSet(PO_NUMBER='12345',ARC_DOC_ID='45677')/$value

    Assuming that you have tested that your code loads the list items in custom application.
    >> If you want to use the same custom application as Workflow Task UI then you need do few more application coding as mentioned here
    >> Any external API call (like the one above) has to be redirected to MyInbox based internal destination : /html5apps/<taskui_application_name>/<destination_name>/sap/opu/odata/sap/ODataService/DokumentSet(PO_NUMBER='12345',ARC_DOC_ID='45677')/$value
    (the same is explained in my blog)

    Rest everything remains the same.
    It is pretty straight forward.

    Let me know if that works,
    Archana

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 04:31 PM

    I am glad that it worked! Happy workflowing ...

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 12:08 PM

    Hello Jürgen,

    now that it works, i have a problem regarding URLs from my OData Service (Links to Documents). In my Inbox they do not work, in an external App they do.

    I also tried to get a solution here:

    https://answers.sap.com/questions/12657333/problems-with-opening-urls-in-myinbox-in-user-task.html

    and then i tried thanks to Seshadri Sreenivas R and Archana Shukla everything from this blog:

    https://blogs.sap.com/2017/10/22/part-3-calling-external-service-in-task-ui-of-sap-cloud-platform-workflow/#

    but it does not seem to work properly in my case, because i am instantiating it like in your above code.

    How can i implement, that the OData Service and the Model are routing over /html5apps/application/destination/sap/opu/odata/sap/ODataService ?

    In the neo-app.json my code looks like the following for my manifest.json:

    "path": "/sap/opu/odata/",
    		"target": {
    			"type": "destination",
    			"name": "S4H",
    			"entryPath": "/sap/opu/odata/"
    		},
    		"description": "S/4Hana on prem"
    

    Do i have to make a separate Ajax Call for the model or can i implement it in the function _initComponentModels?

    Thank you very much,

    Regards,

    Stephan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 01:46 PM

    Hello Jürgen,

    Thank you again. Exactly that is my problem! Also in connection with the Upload Collection.

    This is my URL i am trying to open at the time, but getting 500 Internal Server Error back:

    url="/sap/opu/odata/sap/ODataService/DokumentSet(PO_NUMBER='{PO_NUMBER}',ARC_DOC_ID='{ARC_DOC_ID}')/$value"
    

    What exactly do i have to change here? Isn't /sap/opu/odata/ the application path or where do i have to set it in the URL?

    Thanks and Regards,

    Stephan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2019 at 04:18 PM

    Hello Archana,

    worked perfectly :).

    Thank you for this clear explanation!

    Had to leave out the destination_name, then it worked.

    Thanks Juergen Keller and Archana Shukla for your help!

    Regards,


    Stephan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.