Tuesday, May 31, 2016

Automatic No. Series in Nav

Most People might Already know this but as my blog name itself States for Beginners . For those who really starters might be  found Difficult, So For Them i hope it will Help.

First Lets Say you need No series for some List Of Items ,customers etc.. So First and foremost is to have a table. For Me An Example Table for which you want to enter data.
Table Name ------ Example Table
Table ID      ------ 50006
Table Fields ------ As per your Requirement But we one No. Field for auto increment.

Like Below Image.

Now it's Time to add some Default No Series i.e Automaticaally Adding No. For that you have to add a Field in Setup table . Example for Customers,vendors and Items the default no series are Defined in SalesSetup table . So you can Use such Tables Or you can make a Setup table New For your own .

So for this Example let us Just Use an old Setup Table/Standard Setup Table .ie Sales & Receivables Setup table  Table No 311.

 Create a New Fields Like Below
And  Edit  Table Relation Property Of Example Nos to  No. Series Like Below

Now go to page 459 i.e Sales & Receivables Setup page And Add a new Field in Numbering Fast tab like Below


Now run the Page And Select a No Series Or Create New "No series" by Following Respective steps


And most Important donot forget to check default Nos check box



then it should Look Like below Image
Now Coming to Code To Create automatic Nos is Take Global variables in  Table 50006/Example Table

And 2 Function Like Below

Then Write Code In OnInsert() And On Validate of No. Field. Like Below

Then Coming to First Function write like
Then the Most Important "AssistEdit" Function Which takes Example Table as Parameter you can replace it with your Desired Table.


Return a Boolean Value for function

Take Local variable record /same table as taken in parameter in above step and Name it as Example TableL

Now write Code like Below



So Coding Part is Done Now lets go for Creating a Page i.e Card page Standard.
Goto Object Designer Select Page Menu Now Create  a New Page ---> Enter Table Id 50006 in and Choose Create a page using Wizard. And Click OK Button
And Select All Fields And Click Finish Then you will See Card page

 Now Select No And Press F9 or got to Code in on Assist edit write code which will update page with automatic numbering..

Now save the Page And Compile .

Directly Compiling with check box  may give Error So First Save it and then close the Page , Reopen Page And Compile ...
So done

It's Evaluation Time ......
Run the Page

Click New page And Click other Fields or Simply Press Tab 2 times
I Hope It Helps .Please Let Me Know if you got any Problem Regarding this Post .

No comments:

Post a Comment