# SAP

{% hint style="info" %}
The following documentation is for **SAP v2.5.0** *(BDK)*.
{% endhint %}

## Overview

SAP is an enterprise resource planning (ERP) software providing comprehensive business process management. This integration enables automated data synchronization, transaction processing, and business workflow automation within SAP systems. Streamline enterprise operations and improve ERP system efficiency.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **SAP**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using Base URL, Username and Password

Connects to the SAP OData API.

| Label    | Description                        | Type        |
| -------- | ---------------------------------- | ----------- |
| Base URL | The base URL of the SAP OData API. | `text`      |
| Username | The username to authenticate with. | `text`      |
| Password | The password to authenticate with. | `sensitive` |

## Procedures

### to retrieve some entities from *sap*

Retrieve the list of available SAP entities for a given API service.

**Input Concepts**

| Concept       | Description                                    | Type   | Required | Default Value |
| ------------- | ---------------------------------------------- | ------ | -------- | ------------- |
| `api service` | The API service to retrieve the entities from. | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept  | Description                                       | Type   |
| -------- | ------------------------------------------------- | ------ |
| `answer` | the list of available SAP entities in the Service | `json` |

**Examples**

```generic
retrieve some services from sap
use the first service as the api service
retrieve some entities from sap
    the api service is the api service
```

### to retrieve some services from *sap*

Retrieve the list of available SAP services.

**Output Concepts**

| Concept  | Description                        | Type   |
| -------- | ---------------------------------- | ------ |
| `answer` | the list of available SAP services | `file` |

**Examples**

```generic
retrieve some services from sap
```

### to upload an attachment to *sap*

Upload an attachment to SAP.

**Input Concepts**

| Concept                 | Description                | Type   | Required | Default Value |
| ----------------------- | -------------------------- | ------ | -------- | ------------- |
| `attachment`            | The attachment to upload.  | `file` | Yes      | (no default)  |
| `file name`             | The name of the file.      | `text` | Yes      | (no default)  |
| `business object type`  | The business object type.  | `text` | Yes      | (no default)  |
| `linked sap object key` | The linked SAP object key. | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept  | Description              | Type   |
| -------- | ------------------------ | ------ |
| `answer` | The created entity data. | `json` |

**Examples**

```generic
the attachment
upload the attachment to sap
    the file name is "from-pg2.pdf"
    the business object type is "BUS2012"
    the linked sap object key is "4500002088"
```
