Skip to Content

Gateway and oData POST and GET methods


I need a little help for the gateway service in SAP and the oData binding in eclipse.

The request is as follows: Pass parameters on input to the RFC -> get the output table -> bind the data with the table in the view.

I only have 1 function module with 2 tables (in the FM). I use the first table for input and based on that data i make a select in a standard table and extract those records in the 2nd table which I use for output in the FM. I need to display that output table in the view.

I have created 2 entity sets: 1 for the input table and 1 for the output table. The mapping is done only on GetEntitySet for both sets(i don't think i need to map other service implementations, but please correct me if i'm wrong).

I call the service and I'm able to display records in the table if I play in debug in the FM:

This is my table in the view:

Now, I'm not sure how to make the connection with the gateway in order to pass a parameter->extract some records to the output table->get the output table from the FM->bind it with the table from the view.

I found this code here: Simple Exercise on OData and SAP UI5 Application for the basic CRUD Operation and it's closest to my scenario.

var Input = {};
  Input.Qmnum = sap.ui.getCore().byId("qmnumtxt").getValue();
  requestUri: "proxy/http/<server>:<port>/sap/opu/odata/sap/ZCS_NT_LIST_SRV_TEST_SRV/TbInputSet",
  method: "GET",
  headers: {     
                "X-Requested-With": "XMLHttpRequest",
                "Content-Type": "application/atom+xml",
                "DataServiceVersion": "2.0",
  header_xcsrf_token = response.headers['x-csrf-token'];
  var oHeaders = {
  "x-csrf-token" : header_xcsrf_token,
  'Accept' : 'application/json'
  requestUri: "proxy/http/<server>:<port>/sap/opu/odata/sap/ZCS_NT_LIST_SRV_TEST_SRV/TbInputSet",
  headers: oHeaders,
                function(data,request) {                 
        },          function(err) {
}, function(err) {
                    var request = err.request;
                    var response = err.response;
                    alert("Error in Get -- Request " + request + " Response " + response);

But there are 2 wrong points here:

1. It doesn't pass anything to the service(although the Input is valorized)

2.It makes a reload to the page and in my case it goes in the init method again and takes the empty output table from the service.

I'll really appreciate any help whatsoever!


Screenshot_2.jpg (146.6 kB)
Screenshot_3.jpg (65.6 kB)
Screenshot_4.jpg (77.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 03, 2015 at 01:24 PM


    if you use get_entity - return structure(one line), then binding as:


    in your case properly use get_entity_set, as you appear in the table a lot of records rather than one.


    Example requests

    Get_Entity_Set - return many row

    uUrl:port/sap/opu/odata/sap/U_SRV/NameEntitySet?$filter=Objid eq '123' and Otype eq 'E'

    after parameter $filter you can see in abap IT_FILTER_TAB

    Get_Entity - always return one row


    Objid and Otype this fields at stricture in SEQW, this field must be KEY.

    Add comment
    10|10000 characters needed characters exceeded

    • Now it gives me 400 (Bad Request) .

      Another thing I noticed If I pass it like this: "/oEntitySet?" then I can enter in debug in the FM and doesn't give an error (but like that I'm not sending any input to the server, I only get the output), but if i pass it as you suggest gives back the error and doesn't go in debug (also with the ? ).

  • Nov 02, 2015 at 07:45 PM

    2Hello Sashko,

    As you said, there are two table parameter one for input and another for output. But in onInit method I am not able to find any input parameter for service call.

    One more thing you can pass HandleError function in method and alert response code.

    Please find sample code.


    var sPath_cust = "/Customer_DetailsSet(Kunnr='" + custID + "')";,null, null, false, function(oData,
    response) {

      var jsonModel = new sap.ui.model.json.JSONModel(oData);



    function(oError) {alert(oError); }


    You can debug javascript code in chrome. refer below URL/



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Sashko Janev

      It says that the url doesn't exist only when i pass it like Nikhil suggested ("/Customer_DetailsSet(Kunnr='" + custID + "')";), if I pass it like i did, the url exists. Also i have created and activated a webservice for the gateway project:

      if you read by key, then you must transfer all keys at structure entity at segw

      ("/Customer_DetailsSet(key1='" + custID + "')",key2='123')

      if you read by filter params you must transfer an arbitrary number of parameters.

  • avatar image
    Former Member
    Nov 03, 2015 at 03:01 PM

    please show full url request with filter params(at chrome console).

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Sashko Janev

      in end at url delete )

      Example request


      uUrl:port/sap/opu/odata/sap/U_SRV/NameEntitySet?$filter=Objid eq '123'