mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 3:52 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Req. Worksheet - Calc plan function, need help
PostPosted: Wed Apr 04, 2012 4:33 pm 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Wed Apr 04, 2012 5:04 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
with a quick look, I found the process is using Unplanned Demand table to copy data to requisition line..
please have a look..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 8:33 am 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 8:35 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Its used as Temp table..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 9:23 am 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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


Attachments:
unplaneddemand.jpg
unplaneddemand.jpg [ 61.3 KiB | Viewed 697 times ]

_________________
K.S.
Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 9:32 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
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..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 9:47 am 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 9:49 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Just try with steps 2 and 3..

You have to write one line code in above 2 functions..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 10:03 am 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 10:39 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Its workking for me..

can you explain the steps and show the code what you did?

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 12:20 pm 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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:
Code: Select all

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:
Code: Select all

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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 12:23 pm 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
Navision version is 2009 SP1 (6.00.29626), object for this matter were base objects

_________________
K.S.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 12:40 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
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...

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 1:57 pm 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
 Post subject: Re: Req. Worksheet - Calc plan function, need help
PostPosted: Thu Apr 05, 2012 2:04 pm 
Offline

Joined: Wed Apr 04, 2007 3:34 pm
Posts: 358
Location: Finland
Country: Finland (fi)
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.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to:  
cron