# SAP

The **SAP Node** in StackAI enables seamless integration with your SAP system, allowing you to automate, retrieve, and manage business data and processes directly within your workflows. It supports a wide range of actions for financial, project, and resource management.

***

**How to use it?**

1. Add the SAP node to your StackAI workflow.
2. Select the desired action (e.g. 'Get Entities From Financial Item Consumption').
3. Establish a connection to your SAP account.
4. Provide the required input parameters and configurations.
5. Connect the output to downstream nodes for further processing or reporting.

***

**Establishing a Connection**

You must already have access to a valid SAP account with the necessary permissions.&#x20;

* **Connection Name (string, required)**
  * **What it is:**\
    A label you assign to your SAP connection. It helps you identify the connection in Stack AI, especially if you have multiple SAP environments (e.g., production, staging, test).
  * **Example:**
    * `Sam's Connection`
    * `Test Connection`
* **SAP Host** **(string, required)**
  * **What it is:**\
    The hostname or IP address of your SAP server. This tells Stack AI where to send API requests.
  * **Example:**
    * `sap.company.com`
    * `192.168.1.100`
    * `sap-prod.internal.corp`
* #### **SAP Port** (string, required)
  * **What it is:**\
    The network port on which your SAP server is listening for API or OData requests. Common SAP ports are 443 (HTTPS) or 50000+ for custom SAP services.
  * **Example:**
    * `443` (for secure HTTPS)
    * `50000` (for SAP NetWeaver Gateway)
    * `8000` (for HTTP, not recommended for production)
* #### **SAP Token URL** (string, required)
  * **What it is:**\
    The URL endpoint used to obtain OAuth2 tokens for authenticating with SAP. This is required if your SAP system uses OAuth2 for secure API access.
  * **Example:**
    * `https://sap.company.com/oauth2/token`
    * `https://sap-prod.internal.corp:443/oauth/token`
    * `https://192.168.1.100:50000/sap/bc/sec/oauth2/token`
* #### **SAP Client** (string, required)
  * **What it is:**\
    The SAP client number is a three-digit code that identifies a logical partition within your SAP system. Each client is like a separate environment (e.g., 100 for production, 200 for test).
  * **Example:**
    * `100` (Production)
    * `200` (Test)
    * `300` (Development)

***

**Action Summary**

<table><thead><tr><th width="226.88067626953125">Name</th><th width="154.60400390625">Required Inputs</th><th width="188.62591552734375">Optional Inputs</th><th>Output</th><th data-hidden>Description</th></tr></thead><tbody><tr><td>Get Entities From Financial Planning Consumption Type</td><td></td><td>$Top, $Skip, $Filter, $Inlinecount, $Orderby, $Select</td><td>Status Code, Headers, Body</td><td>Retrieves entities for a specific financial planning consumption type</td></tr><tr><td>Get Entities From Financial Item Consumption</td><td></td><td>$Top, $Skip, $Filter, $Inlinecount, $Orderby, $Select</td><td>Status Code, Headers, Body</td><td>Retrieves entities for a specific financial item consumption</td></tr><tr><td>Get Entities From Team Project Consumption</td><td></td><td>$Top, $Skip, $Filter, $Inlinecount, $Orderby, $Select</td><td>Status Code, Headers, Body</td><td>Retrieves a list of all accounts</td></tr><tr><td>Get Entities From Work Package Consumption</td><td></td><td>$Top, $Skip, $Filter, $Inlinecount, $Orderby, $Select</td><td>Status Code, Headers, Body</td><td>Retrieves details for a specific account</td></tr><tr><td>Get Entity From Financial Item Consumption By Key</td><td>Guid</td><td>SAP Client, $Select</td><td>Status Code, Headers, Body</td><td>Retrieves a list of all projects</td></tr><tr><td>Get Entity From Financial Planning Consumption Type By Key</td><td>Guid</td><td>$Select</td><td>Status Code, Headers, Body</td><td>Retrieves details for a specific project</td></tr><tr><td>Get Entity From Team Project Consumption By Key</td><td>Projectguid, Hierarchyguid, Appobjectguid, Taskguid, Entityguid</td><td>$Select</td><td>Status Code, Headers, Body</td><td></td></tr><tr><td>Get Entity From Work Package Consumption By Key</td><td>Guid</td><td>$Select</td><td>Status Code, Headers, Body</td><td></td></tr></tbody></table>

