cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Send http request with huge $top query value by UI5

0 Kudos

I add an <sap.m.Tree>. When I click the subnode, it sent http request to fetch data with huge $top value, which makes failure. How can I solve it?

view.xml:

<Tree id="subtaskTree" > <StandardTreeItem title="{object_id}"/> </Tree>

controller.js:

this.getView().byId("subtaskTree").bindItems({
	path: location.hash.split("&")[1],
	// template: new sap.m.StandardTreeItem(),
	template: this.getView().byId("subtaskTree").getItems()[0].clone(),
	parameters: {
		expand: "to_subtask",
		navigation: {
			'z11_c_task_tp': 'to_subtask'
		}
	}
});

Result:

The problem is, when I click node"13",it send http request:

GET z11_c_task_tp(guid=guid'00505682-87ad-1ee7-9eeb-7f3d5b1203cc',IsActiveEntity=true)/to_subtask?$expand=to_subtask&$skip=0&$top=9007199254740991&$inlinecount=allpages

it caused error:

2017-08-16 13:44:47.172195 The following problem occurred: HTTP request failed400,Bad Request,{"error":{"code":"005056A509B11EE1B9A8FEC11C22F78E","message":{"lang":"en","value":"Invalid system query options value"},"innererror":{"transactionid":"B86FC2D254A64C818715D7D04F0E0229","timestamp":"20170816054446.7395070","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"}}}} -

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daisy,

That's the result of Number.MAX_VALUE.

Check out this post: https://answers.sap.com/questions/121616/please-help-me-with-this-sapmtree-behaviour.html

It's a known issue and was fixed this year: https://github.com/SAP/openui5/issues/1220

0 Kudos

Thanks. I tried it and it's doable.

sap.ui.define([
	"sap/ui/core/mvc/Controller",
	"sap/m/Tree"
], function(Controller, Tree, ListBase) {
	"use strict";
	Tree.prototype.updateAggregation = function(sName) {
		if (sName != "items") {
			return ListBase.prototype.updateAggregation.apply(this, arguments);
		}


		// Reuse the ListBinding from ManagedObject.updataAggregation
		var oBindingInfo = this.getBindingInfo("items"),
			oBinding = this.getBinding("items"),
			fnFactory = oBindingInfo.factory,
			aContexts;


		// Update a single aggregation with the array of contexts. Reuse existing children
		// and just append or remove at the end, if some are missing or too many.
		function update(oControl, aContexts) {
			var aChildren = oControl.getItems() || [],
				oContext,
				oClone;
			if (aChildren.length > aContexts.length) {
				for (var i = aContexts.length; i < aChildren.length; i++) {
					oControl.removeItem(aChildren[i]);
					aChildren[i].destroy("KeepDom");
				}
			}
			for (var i = 0; i < aContexts.length; i++) {
				oContext = aContexts[i];
				oClone = aChildren[i];
				if (oClone) {
					oClone.setBindingContext(oContext, oBindingInfo.model);
				} else {
					oClone = fnFactory(oControl.getId() + "-" + i, oContext);
					oClone.setBindingContext(oContext, oBindingInfo.model);
					oControl.addItem(oClone);
				}
			}
		}


		// Get all nodes.
		aContexts = oBinding.getContexts(0, 1000);


		// If factory function is used without extended change detection, destroy aggregation
		if (!oBindingInfo.template) {
			this.destroyItems();
		}
		update(this, aContexts);


	};

Answers (0)