Running a form

After running Issues Journal in NAV2009, it prompt "Item Journal Template already exits. Identification fields and values: Name=‘ISSUE’ and checked the code behind i dont know what to do. Please help me out.


Exactly how are you running this form? Directly via Object Designer or from the menu?

From the Object Designer

And its the same result if running it from the menu?

Then ry to run it with the Debugger and see where it stops. It looks to me like it’s trying to create a new template (ISSUE) that already exists. That’s not standard. So assuming some customization was done to this…

Its stop at Form - OnOpenForm() UpdateButtons

If this doesn’t help you - then that’s when you need a partner/developer who can.

Especially since it’s customized code, then you need a developer with access to your code. Without seeing your code, then it’s very difficult to help you more here.


Form - OnInit()
“Entry Type” := “Entry Type”::Issue;

Form - OnOpenForm()
ItemJnlMgt.TemplateSelection(FORM::“Issues Journal”,8,FALSE,Rec,JnlSelected);
IF NOT JnlSelected THEN

“Entry Type” := “Entry Type”::Issue;
DefaultFilterGroup := FILTERGROUP;
CurrentJnlTemplateName := GETFILTER(“Journal Template Name”);
FILTERGROUP := DefaultFilterGroup;

IF ItemJnlBatch.GET(CurrentJnlTemplateName,CurrentJnlBatchName) THEN;
“depart code” := ItemJnlBatch.“Global Dimension 1 Code”;
ReqNo := ItemJnlBatch.“Requisition No.”;
BatchDescription := ItemJnlBatch.Description;
AuthorisedBy := ItemJnlBatch.“Authorised By”;
//EPRExist := ItemJnlBatch.“EPR Created”;

Form - OnCloseForm()

Form - OnQueryCloseForm() : Boolean

Form - OnActivateForm()

Form - OnDeactivateForm()

Form - OnFindRecord(Which : Text[1024]) : Boolean

Form - OnNextRecord(Steps : Integer) : Integer

Form - OnAfterGetRecord()
IF CurrentJnlTemplateName = ‘’ THEN
CurrentJnlTemplateName := “Journal Template Name”;

Form - OnAfterGetCurrRecord()
ItemJnlMgt.GetItem(“Item No.”,ItemDescription);

IF “Item No.” <> ‘’ THEN BEGIN
ItemRec.GET(“Item No.”);
ItemRec.SETRANGE(ItemRec.“Variant Filter”,“Variant Code”);
ItemRec.CALCFIELDS(ItemRec.Inventory,ItemRec.“Qty. on Purch. Order”,ItemRec.“Qty. On Request”);
QtyInStock := ItemRec.Inventory;
QtyOnRequest := ItemRec.“Qty. On Request”;
QtyOnPurchOrder := ItemRec.“Qty. on Purch. Order”;

// 30 days usage
ItemRec.SETRANGE(ItemRec.“Variant Filter”,“Variant Code”);
ItemRec.SETRANGE(ItemRec.“Date Filter”,CALCDATE(’-1M’,TODAY),TODAY);
ItemRec.CALCFIELDS(ItemRec.“Issue Qty”,ItemRec.“Return Qty”);
Usage30Days := ItemRec.“Issue Qty” - ItemRec.“Return Qty”;

// 180 days usage
ItemRec.SETRANGE(ItemRec.“Variant Filter”,“Variant Code”);
ItemRec.SETRANGE(ItemRec.“Date Filter”,CALCDATE(’-2Q’,TODAY),TODAY);
ItemRec.CALCFIELDS(ItemRec.“Issue Qty”,ItemRec.“Return Qty”);
Usage180Days := ItemRec.“Issue Qty” - ItemRec.“Return Qty”;

// 360 days usage
ItemRec.SETRANGE(ItemRec.“Variant Filter”,“Variant Code”);
ItemRec.SETRANGE(ItemRec.“Date Filter”,CALCDATE(’-1Y’,TODAY),TODAY);
ItemRec.CALCFIELDS(ItemRec.“Issue Qty”,ItemRec.“Return Qty”);
Usage360Days := ItemRec.“Issue Qty” - ItemRec.“Return Qty”;

QtyInStock := 0;
QtyOnRequest := 0;
QtyOnPurchOrder := 0;
Usage30Days := 0;
Usage180Days := 0;
Usage360Days := 0;

Form - OnBeforePutRecord()
//IF “Item No.” <> ‘’ THEN
// “Department Code” := “depart code”;

Form - OnNewRecord(BelowxRec : Boolean)
“Document No.” := xRec.“Document No.”;
//Documenttype := xRec.Documenttype;

Form - OnInsertRecord(BelowxRec : Boolean) : Boolean
CummTot := CummTot + Amount;

Form - OnModifyRecord() : Boolean
CummTot := CummTot + (Amount - xRec.Amount);

Form - OnDeleteRecord() : Boolean

Form - OnTimer()

Form - OnCreateHyperlink(VAR URL : Text[1024])

Form - OnHyperlink(URL : Text[1024])

Delete After posting(oldbatchRec : Record “Item Journal Batch”) deletebatch : Boolean
ItemJnlLine.SETRANGE(ItemJnlLine.“Journal Template Name”,oldbatchRec.“Journal Template Name”);
ItemJnlLine.SETRANGE(ItemJnlLine.“Journal Batch Name”,oldbatchRec.Name);
IF ItemJnlLine.FIND(’-’) THEN
IF ItemJnlLine.COUNT = 1 THEN
IF ItemJnlLine.“Item No.” = ‘’ THEN
deletebatch := TRUE
deletebatch := FALSE;

//ItemJnlLine.SETRANGE(ItemJnlLine.“Journal Template Name”);
//ItemJnlLine.SETRANGE(ItemJnlLine.“Journal Batch Name”);

The error is not in this object. You said it happened on the UpdateButtons call, which is not in the text you show.
But that comes from hard coding anything into NAV (ISSUE), a very bad development practice. Looking at the code does help much. It might even just be a problem in the ZUP-file (being a classic version), that it just “remembers” a filter set previously by the user.

But as I said, contact a developer regarding this, much better for you. He/she could most likely solve it in a few minutes, once online on your system.

First try to remove the ZUP file and try again. It may work…

how can i remove ZUP file

You have to run the Worksheet form from application as it validates template name as selected by user