how to execute Report Automatically (After posting Inv)
bangswit
Member Posts: 265
hi all.... i have create Report 50001
so... how to execute it automatically after i post Sales Invoice to be Posted Sales Invoiced?
thanks
so... how to execute it automatically after i post Sales Invoice to be Posted Sales Invoiced?
thanks
0
Comments
-
Hi,
The post process is happening in code unit 80, 81, 82 depends on the usage scenario ( if you elaborate more , I might could help you more).
But from my past experience you really don't want to add any more logic or transaction on posting process, try to refine the business process. I'm sure you can do it without going through modifying those units.
RegardsRani Shoura0 -
RaniShoura wrote:Hi,
The post process is happening in code unit 80, 81, 82 depends on the usage scenario ( if you elaborate more , I might could help you more).
But from my past experience you really don't want to add any more logic or transaction on posting process, try to refine the business process. I'm sure you can do it without going through modifying those units.
Regards
or maybe we can add in form 43 ??
add some code here....<Control71> - OnPush() IF ApprovalMgt.PrePostApprovalCheck(Rec,PurchaseHeader) THEN CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",Rec);
is that better?0 -
bangswit wrote:or maybe we can add in form 43 ??
add some code here....
This depends if he is using only invoice form to post invoice (While you know you can post an invoice from a sales order)....
And I would never recommend any customization from Forms, migration and control is usually hell from thereRani Shoura0 -
RaniShoura wrote:bangswit wrote:or maybe we can add in form 43 ??
add some code here....
This depends if he is using only invoice form to post invoice (While you know you can post an invoice from a sales order)....
And I would never recommend any customization from Forms, migration and control is usually hell from there
owww... i see
so what do you suggest for me?0 -
What is the use case??Rani Shoura0
-
RaniShoura wrote:What is the use case??
i want... after posting from sales invoice to be posted sales invoiced
it execute codeunit no 50001 that I already made
for export data to be txt file0 -
Option 1
Please note that this option is not recommended at least by me \:D/
OK here is where you have to put it in a code unit
In Code unit 80 - Procedure On run At the bottom of the procedure// Your code must go here , but you have to check if Invoice=True UpdateAnalysisView.UpdateAll(0,TRUE); UpdateItemAnalysisView.UpdateAll(0,TRUE); Rec := SalesHeader;
Option 2-
1 - Add a bit field to the Sale Header Table And Name it Text Exported Table 36
[list=3]3 - Have a batch job (Job Queue) that will do what ever you want on the basis of the table 112[/list]
[list=4]4 - Once your changes are done reset the bit switch[/list]
Hope this will helpRani Shoura0 -
Not recommened by me, too: you should create the file after the transaction is committed (thus, AFTER the codeunit have been succesfully completed). It's not a safe to add external processing (like creating a text file) during the posting routine...it can cause problems during posting, and you also make the transaction longer (thus increasing the possibility of locks).RaniShoura wrote:Option 1
Please note that this option is not recommended at least by me \:D/
OK here is where you have to put it in a code unit
In Code unit 80 - Procedure On run At the bottom of the procedure// Your code must go here , but you have to check if Invoice=True UpdateAnalysisView.UpdateAll(0,TRUE); UpdateItemAnalysisView.UpdateAll(0,TRUE); Rec := SalesHeader;
Option 2
i would go for a separate process that allows you to filter posted sales invoices and create a text file for each of them (something like RaniShoura's second option)0 -
I am not sure but try this one....
OnPush trigger itself you can try this one....// Add one line here globalvar (code 10/20) := rec."No."; // Standard coding..!! if approval.... then codeunit.run(80,rec); // Add lines here....!! SalesInvHeader.RESET; // SalesInvHeader is Sales Invoice Header table SalesInvHeader.SETRANGE("Pre-Assigned No.",globalvar); // the globalvar that you have assigned at start of OnPush Trigger Codeunit.run(YourCodeUnitId,SalesInvHeader); clear(globalvar);
I believe this will run after ending the write transaction.... so there wont be any locking proble....
Try atleast...!!! its better not to touch CU 80...!!!Thanks,
Kashyap0 -
I have 1 report for generate from table to be txt file
so how I execute that after posting, without using button "preview" anymore0 -
if you need to run the report after the click of the post button, it's "ok" (let's say that's the easiest solution to do)...Belias wrote:But remember that you can post the invoice from other places other than the post button0
-
-
You can call the report in the post button, just after running in the posting routine.
but if you post the invoice by not clicking the button (for example, the batch posting report), your code won't be run, and your file not generated...0 -
that's okay... because we don't use batch posting reportBelias wrote:You can call the report in the post button, just after running in the posting routine.
but if you post the invoice by not clicking the button (for example, the batch posting report), your code won't be run, and your file not generated...
but how to execute it without press preview button in that report again...0 -
it all depends from how do you call the report...just post your code here. Try with function USEREQUESTFORM (or something similar, i don't remember the exact name, search the online help)bangswit wrote:
that's okay... because we don't use batch posting reportBelias wrote:You can call the report in the post button, just after running in the posting routine.
but if you post the invoice by not clicking the button (for example, the batch posting report), your code won't be run, and your file not generated...
but how to execute it without press preview button in that report again...0 -
from posted sales invoiced i create code like this
CurrForm.SETSELECTIONFILTER(SalesInvHeader); REPORT.RUN(50092,TRUE,FALSE,SalesInvHeader);
but i want to call it from sales invoice
after posted and the execute this code0 -
Belias wrote:-use a report variable instead of "REPORT.RUN"
-use functions SETTABLEVIEW, and USEREQUESTFORM
but why don't ask a senior developer?it would be faster than chatting in mibuso, isn't it?
settableview??
how to use that?
hehe i work alone
dont have senior developer
poor me...0 -
not only you, but all the developers that will come after you!and also poor your customer!bangswit wrote:poor me...
if you don't know these basic instructions (or worse, you don't even know how to find by yourself the way to understand them -> don't you know how to press f1?!?! :?) you should study before implementing NAV. All of us did it, there are no shortcuts!0 -
no...Belias wrote:
not only you, but all the developers that will come after you!and also poor your customer!bangswit wrote:poor me...
if you don't know these basic instructions (or worse, you don't even know how to find by yourself the way to understand them -> don't you know how to press f1?!?! :?) you should study before implementing NAV. All of us did it, there are no shortcuts!
i already get the code
i already get the code using settableview also
and you ask my code
i just don't know where should i put it
because, as i know... it's recommended that i don't changet the sales post code unit
so i'm asking here....0 -
ok, i give up...take it easy, but i'm a bit tired of quoting myself...Belias wrote:-use a report variable instead of "REPORT.RUN"
-use functions SETTABLEVIEW, and USEREQUESTFORM
but why don't ask a senior developer?it would be faster than chatting in mibuso, isn't it?0 -
When posting you should have an option to
1.Post
2.Post & Print
Just follow the same logic as post & print.
Follow the code & see how it's done.
Looks like someones looking for a 3rd option
3.Post & Export0 -
Or a completely different solution, don't do it on the posted invoiced at all. Add a field to the posted invoice table that is just a simple "Data Exported" = true/flase Modify your codeunit a little to have it look at the posted invoice table, and look for posted invoices that haven't been exported yet, and run on those, then updated the field to true. set it to run in the job scheduler or on a timer or some other way, and the standard posting routine doesn't need to be changed, much easier if you ever what to upgrade down the road, or if you decide you want to use batch posting etc. Just an idea, but I try to always look at leaving Navision code standard, since I am an end user, and want to try to make upgrades as easy as possible.0
-
Don't do this! Never ignore NAV standard functionality, just because you don't use it at the moment, unless effort and expense is high and the customer demands it (in written form). Even then you should add code to disable "unused" features you did exclude from your customisation, or at least warn the user that something will go wrong if he uses that feature without further customistion.bangswit wrote:that's okay... because we don't use batch posting report
If you ignore this, at some point, technical and/or legal adversities will overtake you.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

