code unit 80 (sales Post)

arindam
Member Posts: 176
Hi All,
I am having a problem on calling a Navision code unit. The senario:
I have a button called 'POST". My objective is that when user will click the post button his selected (selction of a Sales Order Header Id is done) of an Order or Invoice, will get posted.
I want to call the codeunit 80/81 from my code. How shall I call code unit 80 from my code ?
Thanks in advance. Please help.
Arindam
I am having a problem on calling a Navision code unit. The senario:
I have a button called 'POST". My objective is that when user will click the post button his selected (selction of a Sales Order Header Id is done) of an Order or Invoice, will get posted.
I want to call the codeunit 80/81 from my code. How shall I call code unit 80 from my code ?
Thanks in advance. Please help.
Arindam
0
Answers
-
Declare SalesPost has codeunit of type Sales-Post
In code
SalesPost.RUN(SalesHeader);
Other way around, in menu item define runobject has Codeunit Sales-Post0 -
or also :
CODEUNIT.RUN(CODEUNIT::"Sales-Post",SalesHeader);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you very much for your help. It solved my problem.
Now I want to know to post a Sales Order what code unit shall I use ? Also to post an Invoice what code unit shall I use ?
Once again thanks in advance.0 -
arindam wrote:Thank you very much for your help. It solved my problem.
Now I want to know to post a Sales Order what code unit shall I use ? Also to post an Invoice what code unit shall I use ?
Once again thanks in advance.
They all use the same codeunit as they are all the same table!Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
arindam wrote:Thank you very much for your help. It solved my problem.
Now I want to know to post a Sales Order what code unit shall I use ? Also to post an Invoice what code unit shall I use ?
Once again thanks in advance.
Don't get confused for the Document Type....as David said...its the same SALESHEADER.Diptish Naskar
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/0 -
Thanks Diptesh.
Now if i just want to post only 2 Order then how come I make the code unit understand that it should perform the posting task for these 2 Orders only ? say I marked 2 of the Orders.
I hope I am able to clear my point.
Arindam0 -
General tip:
If you want to automate anything in NAV that is available in the standard database, you turn on the debugger and see how it's done in standard NAV. Learn from that and apply that knowledge to your project.
So in this instance, you want to automate posting an invoice in a button. What you do is create an invoice, turn on the debugger, and post it. See what happens under the hood and program it in your button.0 -
-
Easiest way would probably be to check how the mass-posting reports work.0
-
Once again thanks for your tips.
Looping is happening perfectly. My code is :
Repeat
if mark then
CODEUNIT.RUN(CODEUNIT::"Sales-Post",recSalesOrderHead);
until (..)
recSalesOrderHead is the record object for Sales Header.
My problem is whenever i am passing this it is taking the fisrt record which is 'offer' in this case. I want to pass all the marked order to be posted.
Please help0 -
and where you have "reading" of the record? Something like recSalesOrderHead.GET, or recSalesOrderHead.FINDxxx etc...0
-
I am using
recSalesOrderHead.SETRANGE(recSalesOrderHead."No.","No.");
CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",recSalesOrderHead);
Here I am trying to set the sales order number i want to pass to the code unit.
But when I am nevigating the code unit in debug mode it is showing that no record is selected at the code unit level and throwing an error.
If I can pass my desired Sales Header "No." to the code unit then I think it will solve my problem. But I am not able to do that.
Please advice.0 -
Hi Arindam,
I was going through the posts..well what Kine said is right...LOOP will do. Try using find('-') or FINDFIRST after the setrange that you have applied.Diptish Naskar
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/0 -
Thanks Diptish and all who answers my query.
It solved. I use -
recSalesOrderHead.SETRANGE(recSalesOrderHead."No.","No.");
recSalesOrderHead.FIND('-');
CODEUNIT.RUN(CODEUNIT::"Sales-Post",recSalesOrderHead);
It is now passing the current record to the code unit.
Thank you guys. You solved this problem.
Regards,
Arindam0
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