Hi there.
I'm trying to make a small feature so want to talk with you guys...
In very beginning of every implementation of MBS Navision we got complains about how users cannot see what is going to be posted to gl on order/cr. memos, document postings.
So, idea is to make test posting but with full information on what account will be used with what amounts, just like real posting.
Few ideas are on the way:
1) to copy navision posting logic and make classical report (sounds complicated, isn't it?). benefits are that we will, in meantime, learn fully posting logic of nav.
2) to redirect, somehow, postings to gl to some temporary or new table. this sounds dangerous and hard to control, specially cause you have to know ALL tables that will be used in posting (all ledgers must be redirected too).
3) to control a transaction, actually to break posting transaction on very end. in that case nothing will be posted/changed and everything I have to do is to break transaction and write new data in g/l before break. Problems are number of transactions, what is end point, etc....
Any thoughts/ideas?
0
Answers
You can search for GenJnlLine in CU 80,90 and modify it to have a preview mode, where the journal lines are inserted in a temporary table, then you could run a report on that (the temp table can be given to the report by a function call of the report object that gets it as a parameter, the report can run on then Integer table filtered to temptable.COUNT). I did that for Post Inventory Costs to G/L and wasn't very hard.
Another option might be to look at the General and Inventory and other posting setup and "guess" what will be posted but I don't think that would be trustable.
Would not automating creating and posting a Credit Memo to the Invoice do instead? I mean these all are ugly hacks...
What about third solution?
As for the third... I don't really understand. You can't suspend a transaction and run a form before commiting, becase Navi will complain in a huge error message, if that's what you ask.
I thought just to break transaction at the end of posting and with some flags and changes in cu80/90 or lower, to write to a file accounts and values. I think that would be enough for "first solution". In that error (or breaking transaction point) I will inform, where he can see pre-posting report. Something like a simple two-step procedure.
Ofcourse, this is only idea and don't know even if it's doable.
This might help you.
http://www.mibuso.com/forum/viewtopic.php?t=11142&highlight=commit+single+instnace
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Ex. when posting an invoice, Navision gets the next invoice No. from the no. series, puts it in record of T36, saves it and then does a COMMIT. So if you later generate an ERROR, this value remains in the record in T36.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Hehhehhh
Now, on kriki's part. Hidden COMMITS could make me lot of trouble and that's why I'm asking for advice here at first place. What could be problems of transaction break (although, it is a quite normal procedure to break posting transactions. It happens all the time for numerous of reasons like, wrong posting setup,dimension requiremets on gls, etc etc).
I do now that it puts a value of next no. into T36 (Posting No., like Reservation of no. of posting cause it gets it before posting procedure).
Is that the only possible problem?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
You can delete the temp gl entry after the form is closed. Or modify the insert statement so that if it exists delete all records first.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I thought that temporary tables are included in transaction (and, records are deleted too upon rollback) but now I see that I was wrong.
So I did modifications and now I do have posting prediction except few commits that will happens anyway on errorenous postings of orders...
Now, I have more logicaly problem than it's Navision.
I made a small variable in SingleInstance that says "I'm doing a test posting so, break a transaction at the end".
Just before that error, I clear/reset that boolean flag. And, that works ok. But, if I run a test posting on a order that has setup errors, my posting procedure will be broken up before I clear the flag and that is the problem that causes breaking the next first regular posting transaction too.
I need an idea how to reset this var on posting errors?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I do set and reset that var in that function, that's not the problem.
- I set that var before i start salesPost codeunit
- I reset that var right before breaking transaction and showing form with results.
problem is that my transaction can be breaked before that and than my var stays setted so I must say to customer "manually reset var" but I want to avoid that cause they'll be confused or will forgot to do that.
Actualy, what was important that I can catch Error code from codeunit (it gives back status) and that add additional piece of code where I can reset vars.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Not fully but enough for me at this moment.
Btw, I aksed somewhere here about that [solved] thing. How can I edit thread name?
Just go to your first message in this thread and click the "Edit" button on the right.