Transfer order reservation entry

BeliasBelias Member Posts: 2,998
I'm really angry with the item tracking: i can't make the transfer order work!
here's how my code looks like:
CreateReservEntry.SetDates(0D,0D);
      CreateReservEntry.SetApplyFromEntryNo(0);
      TrackSpec."Serial No. Substituted" := '';
      TrackSpec."Vendor Warranty Date" := 0D;
      TrackSpec."Vendor Lot No." := '';
      TrackSpec."Vendor Serial No." := '';
      CreateReservEntry.NewFields(TrackSpec);  // add values to custom fields - no problem here
      
      // enter in inbound
      CreateReservEntry.CreateReservEntryFor(
        5741,0,DocumentNumber,'',0,ReferenceLineNumber,-1,1,SerialNumber,'');
      CreateReservEntry.CreateEntry(
        ItemNumber,'',TransferLine."Transfer-from Code",TransferLine.Description,0D,0D,0,3);      

// I've also tried to copy the first lines of code here, too...without results

      // enter in outbound
      CreateReservEntry.CreateReservEntryFor(
        5741,1,DocumentNumber,'',0,ReferenceLineNumber,1,1,SerialNumber,'');
      CreateReservEntry.CreateEntry(
        ItemNumber,'',TransferLine."Transfer-to Code",TransferLine.Description,0D,0D,0,3);

