cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Launchpad - odata error 404 extension launchpad

chris_SAP
Participant
0 Kudos

I'm creating an extension to launchpad. I want to put a dynamic message on the launchpad screen.
So I need to bind data.

In an application of the current launchpad, I reach to get metadata with a get request.

In the extension, I've got error 404.

When I try the address in the gateway service test, I have status 200

But when I run in webide, I have an error 404. And I don't reach to bind data.

Could you help me ?

Christophe

Here is the code :

            var sUrl = "/sap/opu/odata/sap/ZWOC_ECOMMERCE_SRV/";
            var oDataModel = new sap.ui.model.odata.v2.ODataModel(sUrl, {
                json: true,
                loadMetadataAsync: true
            });

            oDataModel.read("/UserLPSet('USER')", {
                success: function (oData, response) {
                        var oJSONModel = new sap.ui.model.json.JSONModel();
                        oJSONModel.setData(oData);
                        sap.ui.getCore().setModel(oJSONModel);
                    } //function
            });

            var oRenderer = sap.ushell.Container.getRenderer("fiori2");
            oRenderer.addSubHeader("sap.m.Text", {
                id: "testBar"
            }, true, true);
            var oBar = sap.ui.getCore().byId("testBar");
            oBar.bindElement("/UserLPSet('USER')");
            oBar.setText("{/Firstname}");

Accepted Solutions (1)

Accepted Solutions (1)

MikeDoyle
Active Contributor
0 Kudos

Is the launchpad running on SAP Cloud Platform (portal service) or is it running on a Netweaver box (e.g. SAP NW Gateway)? From the looks of your Gateway Client screenshot I'm going to assume that the OData service and the Fiori Launchpad (FLP) are running on the same box.

I noticed three things right away. They might not be the cause, but they will get us started

1) You are testing using a local run on Web IDE. How does Web IDE (and Cloud Platform) know what /sap/opu/odata/sap means? Do you have a neo-app.json file which maps that path to a Cloud Platform destination? Do you have that for the launchpad plugin? What happens if you deploy your plugin app to the gateway box and run it there?

2) I don't believe you should instantiate the OData service and then call it right away. You should wait for the metadataloaded event

3) Have you tried it without the loadMetadataAsync property? If you address #2 then this might no longer be an issue

Given that the issue you have is with the metadata loading in the first place I don't think addressing #2 or #3 will help. It's more important to look at #1.

If you could share your GIT repo (make it public) that would be a help

chris_SAP
Participant
0 Kudos

Thank you Mike to take care of this topic.

I'm running on Netweaver box.

For #1 : I have only the component.js to do something. So, you may have right and SAP can't know the real address. I'm going to test after deployment.

For #2 and #3, I'm going to solve #1 and check your advise after. I don't know if I can add metadataloaded event for the renderer

I'm going to check that next week and I'll accept the answer after in order to inform everyone of the solution.

chris_SAP
Participant
0 Kudos

You're right, I had error 404 as I was in the box.

I need to deploy pluging to test it and bind odata.

Thank you Mike.

Answers (0)