on 04-05-2019 12:51 PM
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
Hi Stephan,
this behavior is by design. It is explained here:
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);
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad that it worked! Happy workflowing ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Archana,
worked perfectly :).
Thank you for this clear explanation!
Had to leave out the destination_name, then it worked.
Thanks thejk and archana.shukla for your help!
Regards,
Stephan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.sreenivasr and archana.shukla everything from this blog:
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.