Skip to Content
Technical Articles
Author's profile photo Jose Sequeira

Gateway – OData Post using Postman


In this blog i’m gonna demonstrate how to use Postman to execute Post calls to a SAP Gateway server.

First, download Postman from here:


Then, create the Z table below in your backend(assuming it’s a Hub scenario) server:

After that, create both RFC enabled Functional Modules:

function zdemo_gw_post.
*"*"Local Interface:
  "Just get it in there...
  modify zpost1 from im_post.
  commit work.
function zdemo_gw_post_read.
*"*"Local Interface:
  select single *
    from zpost1
    into ex_post
    where field1 = im_field1.

Now setup your ZDEMO_POST Gateway project (SEGW) like this:

Your Object Entity (ref from the Z table) with same Key field:

Create implementation:

Read implementation:

Setup your Service to your backend Alias:

After that you’re all set on the Gateway/ABAP side.


Now let’s open Postman:


Create a Request (saving in a Collection, to group calls):

Before you execute a POST call, you need to have a csrf token (you can find more info about it here:


To get it, you need to execute a GET call fetching the token, so let’s do it:


Execute a GET call (please change the SERVER:PORT to your gateway’s server and port ?), you could just get the metadata with the following URL:  SERVER:PORT/sap/opu/odata/sap/ZDEMO_POST_SRV/$metadata

In the Authorization tab, select Basic Auth and enter your Gateways user/password:

Hit Send, and the metadata returns with success:


So it’s communicating ?, now to get the Token, in the Headers Tab, add a entry with x-csrf-token = Fetch, like below:

After executing the service, note that the token gets returned in the Headers Tab.


Now we’re all set to execute the POST call, so we change it like below:



Change the Token to the value returned:

In the Body section, insert this XML (change to the values that you want to be inserted in each XML Field):

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="/sap/opu/odata/sap/ZDEMO_POST_SRV/" xmlns="" xmlns:m="" xmlns:d="">
 <title type="text">ObjectSet</title>
 <category term="ZDEMO_POST_SRV.Object" scheme=""/>
 <link href="ObjectSet" rel="self" title="Object"/>
 <content type="application/xml">

Send, if everything is correct, 201 status is returned:

The data inserted in the Z table:

Enjoy. ???


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Rajesh Kumar Katkoori
      Rajesh Kumar Katkoori

      Hi Jose,

      Its a nice post. I have tried and worked. I am trying for a deep entity ( Header and Item) but something i am missing. Could you please share the XML for that scenario?


      Author's profile photo Jose Sequeira
      Jose Sequeira
      Blog Post Author

      Hello Rajesh,

      Have you redefined the create_deep_entity method on the Gateway server?

      Testing on the Gateway Client works?


      Author's profile photo Pierre Dominique
      Pierre Dominique

      Hi Jose,

      Quick tip -> you can use Postman variables to store the x-csrf token:



      Author's profile photo Jose Sequeira
      Jose Sequeira
      Blog Post Author

      Hello Pierre,

      That is correct, i was trying to be as simple/basic as possible, but thanks for input. The variables functionality is very useful for us Postman fanatics.




      Author's profile photo Eun-Jo Choi
      Eun-Jo Choi

      Hello Jose.


      Thanks you for the guide!

      Very helpful!


      I have  questions about JASON format.

      1. Can I get the body post sample ( POSTMAN ) with  JASON format?

             or It's possible only  XML ?


            2.  Want to know that several lines post  sample


      Thank you.



      Author's profile photo Jose Sequeira
      Jose Sequeira
      Blog Post Author


      Yes, you can post a JSON payload and also get JSON payload on your get calls, by using at the end: ?$format=json