Skip to Content

Provide Web service without measures with Datasource SDK

Hi folks,

i am trying to build a datasource that get connected to a custom Web service. Its a restful service that supply the following data in JSON format:

[{"webapp": "app", "scope": "IT", "feeder": "heise IT",  "identifier": "id234", "news": "this is a text"},
 {"webapp": "app", "scope": "IT", "feeder": "golem",  "identifier": "id567", "news": "this is another text"}]

It contains no measure (hope i am correct) and i am not able to find some informations in the developers guide and the scn.

Question 1: In my opinion it is right to create a datasource component to collect data from any Web service. Is that true in my case?

My first problem was to implement the "defineDimension()" method from the sap.designstudio.sdk.DataBuffer.subclass("...") { ... } class. I try to use just colums and set the "containsMeasure" option to the field with the highest granularity, the "news".

Question 2: Could it be that numeric measure(s) are mandatory? I try to use the method and the "fillWithArray() function, but without success.

After that i decided to clean the "defineDimension()" methode and hold the Web service data in my own javascript object and add some methods to the contributions.ztl to get 1 specified unique news text back.

The result should be:

DS_1.getNewsByIdentifier("id234") -> "this is a text"

I try to solve it with the hack from Michael Howles (), but i cant achieve it.

My component.js looks like this:

sap.designstudio.sdk.DataBuffer.subclass("...", function() {
var that = this;
var _execute;
var _allNews = [];
 var _news = null;

this.init = function() {

// Getter/Setter
this.execute = function(value) {
  if (value === undefined) {
  return _execute;
  } else {
  _execute = value;
  return this;
  }; = function(value) {
  if (value === undefined) {
  return _news;
  } else {
  _news = value;
  return this;


this.afterUpdate = function() {
  async: false,
  crossDomain: true,
  url: _url,
  headers: {
  'Authorization': "Basic " + btoa(_user + ":" + _pw)
  }).done(function(dataArray) {
  _allNews = dataArray;
  // Test = x.setExecute(_execute);
  alert("Test:" +;
  that.firePropertiesChanged(["news"]); // brings an error

var x = {
  getNewsById : function(value) {
  alert("I am 'getNewsById'.  You passed me value: " + value);
  return _.find(_allNews, function(y) {
         return y.identifier == value;
  setExecute : function(s){
  var cmd;
  if(s) cmd = s.split("~");
  if(cmd!==undefined && cmd.length > 1){
  var methodNameParam = cmd[0].split("|");
  var methodName = methodNameParam[0];
  var methodParam;
  if(methodNameParam.length>1) methodParam = methodNameParam[1];
  if(this[methodName]) {
  return this[methodName](methodParam);
  } else {
  alert("You passed me a bad method (" + methodName + ")");
  getExecute : function() {
  return String(Math.random());

In my contribute.ztl the code looks like this:

class .... extends SdkDataBuffer {
  // needed to inherit parent class methods


  /* Returns a specific news by Identifier */
  String getNews(String someId) {*
  this.execute = "getNewsById|" + someId + "~" + Math.random();


<property id="news" title="Kommentar" type="String" group="Webservice" visible="true"/>

Now its the problem in my case that the method dont return any String. But "" contains the necessary String "this is a text"!!

DS_1.getNewsById("id234") -> ""

I believe that the "Getter/Setter" just called one time and not afterwards to get In have read in the SDK guideline that it is possible to force an update of any property from the contribution.xml with "firePropertiesChanged":

this.comment = x.setExecute(_execute); // work!

But just an error come up:

Without "that.firePropertiesChanges(["news"]) the method call DS_1.getNewsById("id234") never retuns any value.

Question 3: How can i return the actual content?

I am proud for any help or hint to solve this issue 😊

Best regards,


1.PNG (45.2 kB)
2.PNG (69.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jun 08, 2015 at 09:21 AM


    Please check the below thread:

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 08, 2015 at 09:33 AM


    Did you checked this out

    Custom Data Source in SAP Design Studio 1.4

    For  your question1:

    its true you can use webservice as data source


    Add comment
    10|10000 characters needed characters exceeded