Req. Worksheet - Calc plan function, need help

KisuKisu Member Posts: 381
I'm working on a code that'd need to get a value from sales line to Requisition Worksheet when you run the Calculate plan but I've problem finding the right codeunit and trigger that does the transfer.

I have a sales order that has a line that transfers to the worksheet but without the column, I got the same Field (that I'd need to transfer) on every table the codecoverage goes trough on the process

Any help with this issue?
K.S.

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    with a quick look, I found the process is using Unplanned Demand table to copy data to requisition line..
    please have a look..
  • KisuKisu Member Posts: 381
    Hmm but the coverage doesnt catch the table?:


    Table 4 Currency 0,22
    Table 27 Item 0,04
    Table 246 Requisition Line 0,31
    Table 330 Currency Exchange Rate 0,20
    Table 337 Reservation Entry 0,02
    Table 5700 Stockkeeping Unit 0,05
    Table 5742 Transfer Route 0,30
    Table 99000853 Inventory Profile 0,58
    Form 291 Req. Worksheet 0,07
    Form 565 Code Coverage 0,79
    Report 699 Calculate Plan - Req. Wksh. 0,70
    Codeunit 330 ReqJnlManagement 0,08
    Codeunit 408 DimensionManagement 0,03
    Codeunit 5402 Unit of Measure Management 0,29
    Codeunit 5404 Lead-Time Management 0,46
    Codeunit 5777 Whse. Validate Source Line 0,13
    Codeunit 6500 Item Tracking Management 0,01
    Codeunit 7010 Purch. Price Calc. Mgt. 0,30
    Codeunit 7600 Calendar Management 0,39
    Codeunit 99000808 PlanningRoutingManagement 0,03
    Codeunit 99000809 Planning Line Management 0,15
    Codeunit 99000831 Reservation Engine Mgt. 0,01
    Codeunit 99000832 Sales Line-Reserve 0,02
    Codeunit 99000833 Req. Line-Reserve 0,04
    Codeunit 99000834 Purch. Line-Reserve 0,02
    Codeunit 99000836 Transfer Line-Reserve 0,02
    Codeunit 99000838 Prod. Order Comp.-Reserve 0,02
    Codeunit 99000841 Item Ledger Entry-Reserve 0,75
    Codeunit 99000854 Inventory Profile Offsetting 0,62
    Codeunit 99000855 Planning-Get Parameters 0,93
    Codeunit 99000856 Planning Transparency 0,61
    K.S.
  • KisuKisu Member Posts: 381
    Okay, table 246 is the only object on the coverage calls that table

    TransferFromUnplannedDemand(VAR UnplannedDemand : Record "Unplanned Demand") - Tigger

    I ran the Calculate function with debug on and it did not stop on the marker.
    I also checked the coverage and the it does not go through the trigger.

    I thought this was easy first too, but it seems the transfer is well hidden somewhere in the code :-k
    K.S.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I tried it myself and working fine..

    1.Created field in Unplanned Demand table..

    2.Copied Data from Sales Line to Unplanned Demand field via InsertSalesLine function of Get Unplanned Demand CU

    3.Copied back data from Unplanned Demand table to Requision Line table via TransferFromUnplannedDemand function in table 246..
  • KisuKisu Member Posts: 381
    Ah you do it a bit differently.

    1. I have a column on sales order lines (sales line table)

    2. I add Item to the line and some text to the new field

    3. there are not enough items so you need to order more of those items and you go to to the req. worksheet

    4. I open the req. worksheet and calculate the plan and it adds the sales order lines with the items that needs to be ordered (but without the new field)

    I have the field on the temp table, the requisition table, the sales line table

    When I use the calculate function it does not use the trigger which uses the table 5520.
    K.S.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Just try with steps 2 and 3..

    You have to write one line code in above 2 functions..
  • KisuKisu Member Posts: 381
    Okay I did parts 2. and 3. now and ran the calculate, but its not working.

    I also tested by adding markes on that function and run the function with debug, the function does not fire :-k
    Also the CU 5520 is not shown up on the code coverage.

    Yet I get all the lines from the sales orders that has items needed to be ordered.
    K.S.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Its workking for me..

    can you explain the steps and show the code what you did?
  • KisuKisu Member Posts: 381
    Sure:

    Added the table fields, added code and run the test I described on previous post

    tables fields
    Sales line table 37, added "text field" lenght 30 type text
    requisition line table 246, added "text field" lenght 30 type text
    unplanned demand table 5520, added "text field" lenght 30 type text

    table 246 code added:
    TransferFromUnplannedDemand(VAR UnplannedDemand : Record "Unplanned Demand")
    INIT;
    "Line No." := "Line No." + 10000;
    "Planning Line Origin" := "Planning Line Origin"::"Order Planning";
    
    Type := Type::Item;
    "No." := UnplannedDemand."Item No.";
    "Location Code" := UnplannedDemand."Location Code";
    "Bin Code" := UnplannedDemand."Bin Code";
    VALIDATE("No.");
    VALIDATE("Variant Code",UnplannedDemand."Variant Code");
    Description := UnplannedDemand.Description;
    "Unit Of Measure Code (Demand)" := UnplannedDemand."Unit of Measure Code";
    "Qty. per UOM (Demand)" := UnplannedDemand."Qty. per Unit of Measure";
    Reserve := UnplannedDemand.Reserve;
    
    "text field" := UnplannedDemand."text field"; // k.s., 5.4.2012
    
    ...
    


    codeunit
    get unplanned demand codeunit 5520, added following code:
    InsertSalesLine(VAR UnplannedDemand : Record "Unplanned Demand")
    WITH UnplannedDemand DO BEGIN
      UnplannedDemand2.COPY(UnplannedDemand);
    
      "Demand Line No." := SalesLine."Line No.";
      "Demand Ref. No." := 0;
      "Item No." := SalesLine."No.";
      Description := SalesLine.Description;
      "Variant Code" := SalesLine."Variant Code";
      "Location Code" := SalesLine."Location Code";
      "Bin Code" := SalesLine."Bin Code";
      "Qty. per Unit of Measure" := SalesLine."Qty. per Unit of Measure";
      "Unit of Measure Code" := SalesLine."Unit of Measure Code";
      Reserve := SalesLine.Reserve = SalesLine.Reserve::Always;
      "Special Order" := SalesLine."Special Order";
      "Purchasing Code" := SalesLine."Purchasing Code";
    
    
      "text field" := SalesLine."text field"; // k.s., 5.4.2012
    
      Level := 1;
      "Quantity (Base)" := DemandQtyBase;
      "Demand Date" := SalesLine."Shipment Date";
      IF "Demand Date" = 0D THEN
    
    K.S.
  • KisuKisu Member Posts: 381
    Navision version is 2009 SP1 (6.00.29626), object for this matter were base objects
    K.S.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Kisu,

    I did the same thing and it is working fine..make sure that you are checking correct Sales line is in which you have added text field value is inserted in requisition line...
  • KisuKisu Member Posts: 381
    Triple checked those, but its not working. Are you sure the triggers are right as on the table 246 it passes that trigger

    instead is uses these transfer triggers on the table 246:

    TransferFromPurchaseLine(PurchLine)

    TransferFromTransLine(TransLine)
    K.S.
  • KisuKisu Member Posts: 381
    Okay those are triggered from purchase orders, hmm but why it skips the sales orders then, I think the code might be right now, now just need to find why it does not fetch those sales lines.
    K.S.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Kisu wrote:
    Triple checked those, but its not working. Are you sure the triggers are right as on the table 246 it passes that trigger
    Those triggers are right..but I added Before Insert in CU and at last line in table function..I dont thnk that makes any diff..
  • KisuKisu Member Posts: 381
    edited 2012-04-26
    [scrapped]
    K.S.
  • KisuKisu Member Posts: 381
    Its still not working.

    Isn't Unplanned Demand table used with productions? We are not making production orders, we are making sales orders.
    Could you confirm that you are doing the same?

    When I have Sales order and add item that you'd need more than there is in inventory, it populates table 337 Reservation Entry
    with that item and quantity.

    Then when you run the requisition worksheet and calculate plan for that item the table 337 gets new line with same "entry no." but with positive quantity.

    Me and my co worker have been thinking if the requisition worksheet gets the value from there and not around 5520.
    The debugger does not go through Unplanned Demand.
    K.S.
Sign In or Register to comment.