> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the ERP info data interface

> Display orders and stock levels directly from the ERP system in the shop, without copying the data there.

> [!NOTE]
>
> This chapter is being revised. If you have any questions, please contact your WEBSALE contact person.

A logged-in customer wants to know what they ordered last year and whether an item is currently available. Both answers are in the ERP system, not in the shop. The ERP info data interface fetches them from there when the customer asks. Nothing is copied.

> [!WARNING]
>
> The interface was developed for the V4 ERP system from D\&G and can only be used with it.

## Requirements

For the interface to take effect, four conditions must be met:

* The interface has been activated by WEBSALE AG.
* The buyer is logged in.
* The buyer has a customer number.
* This customer number cannot be changed by the buyer in the shop.

The last condition is not a formality. A changeable customer number would mean that any customer could retrieve the orders of any other customer.

## Technical setup

| Item | Value |
| - | - |
| Transfer | HTTP via port 80 |
| Encryption | Blowfish with 128 bits |
| Data format | XML |
| Character encoding | UTF-8 |

For the shop to reach your ERP system, WEBSALE needs two details from you: the IP address at which the system can be reached, and the address the shop should call.

> [!NOTE]
>
> If the ERP system cannot be reached directly from the internet, WEBSALE provides VPN access. The system then establishes a secure connection to the shop itself.

## Coordination with the ERP system

The shop can only show what the ERP system delivers. This determines the order of work:

1. Define which data the ERP system delivers.
2. Configure this data in the shop module.
3. Build the templates that display this data.

Anyone who starts with step 3 builds fields that will never be filled.

## What the customer can filter

| Filter | Effect |
| - | - |
| Number | how many orders the overview list shows |
| Period | from date to date |
| Period as selection | this week, last week, this month, last month and more |
| Order type | completed orders, open orders, cancellations, returns and more |
| Search | free search in all fields passed by the ERP system |

## Setup

### Step 1: Activation

The function must be activated. Contact your WEBSALE contact person.

### Step 2: Creating the configuration

For each subshop that uses the interface, a `wws-online-interface.config` file belongs in the shop's configuration directory. It can also be created via the Online Service Area.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
# Die Namen der Templates sind frei wählbar
<Templates>
   ListEntries    = incl_wws_list.htm
   ShowEntry      = incl_wws_detail.htm
   PendingEntries = incl_wws_pending.htm
   error          = incl_wws_error.htm
   StockAmount    = incl_wws_stockamount.htm
   CommonRequest  = incl_wws_commonrequest.htm
</Templates>

# Auftragstypen, textuelle Ersetzung
<Types>
   Standard = 1
   onChange = submit();
   0        = Offene Bestellungen
   1        = Historische Einkäufe
</Types>

# Auswahl für die Anzahl der Einträge, Werte frei wählbar
<MaxEntries>
   Standard = 5
   onChange = submit();
   +Entry   = 5
   +Entry   = 10
   +Entry   = 20
   +Entry   = 50
   +Entry   = 100
</MaxEntries>

# Auswahl des Zeitraums
<PeriodSelection>
   ShowYearsAgo = 10
   MonthName1   = Januar
   MonthName2   = Februar
   ...
   MonthName12  = Dezember
   AltThisWeek  = Diese Woche
   AltLastWeek  = Letzte Woche
   AltThisMonth = Dieser Monat
   AltLastMonth = Letzter Monat
   AltThisYear  = Dieses Jahr
   AltLastYear  = Letztes Jahr
   AltOnchange  = submit();
</PeriodSelection>

# Kopfdaten: die Parameter sind optional, ihre Bedeutung ist fest
<HeadData>
   H1  = Kundennummer
   H2  = Bestelldatum
   H3  = Bestelluhrzeit
   H4  = Bestellnummer
   H6  = Belegnummer
   H7  = Belegdatum
   H8  = Betrag
   H9  = Vorgang
   H11 = Ausgeliefert am
   H12 = Ausgeliefert mit
   H13 = Paketnummer
   H14 = Paketverfolgung
   H16 = Shop-Nummer
   H50 = Referenz Text
   H300 = Offsetfeld 2
