Skip to Content
avatar image
Former Member

What do 'GetEntitySet (Query)' & 'GetEntity (Read)' do.

Once we create a project in Netweaver Gateway and follow few other steps to create a OData service, we come across two methods which I think are very important for service implementation perspective.

Can some one please tell me what exactly does these two methods do : 'GetEntitySet (Query)' & 'GetEntity (Read)'

I am a Java developer / SAP Portal consultant so thinking that these are ABAP specific. But if some one can explain briefly I think I will be able to understand though I have min ABAP knowledge.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 13, 2015 at 04:29 AM


    GET_ENTITY method is used when you need to fetch a single record from the database/backend. (READ)

    While GET_ENTITYSET method is used when you need to fetch multiple records from the backend. (QUERY)

    Can some one please tell me what exactly does these two methods do : 'GetEntitySet (Query)' & 'GetEntity (Read)'

    I think the above mentioned is the only thing these methods do. If you are asking in terms of ABAP code, there are pretty clear comments mentioned in the generated code. Let me try to explain a generalized code of both methods.


    Firstly there is variable declaration part where we define the structures or containers for FM import, export parameters, RFC destination etc. Then there is code written to fetch the keys from the HTTP request. The code below this extracts the RFC destination to call the FM from the system alias associated with the service. Then it calls the FM based on the RFC destination. If any error occurs during this or there is an error msg coming in return table, the code below this handles errors. Then the response from the FM is transferred to the er_entity structure.


    The same variable declaration part. Then we extract the filters from the HTTP request. The long CASE statements extracts the filter values and put in the containers. Then RFC destination extraction and calling of FM followed by error handling part. Then there comes the code which handles paging. The paging is handled by 'skip' & 'top' parameters. 'Skip' means that skip the mentioned no. of records from the response while 'Top' means the maximum no. of records to be processed from the starting (e.g.: for the first time you may request skip=0 and top=100, then you will get top 100 records. After this you may request skip=100 and top=200, then you will get the next 100 records starting from 101 and ending at 200). Then we loop the output table based on the skip, top values and transfer the values to the et_entityset table.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Sun,

      as you received no further answers so far, I will try to do my best, even though I am not a JavaScript developer. I just used the GWPA tools with Eclipse to generate SAPUI5 starter applications.

      1. As a trial, you could change your last-but-one code line to

      oTable.bindRows({path : "/UserInfoSampleSet('123098')"});

      2. Client-side filtering of the requested data is also a possibility, that´s what the generated starter applications do. They define a function search(oView, newValue) and call it...

      /** * This method executes client side search on the given view with the given value

      * @param oView - view the contains list to search on

      * @param newValue - the value to search for

      */ function search(oView, newValue) {

           var filterPattern = newValue.toLowerCase(), oList = oView.oList,

           listItems = oList.getItems(), i, vBoxitems, visibility;

           for (i = 0; i < listItems.length; i++) { vBoxitems = listItems[i].getContent()[0].getItems();

           visibility = false;

           $.each(vBoxitems, function(index, item) {

               if (item.getText().toLowerCase().indexOf(filterPattern) != -1) {

                   visibility = true;

                   return false; // break

               }; }); listItems[i].setVisible(visibility);



      This function is called within the controller designated to the view for that entity type:

           search(this.getView(), oEvent.getParameters().newValue);

      If you would like to see the complete code for the client-side filtering, you might sign-up for a HANA Cloud Platform Trial Account and use SAP Web IDE to create a similar Starter Application from a template. Web IDE with templates replaces the plugins for Eclipse, the GWPA plugin seems to be no longer available, unfortunately). See  SAP Web IDE Help to get started.

      Best regards and lots of success,


  • Jan 12, 2015 at 10:18 PM


    'GetEntitySet (Query)' is to get a array of values i.e. if you need to get multiple records from a database table/tables

    'GetEntity (Read)' is used to get one single record i.e. all the details of  a particular employee/customer.

    Look at this blog - Let’s code CRUDQ and Function Import operations in OData service!

    Hope this helps.



    Add comment
    10|10000 characters needed characters exceeded

  • Jan 15, 2015 at 03:44 PM

    Hi ,

    It is very simple. So let me explain you with below image. Hope this lets you to have clear understanding.

    Note : these(GetEntitySet (Query)' & 'GetEntity (Read)) are not ABAP specific. but oData.

    Add comment
    10|10000 characters needed characters exceeded