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.
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.
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.
- 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’
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!