</HeadData>

# Positionsdaten: die Parameter sind optional, ihre Bedeutung ist fest
<PositionData>
   P1   = Menge
   P2   = Werbemittel
   P3   = Artikelnummer
   P4   = Varianten-Information 1
   P5   = Varianten-Information 2
   P6   = Preis
   P21  = Bezeichnung
   P22  = Lieferstatus
   P429 = Feld 429
   P388 = Feld 388
</PositionData>
```

> [!WARNING]
>
> The numbers of the header and position data cannot be assigned freely. Each number stands for a specific field; `H1` is always the customer number and `P1` is always the quantity. You only define which fields appear and how they are labeled.

Reference: Description of the "wws-online-interface.config" configuration

### Step 3: Templates for displaying orders

Five templates are needed for the orders: one master template and four module templates that appear within it via external includes.

| Template | Shows |
| - | - |
| Master template | the frame from which the others are loaded |
| Overview list | the orders in the list |
| Single order | an order with its positions |
| Orders not yet transferred | orders that the ERP system does not yet know about |
| Error messages | what went wrong |

You call the master template in the customer account; its name can be chosen freely:

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<a href="~WS-SSLLoadTpl(ws_online_erp.htm)~">Meine Aufträge</a>
```

The module templates are included within it:

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{WS-OnlineERPLink}
   ~WS-ExternInclude($WS-OnlineERPLink$)~
{/WS-OnlineERPLink}
```

> [!NOTE]
>
> The enclosing tags ensure that the area only appears if the interface is available at all. Without them, a malfunction results in an empty page in the customer account.

Reference: WS-SSLLoadTpl() · WS-OnlineERPLink · WS-ExternInclude()

Guide: Integrating external content

### Step 4: Templates for the stock level query

Three templates are sufficient here: the master template, the stock display and the error messages.

The master template is called with the product and variant index:

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<a href="~WS-SSLLoadTpl(ws_online_erp_stock.htm)~&prod_index=~PR-ProdIndex~&depvar_index=~PR-VarIndex~">Verfügbarkeit prüfen</a>
```

The module template is included in the master template. The `erp_pn` parameter passes the product number; any product data field can be used for this.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{!ST-Robot}
   {WS-OnlineERPStockLevelLink}
      ~WS-ExternInclude($WS-OnlineERPStockLevelLink$&erp_pn=$PR-NumberEnc$)~
   {/WS-OnlineERPStockLevelLink}
{/!ST-Robot}
```

> [!WARNING]
>
> Enclosing with `{!ST-Robot}` is mandatory. Without it, every search engine crawler sends a request to your ERP system for every product, on every pass through the entire product range.

> [!NOTE]
>
> Which product data field the ERP system expects depends on the system. With D\&G, for example, it is `PR-OrderInfoEnc` instead of `PR-NumberEnc`. Coordinate this with the contact person for your ERP system.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{!ST-Robot}
   {WS-OnlineERPStockLevelLink}
      ~WS-ExternInclude($WS-OnlineERPStockLevelLink$&erp_pn=$PR-OrderInfoEnc$)~
   {/WS-OnlineERPStockLevelLink}
{/!ST-Robot}
```

Optionally, a branch identifier can be passed or selected. Clarify the details with WEBSALE.

Reference: WS-OnlineERPStockLevelLink · Styles for the ERP info data interface · Tags for the ERP info data interface

## Related topics

* Guide: Integrating external content
* Guide: Integrated Data Interface (IDS)
* Guide: Customer account


## Related topics

- [ERP- (ERP info data)](https://dokumentation.websale.de/en/v8s/referenz/tags/erp-wws-infodaten.md)
- [Styles for modules and interfaces](https://dokumentation.websale.de/en/v8s/referenz/styles/module-und-schnittstellen.md)
- [Interfaces](https://dokumentation.websale.de/en/v8s/schnittstellen.md)
- [Integrated Data Interface (IDS)](https://dokumentation.websale.de/en/v8s/externe-dienste/integrierte-daten-schnittstelle-ids.md)
- [Configuration wws-online-interface.config](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/konfiguration-wws-online-interface-config.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.