The OData Client proxy allows to consume OData services but also pure REST services programmatically using ABAP. The following sample code can be used to perform more complex requests than the ones that are provided as code snippets within the ABAP Development Tools in Eclipse.
It also contains a sample for the consumption of a pure REST service.
This sample code uses the well-known Swagger Petstore Sample which can also be found on GitHub.
It shows how the OData proxy client can be used to also consume pure REST services that are no OData service.
In the ABAP sample code you will have to replace the constant petstore_url.
CONST: petstore_url type string value ‘’ .
with the URL that points to the hosted version that is described in the above mentioned GitHub repository or an instance that you are running on your own.
The ABAP code can be used on:
- SAP BTP, ABAP Environment
- SAP S4HANA Cloud, ABAP Environment
- SAP ABAP Platform 2021 and later
- Create a package (e.g.)
TEST_CP_REST_SAMPLE
- Start the report
ZABAPGIT
orZABAPGIT_STANDALONE
depending on what you have installed in your system - Create an offline repository or an online repository with the package and with the URL of this GitHub repository
- Pull changes
- Use mass activation to activate the objects that have been imported in step 3
Create an issue in this repository if you find a bug or have questions about the content.
For additional support, ask a question in SAP Community.
If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.
Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.