Options

Adjust Item-Cost batch

AJSAJS Member Posts: 12
Hi All,

We have a client database, which is running on SQL server, Adjust Item-Cost batch has never been run on the database. Now they want to have the Inventory Valuation, but when we have run the Adjust Item-Cost batch , it is very-very slow.

Please provide some insight , how we can speed up the process. Can we apply some filters , (we might have to change some coding)

Following are the Observations of the Database

Server Configuration
Xeon Processer : 2.8 Mhz
Ram : 2 GB RAM
Hard Disk : 270 GB
Free Space : 26 GB
No users are connected to server while the Batch Job is run.


Navision Version : NAVW13.70.00.09
Database : Sql Server
Database Size : 26GB
Last ILE Entry No : 1453979
Last Value Entry No : 1456696


Setup
Inventry Cost Posting
Automatic : True
Expecterd : False


Adjust Item-Cost batch has never been run on the database.
There are few items where the system is taking more then 1 day to process.
Databse is having transactions of more then 1.5 years.


Queries

1. Is there any way we can run the batch job Item/Date wise?
2. How to reduce the time of batch job?


Thanks,
AJS

Comments

  • Options
    bthorbthor Member Posts: 16
    1. Add a ItemFilter variable to report 795.
    2. Add new funtion to codeunit 5895 SetItemFilter(ItemFilter : Text[80])
    3. Call the new funtion from report 795 before the line InvtAdjmt.MakeMultiLevelAdjmt;
    4. Change the code in codeunit 5895 as follow
    MakeSingleLevelAdjmt() : Boolean
    LevelNo[1] := LevelNo[1] + 1;
    Window.UPDATE(1,LevelNo[1]);
    
    ItemLedgEntry.SETCURRENTKEY("Item No.");
    
    // change
    IF ItemFilter <> '' THEN
      ItemLedgEntry.SETFILTER("Item No.",'%1',ItemFilter);
    // change
    
    IF NOT ItemLedgEntry.FIND('-') THEN
      EXIT(FALSE);
    
    REPEAT
      Window.UPDATE(2,ItemLedgEntry."Item No.");
      ItemLedgEntry.SETRANGE("Item No.",ItemLedgEntry."Item No.");
    
      GetCostingMethod(Item,ItemLedgEntry."Item No.",CostingMethod);
      IF CostingMethod = CostingMethod::Average THEN BEGIN
        AdjustCostApplied(ItemLedgEntry."Item No.",TRUE);
        // Restart adjustment, if too many recursions
        WHILE LevelExceeded DO BEGIN
          LevelExceeded := FALSE;
          AdjustCostApplied(ItemLedgEntry."Item No.",TRUE);
        END;
        AdjustAverage(ItemLedgEntry."Item No.");
      END ELSE BEGIN
        AdjustCostApplied(ItemLedgEntry."Item No.",FALSE);
        // Restart adjustment, if too many recursions
        WHILE LevelExceeded DO BEGIN
          LevelExceeded := FALSE;
          AdjustCostApplied(ItemLedgEntry."Item No.",FALSE);
        END;
      END;
    
      IF (CostingMethod <> CostingMethod::Standard) AND (Item."No." <> '') THEN
        ItemCostMgt.UpdateUnitCost(Item,'','',0,0,TRUE,FALSE,FALSE);
    
      ItemLedgEntry.FIND('+');
      
      // change
      IF ItemFilter <> '' THEN
        ItemLedgEntry.SETFILTER("Item No.",'%1',ItemFilter)
      ELSE
      // change
      ItemLedgEntry.SETRANGE("Item No.");
    
    UNTIL (ItemLedgEntry.NEXT = 0) OR LevelExceeded;
    
    EXIT(TRUE);
    



    This way you can run the report form one item a the time. You can also create a codeunit that runs the report for on item a the time and then do commit between.
  • Options
    AJSAJS Member Posts: 12
    Thanks a lot.

    I will try this.

    AJS
Sign In or Register to comment.