Test SAP HTTP connection ready for REST Web Service call



This is the second part of a series that will teach you how to consume/use/call a Web Service from within your SAP system and use the data received to perform and action within your ABAP code.  

If you want to call a REST Web Service from your SAP system you should first test SAP HTTP Connection to make sure your SAP system has access to the outside world and the particular Web service you want to call. Again using the REST web service http://gturnquist-quoters.cfapps.io/api/random, which I found on https://spring.io/guides/gs/consuming-rest/ so have a look on here if it has stopped working for some reason.

There are actually some very basic and easy to use ABAP programs that will help you do this. They have been around for a long time but you may not have come across them before if you haven't had to deal with HTTP connections. I suspect there are many people just finding out about these while learning about web service calls.


SAPHTML_DEMO1 ABAP report

This is basically a simple ABAP based web browser, think chrome, IE but within the SAP GUI. This simply allows you to view a web page so by Inserting your Web Service URL (or any URL) you can confirm that your SAP system has access to the internet. You may already know it has access but this is a good way to prove it if you are trying to pinpoint a communication issue. I have been asked before does your SAP system have access to the internet to which my reply has been yes of course it has...but how do I demonstrate that quickly???

To use this ABAP report simply execute transaction code SE38, enter program name  SAPHTML_DEMO1 and hit execute.

This example Rest service will try and download the response into a file.

Test SAP HTTP Connection with SAPHTML_DEMO1

But you could also test access to the internet as a whole by entering any website such as google.com


SAPHTML_DEMO1

SAPHTML_DEMO1

RSWF_TEST_HTTP

The RSWF_TEST_HTTP ABAP report allows you to test the HTTP connection to your Web Service to ensure it is communicating ok. To do this again go to t-code SE38 and enter the report name as RSWF_TEST_HTTP and hit execute.

execute RSWF_TEST_HTTP_1

Now enter the URL of your Web Service i.e. http://gturnquist-quoters.cfapps.io/api/random.

test http connection using RSWF_TEST_HTTP RSWF_TEST_HTTP

You will then see the results of the test

RSWF_TEST_HTTP test result
Progress Bar

The next step in the series is to call the web service from within your SAP system. There are two options to do this, either within a BSP using HTML and JS code or within your ABAP code using the HTTP Object Methods. In my opinion the HTML/JS way of calling a Web Service from SAP should be the best solution but it does not always work if the Web Service does not handle cross domain origins correctly    

Test Web Service using POSTMAN

How to quickly test your REST Web Service using GetPostMan


SAP date_after_range error
If you are using SAP functionality to check a date, for example maybe you are using the below function module[...]
SAP S_ALR Transactions
List of SAP S_ALR transactions: S_ALR_87007814 -MRM-Relevant Flow Types S_ALR_87007817 -Maintain Evaluaton Type S_ALR_87009287 -Securities: Fin. Transaction Types S_ALR_87009293 -Securities:[...]
CL_ESFSMP_PROPERTY_PROVIDER SAP Class
CL_ESFSMP_PROPERTY_PROVIDER is a standard SAP class available within R/3 SAP systems depending on your version and release level. Below is[...]
CL_MOBILE_SYSTEM_LOGIN SAP Class – Logon Page for Mobile Devices
CL_MOBILE_SYSTEM_LOGIN is a standard SAP object class available within R/3 SAP systems depending on your version and release level. Below[...]
SAP CRM Tables within the data dictionary and their relationships
There is so much CRM information stored in hundreds of thousands of SAP CRM tables! But how do you know[...]
ABAP predefined data types such as Char, Date, Time, integer
Simple ABAP code to demonstrate the ABAP predefined data types such as Char, Date, Time, integer. Note you would usually[...]

About the Author se80