Skip to Content
0
Feb 01, 2021 at 07:19 PM

Problem with uri static odata

78 Views Last edit Feb 01, 2021 at 07:22 PM 2 rev

Hello expert, i'm triying to solve why i'm getting an error:

This is the error:

This was not happening before, and now i'm getting them

This is the way that the app call the service:

lectura: function () {
            var that = this;
            this.setBusyById("page", true);

            var arrayDISP = [];
            var arrayAEJE = [];
            var arrayEJCC = [];
            var arrayEJET = [];
            var arrayAPRB = [];
            var filterArray = [];
            var fnVarSuccess = function (oData, response) {

                if (oData.results.length == 0) {
                    sap.m.MessageToast.show("No se a encontrado ordenes de mantenimiento...");
                    that.setBusyById("page", false);
                    return false;
                }

                for (var i = 0; i < oData.results.length; i++) {
                    var caso = oData.results[i].UStatus;
                    switch (caso) {
                    case "DISP":
                        arrayDISP.push(oData.results[i]);
                        break;
                    case "AEJE":
                        arrayAEJE.push(oData.results[i]);
                        break;
                    case "EJCC":
                        arrayEJCC.push(oData.results[i]);
                        break;
                    case "EJET":
                        arrayEJET.push(oData.results[i]);
                        break;
                    case "APRB":
                        arrayAPRB.push(oData.results[i]);
                        break;
                    }
                } //fin for

                //var oModelDISP = new sap.ui.model.json.JSONModel();
                oModelDISP.setData(arrayDISP);

                var oModelAEJE = new sap.ui.model.json.JSONModel();
                oModelAEJE.setData(arrayAEJE);

                var oModelEJCC = new sap.ui.model.json.JSONModel();
                oModelEJCC.setData(arrayEJCC);

                var oModelEJET = new sap.ui.model.json.JSONModel();
                oModelEJET.setData(arrayEJET);

                var oModelAPRB = new sap.ui.model.json.JSONModel();
                oModelAPRB.setData(arrayAPRB);

                var lista1 = that.getView().byId("lista1");
                var lista2 = that.getView().byId("lista2");
                var lista3 = that.getView().byId("lista3");
                var lista4 = that.getView().byId("lista4");
                var lista5 = that.getView().byId("lista5");

                lista1.setModel(oModelDISP);
                lista2.setModel(oModelAEJE);
                lista3.setModel(oModelEJCC);
                lista4.setModel(oModelEJET);
                lista5.setModel(oModelAPRB);

                that.byId("__filtro1").setCount(that.byId('lista1').getMaxItemsCount());
                that.byId("__filtro2").setCount(that.byId('lista2').getMaxItemsCount());
                that.byId("__filtro3").setCount(that.byId('lista3').getMaxItemsCount());
                that.byId("__filtro4").setCount(that.byId('lista4').getMaxItemsCount());
                that.byId("__filtro5").setCount(that.byId('lista5').getMaxItemsCount());

                that.feedFacetFilterDISP(arrayDISP);
                that.feedFacetFilterAEJE(arrayAEJE);
                that.feedFacetFilterEJCC(arrayEJCC);
                that.feedFacetFilterEJET(arrayEJET);
                that.feedFacetFilterAPRB(arrayAPRB);

                that.setBusyById("page", false);

            };

            var fnVarError = function (err) {
                sap.m.MessageToast.show("Ocurri� un problema en la comunicaci�n con el servidor");
                that.setBusyById("page", false);
            };

            that.onCallReadOdata(filterArray, fnVarSuccess, fnVarError);
        },

        serviceUrl: "/sap/opu/odata/SAP/ZPMGW_ORDENPMRFC_SRV_02",

        onCallReadOdata: function (filterArray, fnVarSuccess, fnVarError) {
            var url = this.serviceUrl;

            var oModel = new sap.ui.model.odata.v2.ODataModel(url, false);

            var params = {
                context: null,
                urlParameters: {
                    "$format": "json"
                },
                async: false,
                filters: filterArray,
                sorters: null,
                success: fnVarSuccess,
                error: fnVarError

            };

            oModel.read("/ZRFC_LISTAORDEN2Set", params);

        },

What do you think that is wrong ? i'm always getting the message ""Ocurri� un problema en la comunicaci�n con el servidor"

Attachments

error-uri.png (298.4 kB)