Very odd posting error (ship and invoice a sales order)

dleroux
Member Posts: 87
We have a customer using nav 4/SQL who is getting a very odd posting error under fairly specific circumstances.
The error is:
This involves posting a sales order for an inventory item with item tracking and the serial numbers have been assigned already. They did not throw the error about serial numbers being required.
Now custom code is involved(pasted below), but the custom code does not reference the reservation entry table. I thnik that my problem is occuring because I am calling the posting codeunit from C/AL code rather than the magical way base Navision calls it via property settings on the menu item. I would like to think that Navision is setting a property or otherwise initializing something that I am unaware of.
BUT, the customer does not get the error when the invoice is posted from a superuser account, only from a "peon" account. This is the thing which just blows my mind.
Can anyone provide any insight?
thanks
=====================================
The error is:
The Reservation Entry already exists
This involves posting a sales order for an inventory item with item tracking and the serial numbers have been assigned already. They did not throw the error about serial numbers being required.
Now custom code is involved(pasted below), but the custom code does not reference the reservation entry table. I thnik that my problem is occuring because I am calling the posting codeunit from C/AL code rather than the magical way base Navision calls it via property settings on the menu item. I would like to think that Navision is setting a property or otherwise initializing something that I am unaware of.
BUT, the customer does not get the error when the invoice is posted from a superuser account, only from a "peon" account. This is the thing which just blows my mind.
Can anyone provide any insight?
thanks
=====================================
// mod to add qty validation before posting AllowToPost := TRUE; txtConfirmQty :=''; KTICOde := ''; TmpDetail.INIT; //tmpdetail is record var for Sales Line TmpDetail.SETFILTER("Document Type", 'Order'); TmpDetail.SETFILTER("Document No.", Rec."No."); TmpDetail.SETFILTER(Type, 'Item'); IF TmpDetail.FIND('-') THEN REPEAT IF NOT TmpDetail.Nonstock THEN BEGIN ItemLedger.INIT; // record var for Item Ledger Entry ItemLedger.SETCURRENTKEY("Item No."); ItemLedger.SETRANGE("Item No.", TmpDetail."No."); ItemLedger.SETRANGE(ItemLedger."Location Code", TmpDetail."Location Code"); ItemLedger.CALCSUMS(Quantity); QtyAtLoc := ItemLedger.Quantity; IF QtyAtLoc < TmpDetail."Qty. to Ship" THEN BEGIN IF STRLEN(txtConfirmQty) < 180 THEN BEGIN txtConfirmQty := txtConfirmQty + 'Item No. ' + FORMAT(TmpDetail."No.", 20); txtConfirmQty := txtConfirmQty + ' qty to ship = ' + FORMAT(TmpDetail."Qty. to Ship",7); txtConfirmQty := txtConfirmQty + ' qty-on-hand = ' + FORMAT(QtyAtLoc,8) + '\'; END ELSE txtConfirmQty := txtConfirmQty + '*\'; END; END; UNTIL TmpDetail.NEXT = 0; IF txtConfirmQty <> '' THEN BEGIN txtConfirmQty := txtConfirmQty + '\ Post Anyways?'; AllowToPost := CONFIRM(txtConfirmQty, TRUE); IF AllowToPost THEN BEGIN GetPassCode.OPEN('Enter code to force posting #1#', KTICode); GetPassCode.INPUT(1,KTICOde); GetPassCode.CLOSE; IF KTICode <> 'KTI' THEN AllowToPost := FALSE; END ; END; IF AllowToPost THEN PostYN.RUN(Rec) ELSE CurrForm.UPDATE(FALSE);
0
Comments
-
That is a realy odd bug. Try to comment out all your code and see if you still get the error. Second compare the peon permission and see what tables he doesn't have access to, and any codeunits is trying to access those tables. Normally the user should have indirect access to those tables, and the codeunit should have access to those tables.
The error about reservation, is that a temporary table or actual table?
Set a break point on the error and try to post with super user and see if it tries to insert in the same code and if there is any if statements and what is different in there etc.
That's how I would attack this problem.
Also check out SP1 for 4.0 and see if you can reproduce the error.0 -
0
-
Since i can not duplicate the problem (using their license file and user account settings) I am forced to using slower methods.
I have tried ara3n's suggestion. They still get the error even though the trigger contains only the call to run the posting codeunit (no other processing at all). The good new is that they were able to get the error on a superuser account too, so I no longer need to cue the Twilight Zone theme when dealing with them
kine, where do I enter that code? somehwere in SQL Enterprise Manager?
Thanks to both of you.0 -
Yes, you must run the code in SQL query analyzer for example... (you must run it in your Navision database on SQL server...)0
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