Importing Item Tracking Lines

afrancis
afrancis Member Posts: 43
There is a requirement to create a dataport to import the item tracking lines at the sales order lines -> Item Tracking Lines screen.

I understand that this form is based on a temporary version of the Tracking Specification table. What are the points to be kept in mind while creating this dataport.

Regards,
Anse

Answers

  • Phenno
    Phenno Member Posts: 630
    afrancis wrote:
    There is a requirement to create a dataport to import the item tracking lines at the sales order lines -> Item Tracking Lines screen.

    I understand that this form is based on a temporary version of the Tracking Specification table. What are the points to be kept in mind while creating this dataport.

    Regards,
    Anse


    You should look at Reservation Entry table in wich are temporary tracking lines stored (for particular sales line entry).

    at least, in v. 3.60, this was our way to do import of serial and part numbers from external device (handheld scanners)
  • afrancis
    afrancis Member Posts: 43
    Hi Phenno,

    Could you please throw some light on the procedure?

    Thanks,
    Anse
  • Phenno
    Phenno Member Posts: 630
    afrancis wrote:
    Hi Phenno,

    Could you please throw some light on the procedure?

    Thanks,
    Anse


    Insert a record into Reservation Entry per serial number.
    On that line you have to add information about sales line, item etc.

    the best way for start is to open Item tracking Lines from sales order, than add a new serial no. manually to some sales line, that press F8 to see all the fields in that record and respective values in it.

    One line per One serial No. for One sales line. it is pretty much simple.
    we have a button in sales order that says (Import SN's for active sales line) where the code is (actually it is in a one batch report but that is irrelevant).
  • afrancis
    afrancis Member Posts: 43
    Hi Phenno,

    Is your dataport writing to the temporary tracking specification table? Are there any specific checks that you make while doing the import?

    Regards,
    Anse
  • afrancis
    afrancis Member Posts: 43
    Hi,

    The requirement is to create a dataport to import item tracking lines at the sales order screen. The imported item tracking lines should appear on the 'Item Tracking Lines' screen.

    The code behind form 6510 is too complex to follow. Could you give me some hints on creating such a dataport?

    Regards,
    Anse
  • afrancis
    afrancis Member Posts: 43
    Addon to my previous post..
    Do I base my dataport on table 336 or 337? Terribly confused...

    OR

    Is there a way to select multiple item tracking lines at one go when we click the 'Serial No.' AssistEdit button at the 'Item Tracking Lines' screen? I am trying to create the dataport to overcome this issue.

    My client uses 3.7.

    Many thanks in advance.

    Regards,
    Anse
  • Phenno
    Phenno Member Posts: 630
    Table that I use is 337 "Reservation Entry".
    I don't know what do you mean by "temp tracking".
    insert manually a line in item tracking lines windows and than check the status of table 337.
    Tracking Specification Table
    The table is used to carry the item tracking entries of items that have been partially posted. When the document quantity is fully posted, they are summed up with the remaining item tracking entries in the Reservation Entry table.

    And though it does says for very same table:
    It is also used as a temporary table for handling and displaying item tracking via the Item Tracking Lines form.
    it is just using it as a Temp record variable and only for inserting through Item Tracking Lines Form.

    For whole explanaition you can look at description of "Reservation Entry".
    Pay attention to the last sentence
    Reservation Entry Table
    This table is used to handle and store information concerning reservation, item tracking and order tracking.

    When handling item tracking in connection with partial posting, the table works in conjunction with the Tracking Specification table.

    Data entered in the Item Tracking Lines form by the user is created in a temporary version of the Tracking Specification table and committed to the Reservation Entry and Tracking Specification tables when the form is closed.

    Conclusion:
    you don't need Tracking Specification table cause your actions are taken through code.
  • afrancis
    afrancis Member Posts: 43
    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
  • afrancis
    afrancis Member Posts: 43
    In other words, there is a form based on a temporary table. A dataport is called from this form.

    This dataport should update the temp table on which the form is based. Is this possible? Or is there a workaround? I tried doing this (please refer to my earlier post with the code snippets).

    Regards,
    Anse
  • Phenno
    Phenno Member Posts: 630
    afrancis wrote:
    In other words, there is a form based on a temporary table. A dataport is called from this form.

    This dataport should update the temp table on which the form is based. Is this possible? Or is there a workaround? I tried doing this (please refer to my earlier post with the code snippets).

    Regards,
    Anse


    have you tried to update form controls? maybe there are records inserted but the view is not refreshed.
    or they are filtered in view.

    there is a lot of coding here i do not have enough time at the moment to study it (or to try it).
  • afrancis
    afrancis Member Posts: 43
    I did try currForm.update(true), currForm.update(false), currForm.saverecord etc. But the problem persists.
  • Phenno
    Phenno Member Posts: 630
    afrancis wrote:
    I did try currForm.update(true), currForm.update(false), currForm.saverecord etc. But the problem persists.


    sorry, I should take a more deeply look at your code to understand what you're doing, for which I have no time at this moment...


    i still recommend to you to update reservation entry table (after which you can open that same form and it will be fill-up with appropriate values).

    it's only kind of backward operation. yours one is to open form and then fill it, mine is to fill it with data and then open to open form.
  • afrancis
    afrancis Member Posts: 43
    Hi Phenno,

    Thanks for your inputs. Writing directly to the reservation entry table worked.

    Regards,
    Anse
  • Phenno
    Phenno Member Posts: 630
    afrancis wrote:
    Hi Phenno,

    Thanks for your inputs. Writing directly to the reservation entry table worked.

    Regards,
    Anse

    glad to be helpful. :)