Options

How to attach lot number to transaction - web services?

mgiffordmgifford Member Posts: 44
edited 2009-05-20 in NAV Three Tier
I am trying to import "consumption journal" entries into NAV via web services - the first part seems easy and I have been able to get the basic lines imported. The part I cannot seem to follow well enough in the code to figure out is trying to specify the lot numbers being consumed for a given item.

In the classic form you would select a line then Line-> Item Tracking Lines and enter the lot information there. I had hoped that I could load the Item Tracking Lines Page via web services and enter the data. The problem is that there is a ton of code being called prior to launching the Item TRacking Lines screen when it is called from the classic client. So, I can't just run the page and fill out the fields/validate as I had really hoped to.

Can anyone shed some light on better approach for me? I am not getting very far in trying to sort through the code. How would you recommend importing this with webservices?

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    create a codeunit and publish it with same Name as the Page and in the function create the reservation entries.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    mgiffordmgifford Member Posts: 44
    Thanks, so I basically I just have to hit the 337 Reservation Entry table with the proper settings? I was getting pretty twisted around the Item Tracking table's involvment (or lack thereof). I just saw in another post a description of the copying back and forth that occurs behind the scenes.
  • Options
    ara3nara3n Member Posts: 9,255
    you use the following code to insert a Lot
    CreateReservEntry.SetDates(
      0D, 0D);
    
    reateReservEntry.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,
      '',
      'mylotNo');
    
    CreateReservEntry.CreateEntry(
      ItemJnlLine."Item No.",
      ItemJnlLine."Variant Code",
      ItemJnlLine."Location Code",
      ItemJnlLine.Description,
      ItemJnlLine."Posting Date",
      ItemJnlLine."Document Date",
      0,
      2);
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    mgiffordmgifford Member Posts: 44
    That is awesome! Thank you very much.
  • Options
    ara3nara3n Member Posts: 9,255
    you are welcome.

    reateReservEntry is a codeunit 99000830 (Create Reserv. Entry) btw.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    mgiffordmgifford Member Posts: 44
    Thanks, yea, I didnt see it initially, but found it. I am not familiar with it, so your sample of which calls to use, etc is extremely helpful.
Sign In or Register to comment.