> For the complete documentation index, see [llms.txt](https://kb.bevica.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.bevica.com/documentation/integration/bevica_warehouse_integration/setting_up_communication_engine_for_vision_stock_reconciliation.md).

# Setting up Communication Engine for Vision Stock Reconciliation

Configure Communication Engine mappings for Vision stock reconciliation messages.

{% hint style="warning" %}
**Prerequisites**

Bevica Warehouse Integration extension installed.

Communication Engine extension installed.

Account with a Vision managed warehouse: LCB, Vinotheque, Lanchester, EHD, Coterie Vaults.
{% endhint %}

## Communication Engine

The communication engine is a solution framework to enable the communication of data between Bevica and various endpoints such as a Vision warehouse.

## Initial Setup

If you are not already using the communication engine to send or receive other files from the warehouse, e.g. orders, you will need to complete some initial setup. If you are already using the communication engine you can skip this part and move to setting up the communication engine route.

{% stepper %}
{% step %}

### **Warehouse Integration Setup**

You will need to populate the following Vision account information in the Warehouse Integration Setup record. The information will be supplied by Vision or your warehouse.

* Path to API e.g.
  * <http://kingmoor.lcb.co.uk> (LCB)
  * <http://edi.ehdlondon.co.uk> (EHD)
  * <http://kingmoor.lanchestergroup.com> (Lanchester)
* Customer Code
* Site Code
* API Username (Client ID)
* API Password (Client Secret)
  {% endstep %}

{% step %}

### **Communication Engine Setup**

Prior to setting up any communication engine routes you need to initialise the communication engine. To do this:

1. Search for **Communication Engine Setup** and select to **Initialise Setup**. Note that if you receive an error about the TVTCOM package this can be ignored.
2. Search for **Warehouse Integration Setup**, open the **Warehouse Supplier Setup** card and select **Actions, Create Communication Engine Auth.**
   {% endstep %}
   {% endstepper %}

{% hint style="info" %}
Note

Users will need the **COMMUNICATION ENGINE permission set** to access this functionality if they are not a super user.
{% endhint %}

## Setting up a Communication Engine Route

You will need to set up a new communication engine route for [Warehouse Item Reconciliation](/documentation/integration/bevica_warehouse_integration/warehouse_item_reconciliation.md). To do this, search for **Communication Engine Routes** and create a new record. Populate the fields as follows:

| Field                   | Note                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Code                    | Enter a code for the record e.g. LCB\_STOCKREC                                                                                                                                                                                                                                                                                                                                                             |
| Type                    | Http                                                                                                                                                                                                                                                                                                                                                                                                       |
| Direction               | Inbound                                                                                                                                                                                                                                                                                                                                                                                                    |
| Communication Code      | <p>• Enter a Code, e.g. LCB\_STOCKREC<br><br>• End Point = /service/StkPrdtE/CustomerCode//SiteCode/<br><br>• is the URL base e.g.<http://kingmoor.lcb.co.uk><br><br>• is the Customer Code e.g. ABCDE<br><br>• is the Site Code e.g. CR<br><br>• Content Type = application/xml<br><br>• Method = Get<br><br>• Authentication Code, drill down and select the record that has been created e.g. LCB01</p> |
| Description             | Enter a description                                                                                                                                                                                                                                                                                                                                                                                        |
| Route Action            | Vision Stock Reconciliation                                                                                                                                                                                                                                                                                                                                                                                |
| Synchronise Routes      | Tick this                                                                                                                                                                                                                                                                                                                                                                                                  |
| Process Message         | Tick this                                                                                                                                                                                                                                                                                                                                                                                                  |
| Task Scheduler          | Tick this if you are going to set up the job queue                                                                                                                                                                                                                                                                                                                                                         |
| Task Sched. Parameter   | Populate this, e.g. STOCKREC. This will be the value to populate the Parameter String on the job queue for codeunit 68807. See below.                                                                                                                                                                                                                                                                      |
| Whse. Integration Setup | Select the relevant Warehouse Integration Setup record.                                                                                                                                                                                                                                                                                                                                                    |

## Retention policy setup

If you don't have this setup already, you can define a retention policy to delete outdated communication engine message records. To do this:

{% stepper %}
{% step %}

### Step 1

Choose the ![](https://2932934759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfUgpGDVvyqBWVvwVIy9a%2Fuploads%2Fgit-blob-d08791d5454211f4ad6c103dcb698478e14f0cc7%2FlkSQid0_R5gHXL6QmCsGIS4HBwZVQYDsmg.png?alt=media) icon, enter **Communication Engine Setup**, and then choose the related link.
{% endstep %}

{% step %}

### Step 2

Select Setup Comm. Messages Retention Policy.
{% endstep %}

{% step %}

### Step 3

Amend the defaults if required and select to **Enable**.
{% endstep %}
{% endstepper %}

For more information, see [Retention Policies](https://learn.microsoft.com/en-gb/dynamics365/business-central/admin-data-retention-policies).

## Importing and comparing stock files manually

Whilst you are testing the functionality you can run the process manually:

{% stepper %}
{% step %}

### **Import stock file from Vision**

* From the Communication Engine Routes page, select Run Communication Engine in the ribbon
* This will import the file from Vision. You should see the No. of Messages Completed has increased. Drill down to see the message created
  {% endstep %}

{% step %}

### **Create the Warehouse Item Reconciliation Batch**

* Search for Inbound Requests. You should see a new record in here which was created in step 1
* Select Process Requests in the ribbon. Select the Warehouse Code and optionally enter the Entry No. you would like to process
  {% endstep %}

{% step %}

### **Run Compare Vision Inventory**

* Search for Whse. Item Reconciliation Batches. You will see a new batch/es has been created by step 2
* Search for Compare Vision Inventory, select the Discrepancy Calculation Method and Batch No. and click on OK. You can open the Whse. Item Reconciliation Batch record to see details of discrepancies. See details below.
  {% endstep %}
  {% endstepper %}

## Setting up the job queues

Once you are happy with the functionality you can set up the job queues to run these three functions. The job queues can be set up to run 5 minutes apart, overnight to lessen timing issues between the two systems:

{% stepper %}
{% step %}

### **Import the stock file from Vision**

* This will retrieve the data from Vision and create an Inbound Request record in Bevica
* Create a job queue entry for **Codeunit 68807 TVTCOM Run from Job Queue**
* Set the **Parameter String** to be the same value as the **Task Sched. Parameter** value on the Communication Engine Route record for the stock reconciliation record. Note that if you are unable to see the Task Sched. Parameter field on the Communication Engine Route page you will need to personalise the page.
* Set the job queue entry to run on relevant days e.g. Monday to Friday
* Set the **Starting Time** and **Ending Time** according to when you want to bring the file into Bevica. Normally this could be run overnight or at the end of the working day. You only want the job queue to run once, so for example set the Starting Time to be 03:00 and the Ending Time to be 03:05.
* Set the job queue to Ready
  {% endstep %}

{% step %}

### **Process the inbound request record created**

* This will process the inbound request record and create the Warehouse Item Reconciliation batch
* Create a job queue entry for **Report 71302 Whse. Integration Process Inbound Requests**

  Under the Job Queue ribbon, open the **Report Request Page** enter the relevant Warehouse Code and optionally enter the Supplier Request Code (STOCKSNAP)

  Set the job queue entry to run on relevant days e.g. Monday to Friday

  Set the **Starting Time** and **Ending Time** to run after codeunit 68807 e.g. 03:05-03:10

  Set the job queue to Ready.

{% hint style="info" %}
You are only able to retrieve the file 2 times in a 24 hour period. If you exceed this Vision will return an error.
{% endhint %}
{% endstep %}

{% step %}
**Compare Vision stock with Bevica**

* This will run the comparison routine to compare the data from Vision with the data in Bevica
* Create a job queue entry for **Report 71304 Compare Vision Inventory**
* Under the Job Queue ribbon, open the **Report Request Page** and set the following:
  * Set Whse. Item Reconciliation Batch filter, **Processed = No**.
  * Set **Discrepancy Calculation Method** to either 'Open inventory' or 'Whse. Available Inventory'. See below.
* Set the job queue to run on relevant days e.g. Monday to Friday
* Set the **Starting Time** and **Ending Time** to run after report 71302 e.g. 03:10-03:15
* Set the job queue to Ready
  {% endstep %}
  {% endstepper %}

## **Discrepancy Calculation Method**

This allows you to change the way Bevica compares warehouse stock balances.

| Discrepancy Calculation Method option    | Note                                                                                                                                                                                                                                                                                                                                                         |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Open Inventory (Inc. Frozen)             | Compares high level inventory figures. This compares the physical stock in the warehouse (incl. frozen stock) against Bevica's Inventory figures (incl. Paid Reserves). Calculation: Total Open Singles - Bevica Inventory.                                                                                                                                  |
| Whse. Available Inventory (Inc. Frozen)  | As above but add quantities on orders into the mix. This compares the physical stock in the warehouse (incl. frozen stock) plus quantities allocated to orders against Bevica's Inventory figures (incl. Paid Reserves) less those quantities already sent to the warehouse. Calculation: Total Open Singles - Bevica Inventory - Qty. Sent to Whse. (Base). |
| Open Inventory (Excl. Frozen)            | As per 'Open Inventory (Inc. Frozen)' but removes frozen stock from the comparison calculation so if the discrepancy is the frozen stock it will show as a match. Calculation: Total Present Singles - Bevica Inventory.                                                                                                                                     |
| Whse. Available Inventory (Excl. Frozen) | As per 'Whse. Available Inventory (Inc. Frozen)' but removes frozen stock from the comparison calculation so if the discrepancy is the frozen stock it will show as a match. Calculation: Total Present Singles - Bevica Inventory - Qty. Sent to Whse. (Base),                                                                                              |

#### **Report 71304 Compare Vision Inventory**

![](https://2932934759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfUgpGDVvyqBWVvwVIy9a%2Fuploads%2Fgit-blob-f460813d3ecbfa399c9378b3c35579b74a73c64e%2Fc00wVJMtPoVQD2CpH5tQ8UIuEoQI6sFnEA.png?alt=media)

![](https://2932934759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfUgpGDVvyqBWVvwVIy9a%2Fuploads%2Fgit-blob-77c171a578ad71d751c667eaffcb5b9a78110c50%2FHp5bTErF7bvE9R2V9eg6U-qTUI7x9M0_Ig.png?alt=media)

## Troubleshooting

See [Communication Engine Messages](/documentation/integration/bevica_warehouse_integration/communication_engine_messages.md) for details of how communication engine messages are generated and what to do if the message errors.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kb.bevica.com/documentation/integration/bevica_warehouse_integration/setting_up_communication_engine_for_vision_stock_reconciliation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
