Adjust Cost - Item Entries for one Item or all others

abartonicek
Member Posts: 162
We all know that this batch is very tricky so I wanted to modify it so I can run it for:
a) particular Item (infinite loop is killing me)
b) all Items except that one
With big help from "Guidelines for Loops in Adjust Cost Batch Job" document I solved a) case but I can't make b) case to work (or work properly)
I would appreciate some help. I searched the forum and I saw that somebody already done this...
a) particular Item (infinite loop is killing me)
b) all Items except that one
With big help from "Guidelines for Loops in Adjust Cost Batch Job" document I solved a) case but I can't make b) case to work (or work properly)

I would appreciate some help. I searched the forum and I saw that somebody already done this...
Better to be critical then self-critical 

0
Comments
-
-
For me the B is just negation of A... if you in A are using something like
SETRANGE("Item No.",'myitem');
than for B must workSETFILTER("Item No.",'<>%1','myitem');
0 -
I thought so too but....
For a) case "Guidelines for Loops in Adjust Cost Batch Job" document says:LOCAL PROCEDURE MakeSingleLevelAdjmt (CU5895) ... ItemLedgEntry.SETCURRENTKEY("Item No."); ItemLedgEntry.SETRANGE("Item No.",'70000’); //add line, filter on the item no. IF NOT ItemLedgEntry.FIND('-') THEN // that should be adjusted EXIT(FALSE); ... ItemLedgEntry.FIND('+'); ItemLedgEntry.SETRANGE("Item No."); // disable this line UNTIL (ItemLedgEntry.NEXT = 0) OR LevelExceeded
For b) case I thought I should uncomment the// ItemLedgEntry.SETRANGE("Item No.");
line but the batch worked as I didn't set any filter.
I tried with that line commented too, but the result was the same.Better to be critical then self-critical0 -
I forgot, DB is 3.60.Better to be critical then self-critical0
-
Try using a different filter group when you set your filter on item number.
LOCAL PROCEDURE MakeSingleLevelAdjmt (CU5895) ... ItemLedgEntry.SETCURRENTKEY("Item No."); ItemLedgEntry.FILTERGROUP(9); ItemLedgEntry.SETRANGE("Item No.",'70000’); //add line, filter on the item no. ItemLedgEntry.FILTERGROUP(0); IF NOT ItemLedgEntry.FIND('-') THEN // that should be adjusted EXIT(FALSE); ... ItemLedgEntry.FIND('+'); ItemLedgEntry.SETRANGE("Item No."); // DO NOT DISABLE THIS LINE UNTIL (ItemLedgEntry.NEXT = 0) OR LevelExceeded
0 -
Didn't help
All this is because infinite loop problem!
The thing is, when I set that "Item No." filter the Adjust Cost - ... batch runs only for that item and it runs forever (inf. loop problem).
When I try to use that <>Item No. filter ( b) case) to adjust all other items, the Adjust Cost - ... batch runs for a 0,5 sec and FIXES :?: the infinite loop problem so the Adjust Cost - ... batch for all Items runs normally (it takes some time)!!!
I don't know what happens in that b) case but I checked and it seems that no adjustments have been maid in that batch run :?:
The batch for all items adjusts all items except the one that created inf. loop problem :!:
I confused :-k
Any ideas?Better to be critical then self-critical0 -
It FIXES the problem because the table 5804 Average Cost Adjustment is empty after you finis the batch and new run of the batch has nothing to adjust... you need to recovery the record for your item in this table...
(but this is without warranty...)0 -
I forgot about that T5804 #-o . Thanks for heads-up!
Maybe stupid question but why is thatItemLedgEntry.SETRANGE("Item No.");
inLOCAL PROCEDURE MakeSingleLevelAdjmt (CU5895) ... ItemLedgEntry.SETCURRENTKEY("Item No."); ItemLedgEntry.FILTERGROUP(9); ItemLedgEntry.SETRANGE("Item No.",'70000’); //add line, filter on the item no. ItemLedgEntry.FILTERGROUP(0); IF NOT ItemLedgEntry.FIND('-') THEN // that should be adjusted EXIT(FALSE); ... ItemLedgEntry.FIND('+'); ItemLedgEntry.SETRANGE("Item No."); // DO NOT DISABLE THIS LINE UNTIL (ItemLedgEntry.NEXT = 0) OR LevelExceeded
there for and why is "MakeSingleLevelAdjmt" defined asMakeSingleLevelAdjmt() : Boolean
when that return value is never checked (or I'm I wrong?)?
I'm quite new to Navision and especially to Adjust Cost - Item Entries but there seems to be a lot of problems with that batch job!Better to be critical then self-critical0 -
Maybe stupid question but why is that
Code:
ItemLedgEntry.SETRANGE("Item No.");
(it is a small trick)
I hope that it'll help you... 8)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