Importing Starting Inventory from Legacy System

matttraxmatttrax Member Posts: 2,309
All inventory is serialized, so Item Tracking Code is SNALL.

Pulling data into an item journal line. Normal stuff like posting date, description, quantity, the usual.

Using the following code to add the reservation entry:
CreateReservEntry.SetDates(
  0D, 0D);

CreateReservEntry.CreateReservEntryFor(
  DATABASE::"Item Journal Line",
  0,
  ItemJnlLine."Journal Template Name",
  ItemJnlLine."Journal Batch Name",
  0,
  ItemJnlLine."Line No.",
  ItemJnlLine."Qty. per Unit of Measure",
  1,
  SerialNo,
  '');

CreateReservEntry.CreateEntry(
  ItemJnlLine."Item No.",
  ItemJnlLine."Variant Code",
  ItemJnlLine."Location Code",
  ItemJnlLine.Description,
  ItemJnlLine."Posting Date",
  ItemJnlLine."Document Date",
  0,
  2);

Everything looks ok at this point in table 337 (Reservation Entry) and the item journal lines look great.

Posting Error: You must not specify serial no in item journal line...

If I delete the serial number and try to post I get the error:
"Tracking Specification is Missing"

What am I missing here? Debugger and code coverage were less than helpful.

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi matttrax,

    Had this before - you can't put the serial number into the journal line table it need to go onto the reservation table - are you specifing the serial no. on the create entry routine?

    What I normally do is to manually enter a line and then look at the system generated entry

    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • nunomaianunomaia Member Posts: 1,153
    matttrax wrote:
    All inventory is serialized, so Item Tracking Code is SNALL.

    Pulling data into an item journal line. Normal stuff like posting date, description, quantity, the usual.

    Using the following code to add the reservation entry:
    CreateReservEntry.SetDates(
      0D, 0D);
    
    CreateReservEntry.CreateReservEntryFor(
      DATABASE::"Item Journal Line",
      0,
      ItemJnlLine."Journal Template Name",
      ItemJnlLine."Journal Batch Name",
      0,
      ItemJnlLine."Line No.",
      ItemJnlLine."Qty. per Unit of Measure",
      1,
      SerialNo,
      '');
    
    CreateReservEntry.CreateEntry(
      ItemJnlLine."Item No.",
      ItemJnlLine."Variant Code",
      ItemJnlLine."Location Code",
      ItemJnlLine.Description,
      ItemJnlLine."Posting Date",
      ItemJnlLine."Document Date",
      0,
      2);
    

    Everything looks ok at this point in table 337 (Reservation Entry) and the item journal lines look great.

    Posting Error: You must not specify serial no in item journal line...

    If I delete the serial number and try to post I get the error:
    "Tracking Specification is Missing"

    What am I missing here? Debugger and code coverage were less than helpful.

    Manually insert item tracking in journal line. Then compare reservation entries differences between your automated post and manually inserting.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • ara3nara3n Member Posts: 9,256
    Hello You are calling the function CreateReservEntryFor with wrong paramaeter

    CreateReservEntry.CreateReservEntryFor(
      DATABASE::"Item Journal Line",
      ItemJnlLine."Entry Type",
      ItemJnlLine."Journal Template Name",
      ItemJnlLine."Journal Batch Name",
      0,
      ItemJnlLine."Line No.",
      ItemJnlLine."Qty. per Unit of Measure",
      1,
      'tada',
      '');
    

    notice the red.
    CreateReservEntry.CreateReservEntryFor(
    DATABASE::"Item Journal Line",
    ItemJnlLine."Entry Type",
    ItemJnlLine."Journal Template Name",
    ItemJnlLine."Journal Batch Name",
    0,
    ItemJnlLine."Line No.",
    ItemJnlLine."Qty. per Unit of Measure",
    1,
    'tada',
    '');
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.