Import Quantity into item journal line table.


I am try to import the quantity of items using item journal line table and post the transaction, but I get the values like Gen. Prod Posting Group and Inventory Prod Posting Group from item table.

Insert into the item journal line table, but not insert into the item journal line table. I am using the item journal line table in data port. Is there any other way to import quantity of item?

Please give me some sample code

The are

Enabled SourceExpr StartPos Width

Yes “Journal Template Name” 0 0

Yes “Journal Batch Name” 0 0

Yes “Posting Date” 0 0

Yes “Entry Type” 0 0

Yes “Document No.” 0 0

Yes “Item No.” 0 0

Yes Description 0 0

Yes “Location Code” 0 0

Yes Quantity 0 0

Yes “Unit of Measure Code” 0 0

Yes “Unit Amount” 0 0

Yes “Unit Cost” 0 0

Yes “Applies-to Entry” 0 0

Yes Amount 0 0

Yes “Source Code” 0 0.

Sample Code

“Item Journal Line”.“Line No.” :=Lineno;

IF “Item No.” <> ‘’ THEN


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


“Item Journal Line”.VALIDATE(“Item No.”,ItemDesc.“No.”);

“Item Journal Line”.VALIDATE(“Gen. Prod. Posting Group”,ItemDesc.“Gen. Prod. Posting Group”);

“Item Journal Line”.VALIDATE(“Inventory Posting Group”,ItemDesc.“Inventory Posting Group”);




Lineno := Lineno + 10000;



Software Developer

Micro Direct Ltd


What is the problem?

Are you getting an error message or are the lines not created?

The lines are not created into item journal lines.

So it just creates a blank journal?

Are you sure you are picking the correct journal template name and batch name to view the lines, or are you looking directly at the table?

And on wich trigger do You throw the code?

OnBeforeImport or OnAfterImport?

I think this is done a number of ways [:D]

Try this:

Item Journal Line - OnPreDataItem()

JournalTemplateName := ‘ITEM’;
JournalBatchName := ‘OPEN’;
LineNo := 0;
PostingDate := TODAY;
DocumentNo := ‘Opening Stk’;

Item Journal Line - OnAfterImportRecord()

//Sets Line Number and checks it there are any unposted entires//
ItemJournalLine.SETRANGE(“Journal Template Name”, ‘ITEM’);
ItemJournalLine.SETRANGE(“Journal Batch Name”, ‘OPEN’);
IF ItemJournalLine.FIND(’-’) THEN
“Line No.” := (ItemJournalLine.COUNT + 1) * 10000
“Line No.” := 10000;

Then set all your variables in the same trigger and validate the fields you want to at the end:
VALIDATE(“Item No.”);

Journal Template Name = ITEM

Journal Batch Name = DEFAULT

Source Code = ITEMJNL

I am looking into the Navsion tables and SQL server Tables.

Item Journal Line - OnAfterImportRecord()

Just change the “open” to “default” define all your variables and away you go.

You do not need the fields to be in the import, you can ignore them and create them as instructed in the code.

I already change from “Open” to “Default” but still unable to insert into the item journal line table.

is any other way to design the data port.

thanks in advance


Then it will be to do with the structure of your data mapping to the fields you have created. However it maybe the global structure and the formatting of the data after this.

However if you are really getting nothing I would say it is failing completely so manually create a line and export the data and see what it looks like mapping this back to the import file.

The writing of dataports is very individual - there are many many ways to design a dataport. The one I have given you works for the file I used. However the only “wrong” way to design it is if it does not work - so you will need to go back to the data structure and the original design.

After import the date into item journal line

This error shows when post the transaction.

Microsoft Business Solutions-Navision

Posting Date is not within your range of allowed posting dates in Item Journal Line Journal Template Name=‘ITEM’,Journal Batch Name=‘DEFAULT’,Line No.=‘10000’.


Could you explain this


Check allowed Posting dates in General Ledger Setup and User Setup Card.

Posting Date Entry Type Item No Location code Quantity Unit Cost Source Code
20/06/2006 2 10222 1 2 93.13 ITEMJNL
20/06/2006 2 10247 1 10 102.6 ITEMJNL
20/06/2006 2 10248 1 10 9.99 ITEMJNL
20/06/2006 2 10759 1 10 14.99


This is the data port which is use to import into the item journal line table, it insert the record into the item journal line table, with out item no, location code and quantity.

my code

Item Journal Line - OnPreDataItem()
“Item Journal Line”.“Journal Template Name” := ‘ITEM’;
“Item Journal Line”.“Journal Batch Name” := ‘DEFAULT’;
“Item Journal Line”.“Document No.” := ‘Opening Stock’;

Item Journal Line - OnAfterImportRecord()
“Item Journal Line”.RESET;

“Item Journal Line”.SETRANGE(“Journal Template Name”,‘ITEM’);
“Item Journal Line”.SETRANGE(“Journal Batch Name”,‘DEFAULT’);
IF “Item Journal Line”.FIND(’-’) THEN
“Item Journal Line”.“Line No.”:= (“Item Journal Line”.COUNT+1) * 10000;
“Item Journal Line”.“Line No.”:=10000;

“Item Journal Line”.VALIDATE(“Item No.”);
“Item Journal Line”.VALIDATE(“Unit Cost”);
“Item Journal Line”.VALIDATE(“Inventory Posting Group”);
“Item Journal Line”.VALIDATE(“Gen. Prod. Posting Group”);
“Item Journal Line”.VALIDATE(Quantity);
“Item Journal Line”.VALIDATE(“Unit Amount”);
“Item Journal Line”.VALIDATE(Amount);


but dataport is not insert posting groups and item no as i mention above



I presume in the field layout you are bringing the fields directly into the dataport? Trying bringing the data into a variable and then assigning the field through the variable. In mine I was bringing in the item number directly as the first field, but validating everything else. I would guess it is something to do with the structure of the data, or the way it is being brought in as the line is being created.

Is it inserting anything into the journal? Why are some fields working and others not - you will need to have a look at it from this pespective.

Thanks but when i go to post the transction then show error message

Microsoft Business Solutions-Navision

The General Posting Setup does not exist. Identification fields and values:Gen. Bus. Posting Group=’’,Gen. Prod. Posting Group=‘PERIPHERAL’


Thanks in advance.


Thanks Thanks

When i try to post the transaction then error message comes.

Microsoft Business Solutions-Navision

The General Posting Setup does not exist. Identification fields and values: Gen. Bus. Posting Group=’’,Gen. Prod. Posting Group=‘PERIPHERAL’


could you explain how to solve it.

Thanks in advance


You need to set up a posting group in the matrix to handle the scenario where no customer/supplier is involved, so leave the General Bus. posting group blank and set the product posting groups and all accounts required appropriately.

Suggestion: You can eliminate a lot of code writing by setting the CallFieldValidate property on your Dataport fields. List the fields in the order they should be validated in.