Hello ,
i wanna import a file <toto.txt> in <Gen. Journal Line> table before posting the whole data to the Ledger table.
for that i create a dataport including the following triggers :
OnPredataItem
LOCKTABLE;
SETRANGE("Journal Template Name",'VENTES');
SETRANGE("Journal Batch Name",'DEFAUT');
IF FIND('+') THEN
NextLineNo := "Line No." + 10000
ELSE
NextLineNo := 10000;
OnBeforeImportRecord
INIT;
"Journal Template Name":='Sales' ;
"Journal Batch Name" :='DEFAUT' ;
"Account Type":="Account Type"::Customer ;
"Document Type":="Document Type"::Invoice ;
OnAfterImportRecord
VALIDATE("Document Type") ;
VALIDATE("Account No.") ;
VALIDATE("Posting Group");
"Line No." := NextLineNo;
NextLineNo:=NextLineNo+10000 ;
here is a sample file that i wanna to import
31669966 Meersen Meubelen 83209187 06/01/99 07/01/99 127.5 Widgets 44100
This dataport work fine with no bug but when i open <Gen. Journal Line> table, i find it empty.
what is wrong with my Dataport????!!
Thank in advance.
Navision
0
Comments
In English we use: Journal Template Name="GENERAL", Journal Batch Name = "DEFAULT".
Maybe you have missed the L in DEFAULT?
Go to General Ledger, General Journals, choose the DEFAUT batch (or you can create it if it does not exist). Then create a blank row and zoom on the record (Ctrl + F8), look at the value of the two fields mentioned above.
My guess is that the data is there if you look in the table, but the template or batch might not exist.
Regards,
gus
First of all thank you for your advices.
effectively the "Journal Template Name" contains "ventes" as a value and "Journal Batch Name" the contain 'DEFAUT' as a value.
but the problem persist.
Really i dont know what to do????!!
Any other advice!
:roll:
Thank you
So even after looking at the table itself, you do not see any records?
:P In my opinion, any manual placed code deactivates automatic actions by Navision, so: If you want to import, tell him: Your last statement should be INSERT;
Will it work now?
Regards
Michael
It is working fine now
I inserted the follwing code in
OnAfterImportRecord (trigger)
// INIT;
"Journal Template Name":='VENTES' ;
"Journal Batch Name" :='IMPORT' ;
"Account Type":="Account Type"::Customer ;
"Document Type":="Document Type"::Invoice ;
VALIDATE("Document Type") ;
VALIDATE("Account No.") ;
VALIDATE("Posting Group");
"Line No." := NextLineNo;
NextLineNo:=NextLineNo+10000 ;
But Why OnAfterImportRecord trigger and not using the init instruction?!!!
All the documentation and the examlpe given in the documentation said that i ve to put the code on OnBeforeImportRecord and i should use the init to initialize the records.
Can you please explain me more????!!!
Thank you very much!!!