* **$Top** (integer)
  * A data service URI with the `$top` system query option returns the first *N* entities from the collection identified by the URI’s resource path. *N* must be an integer ≥ 0; otherwise, the URI is considered malformed.
* **$Skip** (integer)
  * A data service URI with the `$skip` query option returns entities starting from position *N + 1* in the collection identified by the URI’s resource path. *N* must be an integer ≥ 0; otherwise, the URI is considered malformed.
* **$Filter** (string)
  * A data service URI with the `$filter` query option returns entities from the specified EntitySet that satisfy a given boolean expression.
    * **Syntax:** `$filter=<bool expression>`
    * **Example:**\
      `/Orders?$filter=ShipCountry eq 'France'` — returns orders shipped to France.\
      `/Orders?$filter=Customers/ContactName ne 'Fred'` — returns orders where the customer’s contact name is not Fred.
* **$Inlinecount** (string)
  * The `$inlinecount` query option includes the total count of entities (after applying `$filter`) in the response.
    * **Syntax:** `$inlinecount=allpages` (include count) or `$inlinecount=none` (exclude count).\
      Counting behavior is implementation-specific.
* **$Orderby** (string\_array)
  * The `$orderby` query option specifies how to sort entities in the EntitySet identified by the URI’s resource path.
    * **Syntax:** `$orderby=<expression> [asc|desc], <expression> [asc|desc], ...`\
      Default sort order is ascending (`asc`) if not specified.
* **$Select** (string\_array)
  * The `$select` query option returns the same entities as without it, but limits the response to only the specified properties.\
    The service may still include additional properties in the response.
* **SAP Client** (string)
  * In SAP, a client number is a unique, three-digit identifier that distinguishes different business entities or organizational units within a single SAP system. It allows for the separation of data and configurations for various companies or projects, even within the same physical system. Client numbers typically range from 000 to 999, allowing for up to 1000 clients within a single SAP system.
* **Guid** (string)
  * In SAP, a GUID (Globally Unique Identifier) is a unique key used to identify objects or components. It's a string of characters, often 32 hexadecimal characters long, that ensures uniqueness across different systems and databases.&#x20;
  * To find the SAP GUID (Globally Unique Identifier) for an application object, you'll typically need to navigate to the specific transaction or object within the SAP system and access its properties or details. The exact location and method will depend on the specific SAP object you are working with.
* **Projectguid** (string)
  * In SAP systems, a Project GUID (Globally Unique Identifier) is a unique identifier used to distinguish projects, activities, and other related elements within the system. It is a 16-character identifier that is automatically generated by the SAP system.
* **Hierarchyguid** (string)
  * In SAP, a "Hierarchy GUID" typically refers to a Globally Unique Identifier (GUID) used to uniquely identify a hierarchy within the system. This GUID acts as a primary key, ensuring that each hierarchy can be distinguished from others. It's often used in various applications and is a crucial element in data modeling and reporting within SAP.&#x20;
* **Appobjectguid** (string)
  * The Application Object GUID specifically refers to the unique identifier for an "application object"—which could be a project, task, document, or any business object managed within SAP.
* **Taskguid** (string)
  * Taskguid is a 128-bit Globally Unique Identifier (GUID) that uniquely identifies a task object in SAP's project system.
  * In SAP, projects are often broken down into multiple tasks or work packages. Each of these tasks is assigned a unique GUID to distinguish it from other tasks, even across different projects.
* **Entityguid** (string)
  * In SAP, an "entity" in this context typically refers to a specific record or object within the team project consumption module—such as a cost item, resource, or any other sub-object related to a project or task.
  * The **Entityguid** is a 128-bit unique identifier (GUID) that ensures you are referencing exactly the right entity, even if there are many similar records in the system.
