Search code examples
sapui5abap

DPC Class gets triggered twice


whenever I do a OData call, the DPC classes are getting triggered twice. I found out in SAP Forum, that it triggers twice if it's a post request. However I can't find any way to change it from POST to GET.`

Controller

var oVizFrame = this.getView().byId(sTask);
    var oDataset = new sap.viz.ui5.data.FlattenedDataset({
        dimensions: [{
            name: 'Status',
            value: "{BcsStatus}"
        }],
        measures: [{
            name: 'Amount',
            value: '{Amount}'
        }],
        data: {
            path: "<path>",
            filters: aFilter,
            events: {
                dataRequested: function(oEvent){
                    oVizFrame.setBusy(true);
                },
                dataReceived: function(oEvent){
                    oVizFrame.setBusy(false);
                }
            }
        }
    });
    oVizFrame.setDataset(oDataset);
    oVizFrame.setVizType('pie');
    oVizFrame.setVizProperties({
        plotArea: {
            colorPalette: ["sapUiChartPaletteQualitativeHue6", "red", "orange", "blue", "green"]
        },
        title: {
            text: title
        }
    });

    var feedSize = new sap.viz.ui5.controls.common.feeds.FeedItem({
        'uid': "size",
        'type': "Measure",
        'values': ["Amount"]
    }),
    feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem({
        'uid': "color",
        'type': "Dimension",
        'values': ["Status"]
    });
    oVizFrame.addFeed(feedSize);
    oVizFrame.addFeed(feedColor);

So is there any way to change the request type of OData call from POST to GET?

Thanks in advance.

P.S. I changed the Path value.


Solution

  • I got it working.

    Answer was found here: https://answers.sap.com/questions/441168/odata-service-triggering-twice.html

    I had to change the Count Mode of the Default-Model in the manifest.json to Inline