ArcherPoint Dynamics Developer Digest - vol 123

ArcherPoint Dynamics Developer Digest - vol 123

The NAV community, including the ArcherPoint technical staff—is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of sharing helpful information with one another to help customers be more successful.

As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media…so everyone can benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share this great information with everyone who might not have the time to check out the multitude of resources out there? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV experts and devotees around the world. We hope these insights will benefit you, too.

Converting Inventory with Blank Location Code

The team is working on a project to convert inventory from a blank location to using a location code. The issue is that all the sales orders have reservations to inventory, so we need to break that link, convert the inventory, and then create new reservations.

Does anyone have an approach for creating reservations for all open sales lines?

Kyle Hardin posts, “This code can do that. I have a 3PL integration that imports sales orders, so I had to create the reservations from scratch as I create each sales order line:

CLEAR(ReservationEntry);
WITH ReservationEntry DO BEGIN
SETRANGE(“Source Type”, DATABASE::”Sales Line”);
SETRANGE(“Source Subtype”, SalesLine.”Document Type”);
SETRANGE(“Source ID”, SalesLine.”Document No.”);
SETRANGE(“Source Ref. No.”, SalesLine.”Line No.”);
SETRANGE(“Lot No.”, Buffer.Lot);
IF ISEMPTY THEN BEGIN
CreateReservEntry.SetDates(0D, 0D);
CreateReservEntry.CreateReservEntryFor(
DATABASE::”Sales Line”, SalesLine.”Document Type”,
SalesLine.”Document No.”, ”, 0, SalesLine.”Line No.”, SalesLine.”Qty. per Unit of Measure”,
Buffer.Confirmedlotquantity, Buffer.Confirmedlotquantity, ”, Buffer.Lot);
CreateReservEntry.CreateEntry(Item.”No.”, SalesLine.”Variant Code”, SalesLine.”Location Code”,
Item.Description, DT2DATE(Buffer.DMDate), DT2DATE(Buffer.DMDate), 0, 2); // surplus
END; // with
END;

CreateReservEntry = codeunit 99000830

Buffer is just a holding record that I have imported from the 3PL, so you’d need to change those to whatever is appropriate, probably the sales line itself.”

UPDATED: The code snip above didn’t do what Ed needed with the reservations. I used it for importing web orders and didn’t care about reservations, but the code above does deal with item tracking for lots which I did care about.

The team settled on this code:

Set the Reserve Type on the order line to Always

CLEAR(ReservMgt);
ReservMgt.SetSalesLine(“Sales Line”);
ReservMgt.AutoReserve(FullAutoReservation, ‘Auto Reserve Through Batch Function’,
“Planned Shipment Date”, “Outstanding Quantity”, “Outstanding Qty. (Base)”);

Another suggestion was: during a hybrid upgrade, we used dataports to bring out the lot tracking table data and then bring it back in. It seems you could do the same thing and change the location code in the associated tables.

And lastly, the conclusion: The two lines above seemed to work fine on all sales orders. These were straight reservations against Item ledger entries not related to lot or serial number. We had to transfer 17,000 items with quantity on hand to a new location and let all the sales orders re-reserve against the new item ledger entries.

Leadership Lines

“Success seems to be connected with action. Successful people keep moving. They make mistakes, but they don’t quit.”
– Conrad Hilton  
 
“If your work is becoming uninteresting, so are you. Work is an inanimate thing and can be made lively and interesting only by injecting yourself into it. Your job is only as big as you are.”
– George C. Hubbs  

Want to be kept abreast of what’s new in the Microsoft Dynamics NAV community and at ArcherPoint? Subscribe to our monthly newsletter, Better Business, and stay in the know!

If you are interested in NAV development, check out our collection of NAV Development Blogs.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed