failure codeunit 21

kanika
Member Posts: 247
Hello experts!
I have a question about an error that I get often about the posting date; NAV 2009 SP1, spanish date format dd/mm/yy
Allow posting from: 01/05/16
Allow ponting to: 30/06/16
Purchase Invoice, posting date 09/05/16
that invoice is impossible to post because of this error
Codeunti 21
CheckAllowedPostingDate(ItemJnlLine : Record "Item Journal Line")
WITH ItemJnlLine DO BEGIN
:
:
IF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
Break on error FIELDERROR("Posting Date"
END;
I think it's a failure of NAV and I need to solve
thank you for your help!
I have a question about an error that I get often about the posting date; NAV 2009 SP1, spanish date format dd/mm/yy
Allow posting from: 01/05/16
Allow ponting to: 30/06/16
Purchase Invoice, posting date 09/05/16
that invoice is impossible to post because of this error
Codeunti 21
CheckAllowedPostingDate(ItemJnlLine : Record "Item Journal Line")
WITH ItemJnlLine DO BEGIN
:
:
IF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
Break on error FIELDERROR("Posting Date"
END;
I think it's a failure of NAV and I need to solve

0
Best Answer
-
Hello Experts!! sorry for the delay, I went on vacation without answer
I know what happens, there is a posted invoice dated 30/12/2016 (Spanish format) and when you try to register the new invoice, at some point (although "date order" is off for that series), checks that the date "Allow Ponting to " in user setup table is the 30/12/2016 and if not given the error.
So finally I have not changed anything in the code, just when invoices are posted with that series is changed in the table "user setup" field value "Allow Posting to" register to 30/12/2016 and leaves without problem.
Thanks everyone for your help.5
Answers
-
Hey Kanika,
You mean to say even if you have the Posting Date in the defined range you are getting this error as 'Posting date is not in the defined range'. The Only issue for this may be the Date format I believe.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
but in other documents with the same date no problem, it is only in the purchase invoices0 -
I changed the code
IF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
FIELDERROR("Posting Date",Text001)
for this other
dia := DATE2DMY("Posting Date",1);
mes := DATE2DMY("Posting Date",2);
anio := DATE2DMY("Posting Date",3);
diafrom:=DATE2DMY(AllowPostingFrom,1);
mesfrom:= DATE2DMY(AllowPostingFrom,2);
aniofrom:= DATE2DMY(AllowPostingFrom,3);
diato:=DATE2DMY(AllowPostingTo,1);
mesto:= DATE2DMY(AllowPostingTo,2);
anioto:= DATE2DMY(AllowPostingTo,3);
IF ((dia<diafrom) AND (mes<mesfrom) AND (anio<aniofrom)) OR ((dia>diato) AND (mes>mesto) AND (anio>anioto)) THEN
FIELDERROR("Posting Date",Text001);
and it works without problem the codeunit 21, but returns this error in the codeunit 11
RunCheck(GenJnlLine,JnlLineDim)
WITH GenJnlLine DO BEGIN
:
:
IF DateNotAllowed("Posting Date") THEN
break in error FIELDERROR("Posting Date",Text001);0 -
Check in the User Setup for the user who is trying to post the invoice and check if there are Allow posting dates are defined for that user,United Kingdom0
-
Hi,
Don't think it is a bug in NAV.
I see 2 options (but I don't know everything):
1) When I look at the code in NAV2009 CU21, I see it, looking up UserSetup and GLSetup.
Where UserSetup is leading if it has data. How is your UserSetup ?
2) A user is working in NAV on a computer with wrong country (date) settings.
Good luck.\\The truth exists in seven versions.1 -
Hello,
the User Setup and GLSetup have identical dates,
and that user can also post other documents with that date without problem.0 -
That is very strange ; never face any issues before maybe because I have not dealt with other languages NAV.United Kingdom0
-
I really think it's a bug, because when comparing day, month and year separately does not fail
I'll do the same with the CU110 -
Hi Kanika,
You are in danger here!IF ((dia<diafrom) AND (mes<mesfrom) AND (anio<aniofrom)) OR ((dia>diato) AND (mes>mesto) AND (anio>anioto)) THEN
is not the same asIF ("Posting Date" < AllowPostingFrom) OR ("Posting Date" > AllowPostingTo) THEN
diafrom = 1 (01/05/2016) then
for example: (dia<diafrom) is for you (day < 1) and that will never happen...\\The truth exists in seven versions.0 -
Very strange. Try changing the FIELDERROR message to a custom error message which shows you the posting date, the AllowFromDate and the AllowToDate - this should give you a bit more of a clue as to what's going on.0
-
Hello Experts!! sorry for the delay, I went on vacation without answer
I know what happens, there is a posted invoice dated 30/12/2016 (Spanish format) and when you try to register the new invoice, at some point (although "date order" is off for that series), checks that the date "Allow Ponting to " in user setup table is the 30/12/2016 and if not given the error.
So finally I have not changed anything in the code, just when invoices are posted with that series is changed in the table "user setup" field value "Allow Posting to" register to 30/12/2016 and leaves without problem.
Thanks everyone for your help.5 -
I think there is a wrong custom code somewere...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