Function Copy Document Error

Our NSC modify the Sales Line, Sales Cr. Memo Line and Sales Invoice Line by adding a field named “Customer PO Line Number” into those tables. Originally it was created as integer and later on it’s change as a Code datatype. The side effect of this modification is that we can’t use the Function Copy Document since then. Every time we run the function we got the following error: “Reference to the member Customer PO Line Number of the variable could not be solved”. The NSC was trying hard to fix this error and they believe there is nothing wrong with the coding. They said they will report this issue to Microsoft as a known issue. It’s questioning me, because it worked fine before. It’s an urgent function for us to run our daily operation. Hopefully I can find the answer from this forum and fix it asap. Thanks.

Have you/your NSC recompiled all involved objects, all that reference to this field? Any errors shown?

Yes and there is no error showing. When restoring the objetcs also there is no error.

Is this happening to only PRE-code change invoices you’re trying to copy? Can you copy document new docs? I was just thinking that the older invoiced do not have the “Po Doc #” field filled in with anything.

If you run the function with the Debugger, where is it “hitting the wall”?

Hi Panca, If the only change was the data type, then you’ll just need to recompile the copy document function. I believe the copy document functions are: Report 292 Codeunit 6620 For the report, just open it up in designer, type something in the documentation, then exit and save. For the codeunit, you might need to contact your NSC to recompile it for you. Hope this helps.

Panca, very clearly this is a code error, and you need to have your NSC fix it. Changing the type of a fields is definitely not recommended byt Navision, and if your NSC did this, they should be fully aware of the implications before doing so. The correct procedure would have been to create a new CODE field and then delete the old integer field. Dead Lizaard has indicated what needs to be done, but its your NSC that should be doing the fix.

The error comes for both situations: 1. From blank order and then run the function copy document from any older invoice. 2. Order that you enter all the fields manually (including the Customer PO Line No.) then run the function copy document from this posted sales invoice. We get the same error message. When I activate the debugger, the error break on the following coding: ======= IF FromSalesInvLine.Quantity > 0 THEN BEGIN ToSalesLine.“Customer PO Line No.” := romSalesInvLine.“Customer PO Line No.”; ToSalesLine.“No.” := FromSalesInvLine.“No.”; ToSalesLine.“Variant Code” := FromSalesInvLine.“Variant Code”; ToSalesLine.“Location Code” := FromSalesInvLine.“Location Code”; ToSalesLine.“Bin Code” := FromSalesInvLine.“Bin Code”; ToSalesLine.“Unit of Measure Code” := FromSalesInvLine.“Unit of Measure Code”; ToSalesLine.“Qty. per Unit of Measure” := FromSalesInvLine.“Qty. per Unit of Measure”; ToSalesLine.“Outstanding Quantity” := FromSalesInvLine.Quantity; CheckItemAvailable(ToSalesHeader,ToSalesLine); END; ======= Please

Two thumbs up for you guys! It works, I have fixed it without asking the NSC. It’s so relief after struggling for all of these months. Special thank you from me to all of you. Panca

Uhm … and what was actually the problem? What did you do to solve it?

The problem was as indicated by Mr Lizzard. Its a coding error, where the NSC changed the type of a field, but then did not go back tot he code and recompile.

Joerg, David is right. I fixed it base on Mr Lizard’s suggestion. Like the idom says “Some people solve complicated problems but ignorance the simple one…[:)]” Thx.

Awesome. Glad you resolved your issue. Keep on truckin. [8D]