How to carry value from a field in purchase order to item ledger entry

Need help

I added 3 field with same field id in purchase header, purch. inv. header, and item ledger entry.

The plans are to carry on value of this field from purchase header to purch. inv. header and item ledger entry when posted.

But it seems the value only carried to purch. inv. header not to item ledger entry. [:(]

You need to write code in Codeunit 22 - InitItemLedgEntry function…

please have a look

I’m confused. I’ve written a line of code under “WITH ItemJnlLine DO BEGIN” but when i posted a purchase order, value only transfered to posted shipment / invoice, and doesn’t appear on item ledger entry.

Can you show us the Code please?

ItemLedgEntryNo := ItemLedgEntryNo + 1;



ItemLedgEntry.“Entry No.” := ItemLedgEntryNo;

ItemLedgEntry.“Item No.” := “Item No.”;

ItemLedgEntry.“Posting Date” := “Posting Date”;

ItemLedgEntry.“Document Date” := “Document Date”;

ItemLedgEntry.“Entry Type” := “Entry Type”;

ItemLedgEntry.“Source No.” := “Source No.”;

ItemLedgEntry.“Document No.” := “Document No.”;

ItemLedgEntry.“Transfer Order No.” := “Transfer Order No.”;

ItemLedgEntry.“External Document No.” := “External Document No.”;

ItemLedgEntry.“External Document No2” := “External Document No2”;

ItemLedgEntry.IntDoc := IntDoc;

ItemLedgEntry.Description := Description;

ItemLedgEntry.“Location Code” := “Location Code”;

ItemLedgEntry.“Applies-to Entry” := “Applies-to Entry”;

ItemLedgEntry.“Source Type” := “Source Type”;

ItemLedgEntry.“Transaction Type” := “Transaction Type”;

ItemLedgEntry.“Transport Method” := “Transport Method”;

ItemLedgEntry.“Country Code” := “Country Code”;

ItemLedgEntry.“Entry/Exit Point” := “Entry/Exit Point”;

ItemLedgEntry.Area := Area;

ItemLedgEntry.“Transaction Specification” := “Transaction Specification”;

ItemLedgEntry.“Drop Shipment” := “Drop Shipment”;

ItemLedgEntry.“No. Series” := “Posting No. Series”;

{IF ItemLedgEntry.Description = Item.Description THEN

ItemLedgEntry.Description := ‘’;} //#1 SIS01.01

ItemLedgEntry.“Prod. Order No.” := “Prod. Order No.”;

ItemLedgEntry.“Prod. Order Line No.” := “Prod. Order Line No.”;

ItemLedgEntry.“Prod. Order Comp. Line No.” := “Prod. Order Comp. Line No.”;

ItemLedgEntry.“Variant Code” := “Variant Code”;

ItemLedgEntry.“Unit of Measure Code” := “Unit of Measure Code”;

ItemLedgEntry.“Qty. per Unit of Measure” := “Qty. per Unit of Measure”;

ItemLedgEntry.“Derived from Blanket Order” := “Derived from Blanket Order”;

ItemLedgEntry.“Cross-Reference No.” := “Cross-Reference No.”;

ItemLedgEntry.“Originally Ordered No.” := “Originally Ordered No.”;

ItemLedgEntry.“Originally Ordered Var. Code” := “Originally Ordered Var. Code”;

ItemLedgEntry.“Out-of-Stock Substitution” := “Out-of-Stock Substitution”;

ItemLedgEntry.“Item Category Code” := “Item Category Code”;

ItemLedgEntry.Nonstock := Nonstock;

ItemLedgEntry.“Purchasing Code” := “Purchasing Code”;

ItemLedgEntry.“Return Reason Code” := “Return Reason Code”;

ItemLedgEntry.“Product Group Code” := “Product Group Code”;

ItemLedgEntry.“Serial No.” := “Serial No.”;

ItemLedgEntry.“Lot No.” := “Lot No.”;

ItemLedgEntry.“Warranty Date” := “Warranty Date”;

ItemLedgEntry.“Expiration Date” := “Expiration Date”;

IF “Entry Type” IN

[“Entry Type”::Sale,

“Entry Type”::“Negative Adjmt.”,

“Entry Type”::Transfer,

“Entry Type”::Consumption]


ItemLedgEntry.Quantity := -Quantity;

ItemLedgEntry.“Invoiced Quantity” := -“Invoiced Quantity”;


ItemLedgEntry.Quantity := Quantity;

ItemLedgEntry.“Invoiced Quantity” := “Invoiced Quantity”;



the field that i’m talking about are External Document No2

I guess you have added External Document No2 field to Item Journal Line table.

You need to assign value to External Document No2 field of Item Journal Line table also in Codeunit 90 - PostItemJnlLine function

Hi Lenore,

Did you ever find a solution to your problem? If you did, would you mind sharing it with us and if any of the posted answers helped you on the way, then please verify them.

Thank you.