Copy Document Pattern

Entering a Document with all the options and multiple lines can be a lot of work, and sometimes similar Documents already exist in the system. This is often a reverse action of the Document History Pattern, but we can also copy the outstanding documents.

Note

An explanation on the use of Copy Document Pattern is available at https://www.youtube.com/watch?v=aTiwroXwW_0&list=PLhZ3P-LY7CqmVszuvtJLujFyHpsVN0U_w&index=17.

An example of this is creating a Credit Memo from a Posted Sales Invoice where all the information is copied, including the Customer, Items, and the correct posting dates.

Technical description

The Copy Document Pattern objects are a Processing Only Report that calls into an internal function called the Codeunit. The Report object needs to understand the valid options to copy the data around. We can, for example, copy a Posted Sales Shipment to a Sales Order, but we cannot copy a Sales Order to a Posted Sales Invoice.

The direction where we copy the data always needs to be an unprocessed document.

Validation logic

Unlike the posting pattern, we cannot only use TRANSFERFIELDS. We need to apply business logic that checks if the values are still valid. If we copy a document that has been in the archive for a year, the Product Master Data might be discontinued. Each Document has a unique set of validation protocols that follow functional data entry patterns. This protocol should be used in the Copy Document functions.

This following screenshot illustrates the validation logic to create a Sales Line:

Validation logic

This means that if the validation logic in the Document changes because we add fields or change the data entry order we need to change the Copy Document too.

Implementations

Copy Document Pattern is implemented in the major functional areas of Microsoft Dynamics NAV: Sales, Purchasing, Assembly Management, and Service Management. The production orders are allowed to be copied, but they don't follow this pattern.

Examples

The following objects are used by the Pattern:

Object

Description

Report 292

Copy Sales Document

Report 492

Copy Purchase Document

Report 901

Copy Assembly Document

Report 5979

Copy Service Document

Codeunit 6620

Copy Document

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.177.115