Options

Automated Posting

jungleboyjungleboy Member Posts: 48
Hi,

Does anyone know how to customise Navision in order to make it auto posting for invoice.

The scenario is this. A customer of mine using a thrid party point of sals system and update into a staging table (temp table in SQL). We need to trigger the sales records and payment info to update into NAvision sales invoice header, invoice line and payment journal. After that the system should auto post the transaction into relevant ledgers.

Anyone has done this?

Thank you

Comments

  • Options
    kinekine Member Posts: 12,562
    You will need some Navision application server, and some error handling. It is not problem to create the process of preparation of the invoice and posting it, problem is how to solve warious errors during the preparation and posting process... I know, that many companies have some solution for that, may be that someone will say more...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    girish.joshigirish.joshi Member Posts: 407
    Has anyone done this? :mrgreen: jungleboy, I think we all do this several times a week!

    Kine is right, the main issue is handling errors.

    You'll need to know the basics about Navision's error handling, and you do that by searching the forums here.

    Finally, when writing an automated posting routine, you'll probably have to remember to write some code to bypass the internal commits in codeunit 80.
  • Options
    jungleboyjungleboy Member Posts: 48
    What about the data that being update by third party in SQL temparary able?How shd we create an automated insertion into NAvision table and subsequently being posted into ledger entries.


    Thanks
  • Options
    krikikriki Member, Moderator Posts: 9,096
    jungleboy wrote:
    What about the data that being update by third party in SQL temparary able?How shd we create an automated insertion into NAvision table and subsequently being posted into ledger entries.
    Create a singleinstance codeunit, add the Navision timer ('Navision Timer 1.0'.Timer with property WithEvents=Yes) in it. With this you can launch the process every N seconds/minutes...
    In the "OnRun" you enable the timer.
    IF ISCLEAR(autTimer) THEN BEGIN
      CREATE(autTimer);
      autTimer.Interval("Sleep During N Seconds" * 1000);
      autTimer.Enabled(TRUE)
    END;
    

    Then in function
    autTimer::Timer(Milliseconds : Integer)
    CheckSQLTempTable();
    

    In function "CheckSQLTempTable" you can check if some new records are available (do a LOCKTABLE, because you can read uncommited data with SQL). With these records you can create records in the Navision tables (using VALIDATE and other triggers) and then you can post them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Dennis_DecoeneDennis_Decoene Member Posts: 123
    Does this not cause navision to yell at you about records he cannot find or that another user has changed blah blah...? :-k

    How would you know the invoice number, so you can put it in a temp table to upload to the third party system? \:D/
  • Options
    bbrownbbrown Member Posts: 3,268
    Why not use NAS listening to a Message Queue? If you are writting to a temporary SQL table, how are you handling transaction integrity between the system? What happens if one of the system fails?
    There are no bugs - only undocumented features.
  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    I would like to share with you some info about what I am currently working lately for a customer and has to do with NAS and posting.

    I am building an interface with an application that creates records in a custom navision table and I have a NAS that reads that table, creates journal lines and dimensions and posts that journal to G/L, customers, Vendors and Cheques... The interface will be able to handle a few thousands of transactions per day (invoices, payments, cheques)...

    I have found that timer error routine in the NAS cu is very helpfull because for every problem that occurs it sends the error back...

    I have used two tables for the communication, one IN and one OUT.
    Whenever everything succeds I move the record I have processed from the IN table to the OUT table marked as valid, but if an error occurs then I move that rec in the OUT table with valid=false and putting the error message in a field there...

    One of the problems where the COFIRM executions in various places in Nav was called. Of course I used the IF GUIALLOWED THEN ...

    The 80% of the code in my cu is error checking of amounts, existance of customers/vendors, valid dimension values, e.t.c.

    It was rather paifull and difficult to implement, especialy the debugging (because of the NAS) but it is almost over... For the debugging I usually run the cu manualy from the object designer and my client works as a nas, (with user interface of course and shows me the dialogs) but it is the only way I can do a proper debugging...

    Just don't forget to make a large delay on the timer when debugging so that you don't enter a loop with the repeating of the cu calling with the timer lol... #-o
    Alot of times I had to "End Task" my nav client to be able to exit the debugger...

    I have also made a log table that reports whatever is going on and in addition counts the milliseconds that each operation takes to create and post. If some wants when I get proper statistics of journal posting with nas i will post them here...
  • Options
    TonyHTonyH Member Posts: 223
    Hi jungleboy,

    I've just done something similar. When the user creates a whse shipment it exports a text file that gets read by a seperate Freight program.

    When the shipment is value of the freight Cost/Price is returned to Navision added as a line to the original order and automatically posted.

    The posting routine was throwing up Window (Dialog Box) was one error that I had but the most annoying was the Dead Locking caused by the Document Dimension table. NAS had a problem where if it fell over due to deadlocking it could not recover itself. There is a hotfix for this.

    As for the Document Dimension deadlock issue, I went into the DimensionMgmt CU and for all the functions that delete dimenisions there was
    DocumentDimension.setrange("XYZ","XYZ");
    DocumentDimension.setrange("XYZ","XYZ");
    DocumentDimension.deleteall;
    

    It needed to be changed to
    DocumentDimension.setrange("XYZ","XYZ");
    DocumentDimension.setrange("XYZ","XYZ");
    If DocumentDimension.find('-') then
      DocumentDimension.deleteall;
    

    To ensure a correct lock.
    That solved the issue.

    So thats some of my experiences I hope they help out!


    I needed to chan
Sign In or Register to comment.