Design Details: Item Tracking Posting Structure
To align with inventory costing functionality and to obtain a simpler and more robust solution, item ledger entries are used as the primary carrier of item tracking numbers.
Item tracking numbers on order network entities and non-order network entities are specified in the Reservation Entry table (T337). Item tracking numbers that are related to historical information are retrieved directly from the item ledger entries that are related to the transaction in question. This means that item ledger entries reflect the item tracking specification of the posted order line.
The Item Tracking Lines page retrieves the information from T337 and the item ledger entries and shows it through the temporary table, Tracking Specification (T336). T336 also hold the temporary data in the Item Tracking Lines page for item tracking quantities that remain to be invoiced.
One-to-Many Relation
The Item Entry Relation table, which is used to link a posted document line with its related item ledger entries, consists of two main parts:
- A pointer to the posted document line, the Order Line No. field.
- An entry number pointing to an item ledger entry, the Item Entry No. field.
The functionality of the existing Entry No. field, which relates an item ledger entry to a posted document line, handles the typical one-to-one relation when no item tracking numbers exist on the posted document line. If item tracking numbers exist, then the Entry No. field is left blank, and the one-to-many relation is handled by the Item Entry Relation table. If the posted document line carries item tracking numbers but only relates to a single item ledger entry, then the Entry No. field handles the relation, and the no record is created in the Item Entry Relation table.
Codeunits 80 (Sales-Post) and 90 (Purch-Post)
To split the item ledger entries during posting, the code in codeunit 80 and codeunit 90, is encircled by loops that run through global temporary record variables. This code calls codeunit 22 with an item journal line. These variables are initialized when item tracking numbers exist for the document line. To keep the code simple, this looping structure is always used. If no item tracking numbers exist for the document line, then a single record is inserted, and the loop runs only once.
Posting the Item Journal
Item tracking numbers are transferred via the reservation entries that relate to the item ledger entry, and the looping through item tracking numbers occurs in codeunit 22 (Item Jnl.-Post Line). This concept works in the same way when an item journal line is used indirectly to post a sale or purchase order as when an item journal line is used directly. When the item journal is used directly, the Source Row ID field points to the item journal line itself.
Code Unit 22 (Item Jnl.-Post Line)
Codeunits 80 (Sales-Post) and 90 (Purch-Post) loop the call of codeunit 22 (Item Jnl.-Post Line) during the invoice posting of item tracking numbers and during the invoicing of existing shipments or receipts.
During quantity posting of item tracking numbers, codeunit 22 (Item Jnl.-Post Line) retrieves item tracking numbers from the entries in T337 (Reservation Entry) that relate to the posting. These entries are placed directly on the item journal line.
Codeunit 22 (Item Jnl.-Post Line) loops through the item tracking numbers and splits the posting into the respective item ledger entries that carry the item tracking numbers. Information about which item ledger entries are created is returned to T337(Reservation Entry)by using a temporary T336 record, which is called by a procedure in codeunit 22. This procedure is triggered when codeunit 22 has finished its run because at that point, the codeunit 22 object contains the information. When the temporary T336 record is retrieved, Codeunits 80 (Sales-Post) and 90 (Purch-Post) create records in the Item Entry Relation table to link the created item ledger entries to the created shipment or receipt line. Codeunits 80 (Sales-Post) and 90 (Purch-Post) then converts the temporary T336 (Tracking Specification) records to real T336 (Tracking Specification) records that are related to the line in question. However, this conversion occurs only if the posted document line is not deleted, because it is only partially posted.
See also
Design Details: Item Tracking
Design Details: Item Tracking Design