Importing Item Tracking Lines

Hi,

There is a requirement to create a dataport to import the item tracking lines at the sales order lines → Item Tracking Lines screen.

In an attempt to import the item tracking numbers (at the SO screen) using a dataport, I did the following:
At the ‘Item Tracking Lines’ (Form 6510), I created a menu item ‘Import Tracking Lines’ under the ‘function’ menu button with the following code:

TempItemTrackingLine := Rec; //TempItemTrackingLine is a global var on this form

WITH TempItemTrackingLine DO BEGIN
IF ZeroLineExists THEN
DELETE;
TESTFIELD(“Quantity Handled (Base)”,0);
TESTFIELD(“Quantity Invoiced (Base)”,0);
END;

CLEAR(ImportTrackingSpec); //global var for the tracking spec import dataport

ImportTrackingSpec.SetFields(LastEntryNo,TempItemTrackingLine); //passing the last entry no
and the temp table to the dataport

ImportTrackingSpec.RUNMODAL;

Rec := TempItemTrackingLine;
CalculateSums;

What I understand is that the form 6510 is based on the temporary table
‘TempItemTrackingLine’. So I am trying to have the dataport import the item tracking lines on to this temp table.
The dataport ‘ImportTrackingSpec’ is based on the Integer table. Here, there is a global temporary var called ‘TempTrackingSpecification’ which refers to the tracking specification table.
The SetFields function in this dataport is as follows:

SetFields(LFirstEntryNo : Integer;VAR LTempTrackingSpecification : TEMPORARY Record “Tracking Specification”) : In
FirstEntryNo := LFirstEntryNo;
LTempTrackingSpecification.RESET;
IF LTempTrackingSpecification.FIND(’-’) THEN
REPEAT
TempTrackingSpecification := LTempTrackingSpecification;
TempTrackingSpecification.INSERT(FALSE);
UNTIL LTempTrackingSpecification.NEXT = 0;

At the OnAfterImportRecord() of the dataport:

TempTrackingSpecification.TESTFIELD(“Source ID”);
TempTrackingSpecification.TESTFIELD(“Item No.”);
TempTrackingSpecification.TESTFIELD(“Quantity (Base)”);

SalesLine.RESET;
SalesLine.SETRANGE(“Document Type”,SalesLine.“Document Type”::Order);
SalesLine.SETRANGE(“Document No.”,TempTrackingSpecification.“Source ID”);
SalesLine.SETRANGE(Type,SalesLine.Type::Item);
SalesLine.SETRANGE(“No.”,TempTrackingSpecification.“Item No.”);
IF SalesLine.FIND(’-’) THEN BEGIN
TempTrackingSpecification.“Source Type” := DATABASE::“Sales Line”;
TempTrackingSpecification.“Source Subtype” := SalesLine.“Document Type”;
TempTrackingSpecification.“Source Ref. No.” := SalesLine.“Line No.”;
TempTrackingSpecification.“Entry No.” := FirstEntryNo + 1;
TempTrackingSpecification.INSERT;
END;
ItemTrackingLinesForm.ReturnTempTrakingLine(TempTrackingSpecification);

‘ItemTrackingLinesForm’ is a var referring to form 6510(‘Item Tracking Lines’). The ‘ReturnTempTrakingLine’ function on this form has the following code:

ReturnTempTrakingLine(VAR TempTrackingSpec : TEMPORARY Record “Tracking Specification”)
TempItemTrackingLine.RESET;
TempItemTrackingLine.DELETEALL;

TempTrackingSpec.RESET;
IF TempTrackingSpec.FIND(’-’) THEN
REPEAT
TempItemTrackingLine := TempTrackingSpec;
TempItemTrackingLine.INSERT;
UNTIL TempTrackingSpec.NEXT = 0;
TempItemTrackingLine.RESET;

All this works fine. But after the import, the imported records cannot be seen on the ‘item tracking lines’ form. I found that the imported records are not copied onto the temporary table ‘TempItemTrackingLine’.

Any clue as to why this is happening?

Regards,
Anse

Hi,

Just being Curious… why should you Import Item Tracking lines? is it beco’z the User doesn’t want to create Serial or Lot Numbers manually?

Kind regards,

Panjam.

probably he has a scanner from which he has to import scanned values to navision.

Yes, it is beco’z the User doesn’t want to create Serial or Lot Numbers manually. Also these numbers are not sequential.

Regards,

Anse

Hi Anse, sorry for replying so late, I hope I can still help.

Basically doign all this to create temp records is just a huge amount of work, and in any case I am not sure if you will get it to work, since the temp records will only exist with in the form.

Anyway, I think a better way is just to insert the Reservation Entries directly. This is just then an issue of setting up the key fields:

Reservation Status, Source Type, SubType, Batch No and Ref No. then put in you data, create an entry numebr, and insert. I think it will be a lot less work this way.

http://www.mibuso.com/forum/viewtopic.php?t=14822&highlight=reservation+entry+importing+tracking

Same thread from same user is posted here and marked as Solved (with the same resolution as yours, David).

Almost the same list of good navision experts are visiting and active on both forums and I must confess that I don’t see a point of having to separeted forums with almost the same crew and topics, but it’s not on me to judge it.

Ah so its resolved, great to hear, I will make the thread as such.