problem in Data Conversion – Lab 6 of solution developement

SimoGsiSimoGsi Member Posts: 23
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

Comments

  • g_dreyerg_dreyer Member Posts: 123
    Make sure you have a Journal Batch Name called "Defaut". I guess your template is based on your language?

    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
  • SimoGsiSimoGsi Member Posts: 23
    Hello all,
    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
    Navision
  • g_dreyerg_dreyer Member Posts: 123
    Since you are doing an init, you might need to do an insert.

    So even after looking at the table itself, you do not see any records?
  • Michael_SprungMichael_Sprung Member Posts: 6
    :( First of all, I think you use the wrong trigger; try to place your code in OnAfterImportRecord.

    :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
  • SimoGsiSimoGsi Member Posts: 23
    Thank you for advice,

    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!!!
    :D
    Navision
Sign In or Register to comment.