Skip to Content
0

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

Aug 16, 2017 at 06:10 AM

130

avatar image
Former Member

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)"}}}} -

result.png (3.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Aug 16, 2017 at 04:14 PM
-1

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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);


	};

0