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.
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);
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=2]2 - Add The Same Field with Same Field Number in the Sales invoice Header Table 112[/list]
[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]
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
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).
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)
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
// 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...!!!
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...
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
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...
that's okay... because we don't use batch posting report
but how to execute it without press preview button in that report again...
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...
that's okay... because we don't use batch posting report
but how to execute it without press preview button in that report again...
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)
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
-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?
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
-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...
not only you, but all the developers that will come after you!and also poor your customer!
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!
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
not only you, but all the developers that will come after you!and also poor your customer!
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!
no...
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....
-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?
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
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.
that's okay... because we don't use batch posting report
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.
If you ignore this, at some point, technical and/or legal adversities will overtake you.
Comments
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....
is that better?
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?
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 file
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 Option 2
1 - Add a bit field to the Sale Header Table And Name it Text Exported Table 36
[list=2]2 - Add The Same Field with Same Field Number in the Sales invoice Header Table 112[/list][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 help
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)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
OnPush trigger itself you can try this one....
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...!!!
Kashyap
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thats absolutely true, but this is what he was asking for...!!!
He wants to place it on form 43...!!!!
Kashyap
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
so how I execute that after posting, without using button "preview" anymore
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
i'm sorry .. come again?
i don't understand
sorry
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...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
but how to execute it without press preview button in that report again...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
but i want to call it from sales invoice
after posted and the execute this code
-use functions SETTABLEVIEW, and USEREQUESTFORM
but why don't ask a senior developer?it would be faster than chatting in mibuso, isn't it?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
settableview??
how to use that?
hehe i work alone
dont have senior developer
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!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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....
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
but it still show the preview button
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
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 & Export
http://www.BiloBeauty.com
http://www.autismspeaks.org
Andwian
If you ignore this, at some point, technical and/or legal adversities will overtake you.