PlantScanner - SAP Service Layer icon

PlantScanner - SAP Service Layer

Interact with SAP Service Layer API

Actions26

Overview

This node enables making custom API calls to the SAP Service Layer, a RESTful interface for interacting with SAP Business One data and services. Specifically, the "Custom API Call" resource with the "Custom Request" operation allows users to specify any endpoint, HTTP method, headers, query parameters, and request body to tailor requests exactly to their needs.

Common scenarios include:

  • Querying specific SAP entities or collections not covered by predefined operations.
  • Executing complex OData queries with filters, selects, and ordering.
  • Creating, updating, or deleting records with custom payloads.
  • Adding custom headers for advanced authentication or integration requirements.

Practical example:

  • Retrieve all items filtered by a certain item code and select only specific fields.
  • Create a new business partner by sending a POST request with the required JSON body.
  • Update an order status using a PATCH request with a custom body.
  • Delete a record by specifying the DELETE method on the appropriate endpoint.

Properties

Name Meaning
Custom Endpoint The specific SAP Service Layer endpoint to call (e.g., Items, BusinessPartners, Orders).
HTTP Method The HTTP method to use for the request. Options: GET, POST, PUT, PATCH, DELETE.
Filter (GET only) OData filter string to narrow down results (e.g., ItemCode eq 'ITEM001').
Select (GET only) Comma-separated list of fields to include in the response. Leave empty to get all fields.
Order By (GET only) Comma-separated list of fields to order by, with optional desc for descending order.
Custom Headers Additional HTTP headers to send with the request, specified as a JSON object (e.g., {"Accept": "application/json"}).
Custom Body (POST, PUT, PATCH only) JSON-formatted request body to send with the request (e.g., {"ItemCode": "ITEM001"}).

Output

The node outputs an array of JSON objects corresponding to the responses from the SAP Service Layer API calls. Each item in the output contains a json property holding the parsed JSON response data from the API.

  • For GET requests, this typically includes the requested entity or collection data.
  • For POST/PUT/PATCH requests, it includes the created or updated entity details or confirmation.
  • For DELETE requests, the response may be empty or contain status information.
  • If errors occur and "Continue On Fail" is enabled, the output will include an error field describing the issue.

The node does not output binary data.

Dependencies

  • Requires valid credentials for the SAP Service Layer API, including URL, company database, username, password, and optionally language.
  • Uses HTTPS requests with an agent configured to ignore unauthorized SSL certificates (rejectUnauthorized: false).
  • Relies on the SAP Service Layer session cookie obtained via login before making API calls.
  • No additional external dependencies beyond standard HTTP client libraries bundled with n8n.

Troubleshooting

  • Failed to get session cookie: Indicates login to SAP Service Layer failed. Verify credentials and network connectivity.
  • Operation not supported: Occurs if an unsupported operation is selected. Ensure "Custom Request" operation is chosen for custom calls.
  • Invalid JSON in Custom Headers or Custom Body: The node expects valid JSON strings for these inputs. Use proper JSON formatting.
  • API errors returned in response: These are surfaced in the output under an error field if "Continue On Fail" is enabled. Check the error message for details.
  • SSL certificate issues: The node disables SSL verification; however, network proxies or firewalls might interfere. Confirm network settings allow access.
  • Incorrect endpoint or method: Ensure the custom endpoint matches SAP Service Layer naming conventions and the HTTP method is appropriate for the action.

Links and References

Discussion