Lanham EDI Mapping for 810 segment TDS element 02

Hello Everyone,

I can’t believe that I never had this issue before, but I am trying to map an EDI 810 that has SAC segments for invoice allowances (discounts). The TDS 01 must contain the actual invoice amount (Amount_Including_VAT) - no problem with this.

The TDS 02 must contain the invoice amount not including the allowances. I don’t see any invoice header fields that contain this value. I found an EDI OUT field called “Inv. Amt. Before Inv. Disc.”, but when I map that I get a value of zero, so I am guessing there is something else I have to do to get that to work. Does anyone know?

Hi Lewis,

The ‘Inv. Amt. Before Inv. Disc.’ EDI Out is calculated based on the Inv. Discount Amount values on the Sales Invoice Lines and the Amount on the Sales Invoice Header. So even if you’re not using the Inv. Discount Amount field for the discounts it should at least show the Amount from the header. Do you have a Length set on the EDI Out element line in the TDS segment?
You could try deleting and re-adding the EDI Out on the element line.
Let me know if it still shows a value of 0.

Valerie

Maybe I had a length of zero, but now when I use EDI Out “Inv. Amt. Before Inv. Disc.” I get the actual invoice amount and not the amount before the SAC allowance lines are applied (which are entered on the order as G/L type lines).

Lewis,

I don’t think there is an out of the box EDI Out that calculates the amount minus discounts that are entered onto the order as G/L lines. Code would probably be needed to create a custom EDI Out to subtract the GL amounts from the Invoice Amount.

Let me know if you have any questions.

Valerie

Lewis,

This is what I found in old notes about creating an EDI Out field:

  1. Go to the report Load E.D.I. Navision Field (Report No. 14002350), go to the SetUpOutFields() function and find the section of the outbound Navision document you are creating the EDI Out for. Example for the sales invoice 810 search for the E_SLSINV document, enter the code for each of the EDI Out fields. There are several predefined EDI Outs to reference. Compile the object, run the Load E.D.I. Navision Fields report. The E.D.I. Map codeunit will create in text format (note the location of the file when the report is ran) import and compile the E.D.I. Map object. Next, bring the fields into your map.
  2. In the codeunit to create the outbound file, example for a Sales Invoice 810 codeunit 14002360 E.D.I. Sales Invoice Send, create the EDI Outs in the LoadEDIOutFields functions (Examples below). You would assign the value of the EDI Out field value to whatever datatype is for. If the value is a decimal assign to the variable Decimal Variable. If the value is a text value, use the variable OutFldArray[i]. One more thing, if the value you are trying to calculate based on all the sales invoice lines then you will need to take extra steps. You must create a variable to hold the running total and go to function UpdateTotalLines and do your calculation. Look below for example of Total Freight Amt.

The EDI Out examples below can be used as a reference.
Codeunit 14002360 – LoadEDIOutFields function

'Net Unit Price':
  IF SalesInvoiceLine.Quantity > 0 THEN
    DecimalVariable := SalesInvoiceLine.Amount / SalesInvoiceLine.Quantity
  ELSE
    DecimalVariable := 0;

'Inv. Amt. Before Inv. Disc.':
  BEGIN
    InvDiscAmount := 0;
    SalesInvoiceLine2.SETRANGE("Document No.",SalesInvoiceHeader."No.");
    IF SalesInvoiceLine2.FIND('-') THEN
      REPEAT
        InvDiscAmount := InvDiscAmount + SalesInvoiceLine2."Inv. Discount Amount";
      UNTIL SalesInvoiceLine2.NEXT = 0;
    DecimalVariable := SalesInvoiceHeader.Amount + InvDiscAmount;
  END;

'Total Freight Amt.':
  DecimalVariable := InvFreightAmt;

Extra step for running totals and/or total fields

UpdateLineTotals()
IF NOT OutputOff THEN BEGIN
LineNumber := LineNumber + 1;
InvTotalUnits := InvTotalUnits + SalesInvoiceLine.Quantity;
InvTotalBaseUnits := InvTotalBaseUnits + SalesInvoiceLine.“Quantity (Base)”;
InvGrossAmt := InvGrossAmt + (SalesInvoiceLine.“Unit Price” * SalesInvoiceLine.Quantity);
END;

IF EDITotalFields.GET(
‘Total Freight Amt.’,SalesInvoiceLine.Type,SalesInvoiceLine.“No.”)
THEN
InvFreightAmt := InvFreightAmt + SalesInvoiceLine.Amount;

Setting up an EDI OUT is broken up into 2 parts:

Part 1:

Report 14002350 Load E.D.I. Navision Fields, Function SetUpOutFields()

Go to the section of the map you want to create the EDI Out for

Make a call to the function WriteEDIOutFields for example:

WriteEDIOutFields(
‘E_SLSINV’,1,'Inv. Amt. Before Inv. Disc.’,3,'Inv. Amt. Before Inv. Disc.’);

Parameters description:

1st parameter is the Navision Document

2nd Field type (whether it is an EDI Out or EDI In)

3rd EDI Out Field

4th Data type

5th Description

Then run the report so that the EDI Out field gets created, a message box will display to import and compile a file, do so from the object designer.

Part 2:

The next thing you need to do is go to the Codeunit that handles that document in this example it will be 14002360 E.D.I. Sales Invoice Send. Depending on what variables you need to get your EDI Out you may need a variable to hold the value. Put your logic in to get the value (if values from the sales invoice line needs to be added up then you will need to add your code in function UpdateLineTotals), then in function LoadEDIOutFields() add to the case statement with the EDI Out field used in part 1. If the EDI Out is a text data type then you will need to assign the value to OutFldArray[i] := else assign it to the appropriate variable:

DecimalVariable for Decimal

IntegerVariable for Integers

DateVariable for Dates

Issue resolved thanks to my friends at ArcherPoint.

The TDS 02 gets mapped to EDI OUT code GROSS INVOICE,
(The TDS 01 gets mapped to Sales Header field Amount_Including_VAT).