1. SOP Despatch¶
The order import created orders. In this section you despatch them, so that 13.2 can invoice them.
Sage 200 generates two of the numbers involved: the order line id and the
despatch number. You capture a generated value the same way each time. You have
already done it once, with Sage200OrderNo in Step 4,
which comes back out of the connector holding the order number Sage 200
assigned.
Map > Field Mapping¶
The order lines need to carry the line id Sage 200 assigns them, so that Sage 200 can match the despatch to the right line. They also need to ask Sage 200 to allocate stock, because a line with no allocation cannot be despatched.
- Re-open the integration and press the Transform Setup tab.
- Open the Map transform and press Field Mapping.
- Set Current Transaction Id to
OrderDetails. -
Press Add and fill the dialog:
- New Field Name
- For training, enter:
Sage200LineId
- For training, enter:
- Type
- For training, select: Text
- Evaluate
- For training: unticked.
- Evaluate String
- Leave empty. The field is blank on purpose. It gives the connector somewhere to put the value Sage 200 generates.
- New Field Name
-
Press the green tick, then Add again for the second field:
- New Field Name
- For training, enter:
AllocationQty
- For training, enter:
- Type
- For training, select: Decimal
- Evaluate
- For training: ticked.
- Evaluate String
%Qty
- New Field Name
-
Press the green tick. Both fields appear at the end of the grid.
-
Press Refresh, then Close to commit the transform, and save the integration.
Allocate the whole quantity, or the despatch despatches less
AllocationQty is %Qty because you allocate the whole quantity ordered.
If you allocate less, the despatch despatches less.
Sage 200 Order Connector > Field Mapping¶
- Open the OrderImport connector and press Field Mapping.
- Set Current Transaction Id to
OrderDetails. -
Press Edit and map the two new rows:
Incoming Field Map To Sage 200 Extra Field Sage200LineId SOPOrder Return Line AllocationQty To Allocate Quantity -
Press Save on the grid.
Choosing a Sage 200 Extra Field ticks that row's Import box for you. Import makes the field flow out of the connector to the transforms downstream.
The connector renames fields to their Sage 200 names on the way out
The connector renames fields to their Sage 200 names on the way out, as
Step 7 described. Downstream of this
connector the transactions are SOPOrder and SOPOrderLine, and the field
you just created appears as SOPOrderReturnLine, not Sage200LineId.
The name you chose appears only here.
That is why you need the mapping. Without it, SOPOrderReturnLine is not in
the connector's output, and the despatch has nothing to match its lines
against.
Press Refresh to re-generate the orders. Scroll the preview to its right-hand end and expand an order. Both fields have come back filled in: a Sage 200 line id against each line, and the quantity it allocated:
Press Close and save.
Without To Allocate Quantity, Sage 200 allocates on its own
Without To Allocate Quantity mapped, Sage 200 allocates what it can on its
own and reports a warning for anything it cannot:
StockItemHoldingInsufficientException
20180 - The specified quantity exceeds the stock available at the location.
The job still completes and Sage 200 still creates the orders, so you might not notice for several runs. But an unallocated line cannot be despatched, and the despatch below would skip it without reporting an error.
If you see that warning, the warehouse named in Step 6.1 does not hold enough stock. Check the free stock for the items in the workbook before you suspect the mapping.
Design > Transform Setup¶
You need two more fields: one to receive the despatch number, and one to tell Sage 200 to despatch. They go in a Map transform of their own, connected to the order connector.
- Open the Transforms group in the palette and drag a Map onto the design surface, below the order connector.
- Drag a Connector from the same group and join the order connector to it.
- Save the integration. You cannot open a newly dropped transform until you do.
The order connector now feeds two branches: the CSV writer built in step 9, and this one.
Post Order Map > Field Mapping¶
Double click the new transform to open it. On its Setup tab set Transform
Id to POSTORDERMAP. A new Map is named Map_1, and the audit report shows
whatever id you give it.
Press Field Mapping and leave Current Transaction Id on SOPOrder, the
order header. Press Add twice:
- Name
DespatchNumber
- Type
- Text
- Evaluate
- Unticked
- Evaluate String
- Empty
- Name
DoDespatches
- Type
- Boolean
- Evaluate
- Ticked
- Evaluate String
True
DespatchNumber is empty for the same reason as Sage200LineId. DoDespatches
carries a value. It tells Sage 200 to despatch the order, instead of recording
the despatch as unconfirmed.
Press Refresh. The two new columns appear at the end of the preview, the first
empty and the second True.
Press Close and save the integration.
Filter the non-stock lines¶
The orders carry three kinds of line: items, charges and comments, set up in 6.1 and 6.2. Only items can be despatched. If a charge line reaches the despatch, it has no stock item to despatch and the run fails.
- Drag a Filter from the Transforms group onto the surface, to the right
of
POSTORDERMAP, join them with a Connector, and save. - Open it. On its Setup tab, set Transform Id to
STOCKLINES. This is the second Filter in the integration, so it is namedFilter_1, as 6.3 said it would be. - Press Field Mapping and set Current Transaction Id to
SOPOrderLine. -
Enter the Record Evaluation formula:
-
Press Refresh and expand the first order. It keeps its two item lines and loses the
Carriagecharge and the comment line: -
Press Close and save.
Why the filter goes here
The formula uses SOPLineType, not LineType, because this filter is
downstream of the connector and the field carries its Sage 200 name. The
three values are the ones 6.1 set: 0 for an
item, 2 for a charge and 3 for a comment.
The filter goes here, not earlier, because the charges and comments must reach the order connector: they belong on the order. They must not reach the despatch.
Sage 200 Despatch Connector > Setup¶
- Open the Connectors group in the palette and drag a Sage 200 connector onto the surface, to the right of the Filter.
- Join the Filter to it with a Connector, and save.
- Double click it to open it.
- Transform Id
- For training, enter:
DESPATCH
- For training, enter:
- Sage 200 Extra Connector
- The Sage 200 company to write to. Choose this first. Until it is set, the Import Type list below is empty.
- For training, select: Sage200 Demo Data
- Sage 200 Extra Import Type
- For training, select:
SOP Despatch
- For training, select:
- Update Operation
- For training, leave as: Insert. It is the only option this import type offers.
Set the import type before you build the mapping
Set the import type before you build the mapping. Once the connector is configured the field is disabled, because changing the type would invalidate every mapping underneath it. If you pick the wrong one, delete the transform and start it again.
Sage 200 Despatch Connector > Field Mapping¶
The connector receives two transactions from upstream: SOPOrder, the order
header, and SOPOrderLine, the order lines. Map each one to the Sage 200
transaction it becomes.
- Press Field Mapping. Current Transaction Id is on
SOPOrder. -
Set Sage 200 Extra Transaction Type to
SOPDespatchReceiptAdjustment.The Transaction Level Mapping panel underneath summarises what is mapped to what. Check it as you go. It should read
SOPOrder→SOPDespatchReceiptAdjustment,SOPOrderLine→ Not mapped. -
Press Edit and map the order header fields:
Incoming Field Map To Sage 200 Extra Field DocumentNo Order Return No DespatchNumber Despatch Receipt Number DoDespatches Do Despatches -
Press Save on the grid.
-
Change Current Transaction Id to
SOPOrderLine, then set Sage 200 Extra Transaction Type toSOPDespatchReceiptItem.
The two drop-downs do different jobs
To change which grid you are looking at, use the top drop-down, Current Transaction Id. The bottom one, Sage 200 Extra Transaction Type, changes what the top one is mapped to.
-
Press Edit and map the order line fields:
Incoming Field Map To Sage 200 Extra Field LineQuantity Quantity SOPOrderReturnLine SOPOrder Return Line -
Press Save on the grid.
This mapping ties a despatch line to its order line
SOPOrderReturnLine → SOPOrder Return Line ties each despatch
line to the order line it fulfils. You created Sage200LineId for it at the
start of this section. Without this mapping, the despatch has a quantity but
no line to put it against.
Running it¶
Press Refresh. Sage 200 creates the despatches, and the number it generated for each one comes back onto the preview:
Press Close and save the integration.
Every Refresh of this connector despatches again
Every Refresh of this connector despatches again. A connector's Refresh is not a preview: it writes to Sage 200. A Refresh also replays a cached copy of the dataset from the transform above, so this connector receives the same orders it has already despatched.
Refresh from the Excel Read downwards, as Step 9 describes. A run that starts at the reader creates a fresh set of orders, and every transform after it works on those.
Preparing to generate the invoice¶
The next section prints each invoice to PDF and posts it. It needs five fields that the dataset does not yet carry.
- Add another Map to the right of the despatch connector, join it, and save.
- Open it, and on its Setup tab set Transform Id to
INVOICEPREP. - Press Field Mapping, leave Current Transaction Id on
SOPDespatchReceiptAdjustment, and press Add five times:
- Name
DocumentType
- Type
- Integer
- Evaluate
- Unticked
- Evaluate String
0, which means an invoice, not a credit.
- Name
ExportPath
- Type
- Text
- Evaluate
- Ticked
- Evaluate String
"C:\IMan\OutputData\" & %DespatchReceiptNumber & ".pdf"
- Name
InvoiceNo
- Type
- Text
- Evaluate
- Unticked
- Evaluate String
- Empty. 13.2 fills it in, in the same way as
Sage200LineId.
- Empty. 13.2 fills it in, in the same way as
- Name
PostInvoice
- Type
- Boolean
- Evaluate
- Unticked
- Evaluate String
True
- Name
Layout
- Type
- Text
- Evaluate
- Ticked
- Evaluate String
"Layouts\SOP Invoice (Single).layout"
The file is named after the despatch number, not the invoice
Replace the first part of ExportPath with your own IMan shared data
directory if it differs. C:\IMan\OutputData is the folder
step 9 wrote the order status file to.
The file is named after the despatch number, not the invoice number. The invoice does not exist yet, because 13.2 creates it, so its number cannot be part of a path that 13.2 receives as an input. There is one despatch per invoice here, so the despatch number identifies the file just as well.
Press Refresh. Because ExportPath is evaluated, each row now carries the
full path its invoice will be written to:
Press Close and save the integration. The branch now looks like this:














