get Automatically No. when import data with dataport

elTorito
Member Posts: 191
Hi,
what and where must i code if i like make a dataport that takes the last no. from one No. Serie and give this new No. the Data what i wan't import.
Thanks.
what and where must i code if i like make a dataport that takes the last no. from one No. Serie and give this new No. the Data what i wan't import.
Thanks.
(Oo)=*=(oO)
0
Comments
-
Start by defining a global variable 'NoSeriesMgt' referring to Codeunit 396. Then, in the OnAfterImportRecord trigger, use the following code (with suitable replacements -- "No." is the field to get the new number, 'XXXX' is the No. Series to use):
"No." := NoSeriesMgt.GetNextNo('XXXX',0D,FALSE);
The FALSE parameter is a trick to delay locking the No. Series Line table -- the NoSeriesMgt codeunit reads the No. Series Line record once on the first call, and then hands out the next number from the series for each subsequent call, but does NOT update the No. Series Line.
Therefore, to update the No. Series Line at the end of the Dataport, you have to code the following in the OnPostDataItem trigger:NoSeriesMgt.SaveNoSeries();
0 -
Hi,
Thanks you very much, i musted search i little in the 396 Codeunit because the Functions are Named different , but now it works.
regards
Petter(Oo)=*=(oO)0 -
I used this code to populate the document no when dataporting in a Gen Jrnl but it gives a new number for every line and will not post as it is out of balance.
Any suggestions to keep the same document number for every line in the journal.
Thanks
lodger0 -
You could get it once at the beggining of the dataport into a variable and use that var to give that same value to all the recs.
Or you need something else? :-k0 -
Didn't need anything else... that worked great!
Thanks Arhontis
lodger0
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