The following code example from a SharePoint application page shows how the first ten records of SAP table MAKT are read, using an XtractQL query within JavaScript with AJAX:
Javascript.
The ExecuteXQL operation of the ERPConnectServiceRest.svc Web service returns a JSON object. AJAX is enabled through the $.getJSON-method of jQuery (see www.jquery.com).
JSON is an acronym for JavaScript Object Notation and is a lightweight data exchange format. For the development with jQuery and the use of AJAX, the web debugger tool Fiddler2 (www.fiddler2.com) can be very useful:
Result as XML
In addition to returning data JSON format, you can request the data to be returned as XML:
Javascript
Use of a specific ECS Application
If the program should access a specific ERPConnect Services Application, please use the parameter applicationName.
Javascript
Return Value
Using the REST interface each XQL statement must return a table as a result. More than one return parameters are not supported. For the execute statement a @RETVAL parameter must be defined.
Example with RESTClient
RESTClient is an add-on for many browsers that enables you to call REST Services. The following screenshot shows how to execute an XtractQL statement using the ECS REST services.