The problem is that the reservation entries are correctly created, but they're both positive! ](*,)
Thanks in advance for your suggestions!
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    If I look at code in Codeunit Create Reserv. Entry function CreateReservEntryFor
    I noticed
    InsertReservEntry."Quantity (Base)" := SignFactor(InsertReservEntry) * Quantity;
    
    and In Function SignFactor
    DATABASE::"Transfer Line":
        IF ReservEntry."Source Subtype" = 0 THEN // Outbound
          EXIT(-1)
        ELSE
          EXIT(1);
    

    i think you are sending subtype in reverse format

    Try
    // enter in inbound
          CreateReservEntry.CreateReservEntryFor(
            5741,1,DocumentNumber,'',0,ReferenceLineNumber,-1,1,SerialNumber,'');
          CreateReservEntry.CreateEntry(
            ItemNumber,'',TransferLine."Transfer-from Code",TransferLine.Description,0D,0D,0,3);      
    
          // enter in outbound
          CreateReservEntry.CreateReservEntryFor(
            5741,0,DocumentNumber,'',0,ReferenceLineNumber,1,1,SerialNumber,'');
          CreateReservEntry.CreateEntry(
            ItemNumber,'',TransferLine."Transfer-to Code",TransferLine.Description,0D,0D,0,3);
    
  • BeliasBelias Member Posts: 2,998
    It appears it doesn't work...it creates 2 negative entries, but this doesn't make sense, i'm going to double check my code :shock:
    I also tried to pass 2 negative values, and the quantity is inserted correctly. Unfortunately, i'm having some problems with the quantity in the tracking lines (nav says that i have to ship 2 qty)

    Anyway, this module have been heavily customized...don't lose time on this, i'll post the solution when i'll find it.
    Thanks for now! :thumbsup:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Did you try the code or just a guess?

    i think it will work.. please check once..
  • BeliasBelias Member Posts: 2,998
    Yes, i obviously tried...please reread my previous message
    (i edited my previous message while you were writing, i think...sorry)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • BeliasBelias Member Posts: 2,998
    ](*,) ](*,)
    ok, i just recreated 2 reservation entry that are PERFECTLY the same as 2 entries generated from the page of the transfer order tracking lines.
    The thing that drives me creazy is that i can see the two line generated "by standard" in the manually created transfer order, but i can't see my automatically generated reservation entries...there must be some table to fill somewhere else... :-k
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • bekiobekio Member Posts: 204
    Create two Transfer Orders with the same item on it.
    At first Transfer Order create manuly Item Tracking, and at the second Transfer Order create tracking based on your function.
    Go to Reservation Entry table and put the filter on Source ID(No. from first Transfer Order and second Transfer Order xxx|yyy), and compare fields where is your problem.

    Mostly is the Source SubType filed that is different, you have to fill it as the first order, if you want it to be visible to your transfer your automatic reservation.
  • BeliasBelias Member Posts: 2,998
    bekio wrote:
    Create two Transfer Orders with the same item on it.
    At first Transfer Order create manuly Item Tracking, and at the second Transfer Order create tracking based on your function.
    Go to Reservation Entry table and put the filter on Source ID(No. from first Transfer Order and second Transfer Order xxx|yyy), and compare fields where is your problem.

    Mostly is the Source SubType filed that is different, you have to fill it as the first order, if you want it to be visible to your transfer your automatic reservation.
    This is exactly what i did! :cry: I'll give it another try, anyway...but i'm going to smash my laptop if this is not going to work :evil:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • bekiobekio Member Posts: 204
    And don't forget that Transfer Orders creates two lines one positive and one negative, positiv is when you pres POST Receive(Tranfer to Location), and negative is when you POST Shippment(Transfer from Location).

    :-k
  • MGM08MGM08 Member Posts: 41
    The reference number you are passing ,hope its the transfer line number..

    Also the type should be surplus i think. you are passing Prospect.

    Please try it once.
  • BeliasBelias Member Posts: 2,998
    MGM08 wrote:
    The reference number you are passing ,hope its the transfer line number..
    Sure!
    MGM08 wrote:
    Also the type should be surplus i think. you are passing Prospect.

    Please try it once.
    Yes, i already noticed and corrected it, thank you.
    Now, i've managed to make my lines appear in the order (i guess it was for the "prospect" problem), but i will update the topic within some days when i'll solve the "quantity" problem. Now, i've got something more urgent to do. Thanks for now!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • MGM08MGM08 Member Posts: 41
    Belias wrote:
    MGM08 wrote:
    The reference number you are passing ,hope its the transfer line number..
    Sure!
    MGM08 wrote:

    i was talking abt ReferenceLineNumber not the table number.the global ReferenceLineNumber was pointing to the tranfer line's Line No i hope.


    Also the type should be surplus i think. you are passing Prospect.

    Please try it once.
    Yes, i already noticed and corrected it, thank you.
    Now, i've managed to make my lines appear in the order (i guess it was for the "prospect" problem), but i will update the topic within some days when i'll solve the "quantity" problem. Now, i've got something more urgent to do. Thanks for now!
  • BeliasBelias Member Posts: 2,998
    why did you quote me, MGM? :?
    By the way, i found that NAV calls the create CreateReservEntryFor function just one time...I'm wondering how it creates the second reservation... :-k
    I'm going to drill some more time into this code (item tracking it's the hardest module i've been debugging in nav, so far...i hope you'll never have to do it)
    EDIT: NAV CALLS THE FOLLOWING FUNCTION! i'll try to replicate the behaviour, or i'll use a dirty approach (copy the just created reservation entry and the change the fields i need... :-$ )
    ItemTrackingMgt.SynchronizeItemTracking(CurrentSourceRowID,SecondSourceRowID,DialogText);
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • jreynoldsjreynolds Member Posts: 175
    Belias wrote:
    i found that NAV calls the create CreateReservEntryFor function just one time...I'm wondering how it creates the second reservation
    I usually use Client Monitor and Code Coverage to figure out these sorts of issues. After running the process with these turned on, filter the Client Monitor results for table 337 and look for the INSERTs. This should point you to the code where the second reservation is inserted. If you put a breakpoint on that line of code and run the process again with the debugger on you will stop at that point and you can examine the execution stack to see exactly where the second entry is being created.
  • MGM08MGM08 Member Posts: 41
    Sorry. For reply i pressed quote.

    Also as u said the system calls this functionality "ItemTrackingMgt.SynchronizeItemTracking(CurrentSourceRowID,SecondSourceRowID,DialogText)"

    But i prefer the dirty method as u said.
    Only changes will be the fields Positive, quantity fields, Source Subtype,The expected date instead of shipment date and LOCATION :)

    If you find any more changes please do update.
  • MGM08MGM08 Member Posts: 41
    Try after inserting the first record.


    CurrentSourceRowID := ItemTrackingMgt.ComposeRowID(5741,
    0,Transfer Line.Document No.,
    '',0,
    Transfer Line.Line No.);

    SecondSourceRowID := ItemTrackingMgt.ComposeRowID(5741,
    1,Transfer Line.Document No.,
    '',0,
    Transfer Line.Line No.);

    DialogText := '';

    Then try to call the function
    ItemTrackingMgt.SynchronizeItemTracking(CurrentSourceRowID,SecondSourceRowID,DialogText);
  • BeliasBelias Member Posts: 2,998
    yes, did this thing before going lunch and it appeared to work...
    I'm testing it...
    CurrentSourceRowID := ItemTrackingMgt.ComposeRowID(TBTrackSpec."Source Type",
            TBTrackSpec."Source Subtype",TBTrackSpec."Source ID",
            TBTrackSpec."Source Batch Name",TBTrackSpec."Source Prod. Order Line",
            TBTrackSpec."Source Ref. No.");
          SecondSourceRowID := ItemTrackingMgt.ComposeRowID(TBTrackSpec."Source Type",
            1,TBTrackSpec."Source ID",
            TBTrackSpec."Source Batch Name",TBTrackSpec."Source Prod. Order Line",
            TBTrackSpec."Source Ref. No.");
    
          ItemTrackingMgt.SynchronizeItemTracking(CurrentSourceRowID,SecondSourceRowID,'');
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.