Skip to Content
Technical Articles
Author's profile photo Piyush Philip

A simple REST Web-service from ECC called from a HTML5 screen


Recently we were directed to design OS agnostic RF screens for one of our business partners. We envisioned a web browser based screen which can be called from both our android & windows based RF guns. We did not want to take the module pool ITS approach & our ECC system is one of the lower level versions so we could not do a UI5-Gateway solution. After reading across these forums we decided to implement a standalone REST based web-service in ECC which can be called from a HTML5 screen.

This blog post gives the details of the  POC we developed as part of the solution.

We found Christian Jianelli’s blog really helpful


The POC has a very simple &  singular function. It accepts a material number in the screen and retrieves the material group from ECC and displays it. Here are the steps

  1. In SE24 create a class to implement the interface IF_HTTP_EXTENSION. Implementing the individual HTTP request handler implements the method CL_HTTP_EXT_EXAMPLE~HANDLE-REQUEST.



2.In SE24 again – create a ‘Z’ copy of the class CL_TREX_JSON_SERIALIZER. This will help us in creating serialized json response



3.Coming back to the class created in step 1, in the method IF_HTTP_EXTENSION~HANDLE_REQUEST . We need to capture the action verb that will come with our request. In our case this will be a simple ‘GET’ request



If the action is not ‘GET’ we generate a 405 error


In the else part of the above loop we will have our logic to read the material number and return the material group.


We retrieve the material number from the request



We do our select





It’s now time to call the serializer class created in step 2 and generate the response


This completes the code for our class & method

  1. Next stop SICF. Create the service. Call the class created in step 1 in the handler list

Activate the service

  1. Time to test the service. I am using SOAPUI for the testing

Right click on the service and choose Test Service



Your default web-browser will be opened & it will ask for your ECC credentials. Log in. Copy the URL from the web-browser


Now Open SOAPUI – in File choose NEW REST Project

Paste the copied URL




The following screen will open

Add an additional parameter matnr below sap-client & give a valid material number from the system


Add basic authorization – this will be your ECC credentials


You should see the following response

Give a non-existent material and execute, this will generate the error response

So our service seems to be working. Next step a simple HTML5 screen.  If you have limited exposure to web-programming then has pretty good resources to get you started


  1. Screen

I created the screen via ECLIPSE UI5 project. Open eclipse and choose projects


In the pop-up screen select UI5 & press next. Give project name


It will open a project, as this is a POC – we created simple screen elements in the index.html

We created an input box and button


Now we have to code myFunction. In this case on click our webservice will be called and material group retrieved

Pass the value of the input box to variable p_ndc

Pass the url of the webservice to variable myurl


Pass the other specifications required to call the web-service. I have hardcoded the ECC credentials in the call

  1. Once completed, right click the index.html page in project explorer and choose web-app preview


The following screen should appear


Give your material number and press the button and you should see a response






Our REST web-service in ECC can be called from any front-end screen. This concludes our POC. Thanks for reading.












Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthew Billingham
      Matthew Billingham

      Nice and clear, and what I like about it, the complete end-to-end process.

      Author's profile photo Piyush Philip
      Piyush Philip
      Blog Post Author

      Thanks Matthew

      Author's profile photo Shai Sinai
      Shai Sinai

      Thanks for sharing your experience.

      I hope that in your final implementation you don't really store your user credentials in client side.

      Author's profile photo Piyush Philip
      Piyush Philip
      Blog Post Author

      Thanks Shai

      Yes in the final installation credentials will not be stored – we will be using this instead

      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      Quite nice End-To-End process. Thank you for sharing.

      What I'm missing a bit is the reason why you want to copy the class CL_TREX_JSON_SERIALIZER to a Z-object.

      Author's profile photo Piyush Philip
      Piyush Philip
      Blog Post Author

      Hi Uwe...thanks. You don't need to, initially wanted to make some modification to the methods which were not needed but ended up using the Z copy anyways for the POC.

      Author's profile photo Akshatkumar Abhaykumar
      Akshatkumar Abhaykumar

      Hey great blog piyush.

      Please Feel free to check out my video when you get chance on how we can easily make our classes exposed as RestAPI and consume them easily on a great platform Neptune:



      Author's profile photo Bencsik Mátyás
      Bencsik Mátyás


      I am not a SAP developer, only I interested in a web based project (and mobile applicaton project). We need to connect to an SAP server. The bast way the RestFul Api with JSON data structurure (GET, and POST methods)

      What doI need to ask from the SAP owner?

      Do we need any (extra) licese for SAP (for the web services)?

      How do we need configure the network to connect the SAP?

      How do we make safer the auhtentication?


      I will happy with Any useful information! Thank You!!!!