abap news
Home » ABAP Integration: HTTP, JSON, Files and External Databases

ABAP Integration: HTTP, JSON, Files and External Databases

Most ABAP interfaces are built from the same steps: connect, send or receive, convert and handle errors. Pick the step you need.

Which technique fits?

Situation Technique Example
Call a REST API HTTP client GET and POST with error handling
HTTPS call fails with a certificate error SSL trust Install a certificate in STRUST
Send ABAP data as JSON /UI2/CL_JSON Serialize to JSON
Read a JSON response /UI2/CL_JSON Deserialize JSON
Read a CSV file Parser CSV to internal table
File from the user’s computer SAP GUI GUI_UPLOAD
File to the user’s computer SAP GUI GUI_DOWNLOAD
Text to bytes and back Code pages STRING and XSTRING
Dates in an API Unix, ISO 8601 Date conversion
Query another database ADBC External database connection

Typical REST call, step by step

  1. Make sure SAP trusts the server certificate.
  2. Serialize the request data to JSON.
  3. Send the request with a timeout.
  4. Distinguish transport errors (no status) from HTTP errors (status 400 and higher).
  5. Deserialize a successful response if it has a JSON body (204 No Content has none). Parse a documented error body separately.
  6. Log the request and the status, but not passwords or tokens.

Classic ABAP or ABAP Cloud?

cl_http_client, the SAP GUI file services and EXEC SQL are classic ABAP. In ABAP Cloud, use cl_web_http_client_manager for HTTP and cl_abap_conv_codepage for code pages. Posts on this site name the Cloud alternative where there is one.