Skip to Content
Author's profile photo Nitin Arora

API Business Hub : ABAP code snippet for APIs

SAP API Business Hub is a central catalog of SAP and selected partner APIs to search, discover, test and consume these APIs in order to build extensions or integrations using the Cloud Platform.
URL: https://api.sap.com
Since SAP API Hub launched in spring 2016, we have been delivering new features to simplify and ease the API consumption experience right from rich API documentation to API test capability.
API Business Hub will be a year old soon, now its a time to take  quick feedback from API consumers. We interacted with people working in ABAP, They shared their experience with API Business Hub and effort to consume listed APIs in ABAP.  To simplify the consumption we came up with code snippet for ABAP. Code snippet  for javascript, java, curl and swift already exist.

ABAP system should be configured to call http APIs. Once configured, code snippet is copied in the editor to call APIs in API Business Hub

 

Steps to configure ABAP system.

  1. Launch SAP Logon Screen

2. Enter the login credentials in R/3 ABAP System

 

3. Configure proxy settings

  • Go to transaction SICF
  • Click on execute

 

Open Proxy settings page by pressing Ctrl + F2 and set the proxy

 

 

4. Export SSL certification from Browser (chrome)

  • Open google chrome

 

  • Enter F12
  • Go to security tab
  • Click on view certificate
  • Click on Details and select Copy to File..

  • Export the certificate by path

5. Import certificate in ABAP system

  • Go to transaction STRUST
  • Open SSL client SSL client (standard)
  • switch to edit mode

  • Click on import certificate
  • Select the certificate which was exported in the previous step
  • Click on ‘Add to Certificate List’
  • Save

 

6. Restart ICM

  • Restart is needed for SSL settings to be reflected.
  • Go to transaction SMICM
  • Navigate through  Administration -> ICM -> Exit Hard -> Global

 

  • ICM restart message will appear

  • Restart ICM processes
  • Make sure no client is communicating during restart

 

With above steps, ABAP system is configured with proxy setting and SSL certificate

 

Using code snippet in ABAP report

 

1. Go to transaction se38

 

2. Create a report

  • Enter the program name
  • Select Source Code
  • click on Create

  • Enter Title
  • Type : Executable program
  • Status: Test Program

 

  • Save, activate and execute the report

3. Copy ABAP code snippet from API Business Hub

  • Launch https://api.sap.com
  • Navigate to API package
  • In this example Translation Hub  is selected.

 

  • ‘Expand operations’ for a Domains resource
  • Click on ‘Generate Code’

  • Click on code snippet for ABAP and ‘Copy to Clipboard’

 

  • copy code snippet in report [  ABAP system]

 

  • Provide the APIKey value in code ( its specific to user and could be copied from API Business Hub)
  •  Save, activate and Execute

  • API tested successfully.

 

As we understood, define and capture the value,  we will reach out to ABAP developers to get their feedback. We will share their experience in next blog. Stay tuned!

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Douglas Cezar Kuchler
      Douglas Cezar Kuchler

      Hi Nitin, congratulations for this excellent blog and also the other one on doing the same through WebIDE! It's really nice to know how to access API hub from both sides.

      Can you please share some example on how to actually use an API once connected? I wanted to embed a map on both an ABAP and an SAPUI5 application and wished to know how to do that.

       

      Thank you!

      Douglas

      Author's profile photo Nitin Arora
      Nitin Arora
      Blog Post Author

      Hi Douglas,

      Are you looking forward for some specific API usage?

       

      Regards,

      Nitin

      Author's profile photo Saritha Koroth
      Saritha Koroth

      Hi Nitin,

      We are trying to execute a similar API (OCR API in our case)  from our internal ABAP system and have done the settings as per steps mentioned for setting up proxy/SSL certificate setup etc.

      But we are unable to test it via ABAP program as we are getting a communication failure error.

      The screenshots available in this blog refer to  url like https://apihub.hanatrial.ondemand.com:443/translation whereas we noticed that for our api, it is something like -   https://sandbox.api.sap.com/ml/ocr

      Kindly suggest the settings that we might have to do in this case please.

      Thanks,

      SK

      Author's profile photo Sameer Sawant
      Sameer Sawant

      Hi Saritha, We are getting a similar issue that you have highlighted here . Were you able to find a workaround/solution for your problem ?

       

      Thanks,

      Sameer

      Author's profile photo Saritha Koroth
      Saritha Koroth

      No Sameer, unfortunately we couldn't proceed further on it.

      Regards,

      Saritha