Bulk Creation of Sales Invoices - Design Concept

doddwell
Member Posts: 65
Hello
We are upgrading from NAV2009 to NAV2016 and taking the opportunity to tidy a few thinks up. Current Setup:
1 - We take Orders from our customers using an external system and these orders are saved to bespoke tables in NAV (not standard Sales Order Tables!)
2 - We send the orders to a single distributor via EDI
3 - Distributor delivers the goods
4 - Distributor sends us a daily EDI file containing 'delivered' data.
5 - We import the EDI file and this creates "Staging Documents" that are matched to the Sales Orders in step 1
6 - The "Staging Documents" are posted to create a batch of Sales Invoices
7 - Sales Invoice batch is Posted
The Staging Documents are comprised of:
Header Table, Line Table, Dimension Table
For the Staging process, do I still need the Dimension Table or should I add a Dimension Set ID field to the Line Table records instead?
Currently, step 6 is quite complicated and I am struggling to debug it. If I were to start step 6 again, what would be the best approach to create the Sales Invoices?
Many thanks
We are upgrading from NAV2009 to NAV2016 and taking the opportunity to tidy a few thinks up. Current Setup:
1 - We take Orders from our customers using an external system and these orders are saved to bespoke tables in NAV (not standard Sales Order Tables!)
2 - We send the orders to a single distributor via EDI
3 - Distributor delivers the goods
4 - Distributor sends us a daily EDI file containing 'delivered' data.
5 - We import the EDI file and this creates "Staging Documents" that are matched to the Sales Orders in step 1
6 - The "Staging Documents" are posted to create a batch of Sales Invoices
7 - Sales Invoice batch is Posted
The Staging Documents are comprised of:
Header Table, Line Table, Dimension Table
For the Staging process, do I still need the Dimension Table or should I add a Dimension Set ID field to the Line Table records instead?
Currently, step 6 is quite complicated and I am struggling to debug it. If I were to start step 6 again, what would be the best approach to create the Sales Invoices?
Many thanks
0
Best Answer
-
Re staging tables you do not need a the Dimension Table anymore, just add "Dimension Set ID" as you have stated above.
Re step 6 - what is the problem exactly? I would do the following...
1) Have a codeunit "Post Staging Document" - this will post 1 staging document - you pass the Header Table in the OnRun trigger
2) Have a codeunit "Batch Post Staging Documents" - this will loop through the Staging Document Headers and call the "Post Staging Document" codeunit for each one. I would do this in a loop and include error handling, something like...IF HeaderTable.FINDSET(TRUE) THEN REPEAT CLEARLASTERROR; CLEAR(PostStagingDocument); IF PostStagingDocument.RUN(HeaderTable) THEN HeaderTable.DELETE ELSE BEGIN HeaderTable."Posting Error" := GETLASTERRORTEXT; HeaderTable.MODIFY; END; UNTIL HeaderTable.NEXT = 0;
5
Answers
-
Re staging tables you do not need a the Dimension Table anymore, just add "Dimension Set ID" as you have stated above.
Re step 6 - what is the problem exactly? I would do the following...
1) Have a codeunit "Post Staging Document" - this will post 1 staging document - you pass the Header Table in the OnRun trigger
2) Have a codeunit "Batch Post Staging Documents" - this will loop through the Staging Document Headers and call the "Post Staging Document" codeunit for each one. I would do this in a loop and include error handling, something like...IF HeaderTable.FINDSET(TRUE) THEN REPEAT CLEARLASTERROR; CLEAR(PostStagingDocument); IF PostStagingDocument.RUN(HeaderTable) THEN HeaderTable.DELETE ELSE BEGIN HeaderTable."Posting Error" := GETLASTERRORTEXT; HeaderTable.MODIFY; END; UNTIL HeaderTable.NEXT = 0;
5 -
Hello Kishor. Thanks for the advice thus far. I am looking for guidance on the broad steps that the PostStagingDocument Code Unit would perform to 'translate' the staging document into a Sales Invoice.
I was expecting the existing process would JUST populate the Sales Invoice Header & Line tables with the staging data. However, it's also creating General Journal Lines. Any ideas as to why it would be creating General Journal Lines?
Thanks0 -
When posting invoices the system also posts to the general ledger - this is normal and should happen. If this didn't happen then you G/L control accounts (Inventory, debtors, VAT, etc...) not be correct - you also want to post to the customer Ledger entries and this happens when posting to the general ledger.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions