transfer due date in release production order to consumption journal posting date

transfer due date in release production order to consumption journal posting date

This question has suggested answer(s)

Hi guys i try to get due date in release production order come or transfer  in consumption journal automatically but it not come i don't know the problem :

what i need is to transfer date found in release production order (due date) to posting date in request form  of calc consumption(function-cal consumption-option-posting date) in default it take work date but i need due date in place of work date. so that i write this code to achieve this task

in open form of request form of report 5405


IF "Prod. Order No." = '' THEN
  EXIT;

ProdOrderLine.RESET;
ProdOrderLine.SETRANGE(Status,ProdOrderLine.Status::Released);
ProdOrderLine.SETRANGE("Prod. Order No.","Prod. Order No.");
IF ProdOrderLine.FIND('+') THEN
due_date:= ProdOrderLine."Due Date" ;

then i replace workdate with due_date global variable as date data type

InitializeRequest(due_date,CalcBasedOn::"Expected Output");

then

in createconsujinl function i write

  ItemJnlLine.VALIDATE("Posting Date",due_date);

but when i run and open request form again after i make release production order  and got to consumption journal it give me empty posting date text box

why and how i solve this problem.

thanks

All Replies
  • Hi

    From your previous questions i think you are using the 2009 RTC and not the classic client

    You say you are writing the code in the request FORM (Not the request PAGE), this means that the code will not run in the RTC, you will need to move it to the request page to see it work in the RTC

    Before moving it to the page however, switch on the debugger and run through the code step by step in the classic client to see if it is running the code you have written and what records it finds when looking for the due date, this will let you know it works as it should before you move it to the RTC

    Cheers

    Nev

    Neville Foyn
    NAV Developer, Consultant & Trainer (Since 2001)
    MCTS NAV, CRM, Sharepoint, SQL
    MCITP NAV
    MCT 

  • Can you tell me more details my version is Microsoft dynamic nav 2009 r2 classic and i write my code in request form because posting date i want to assign it found in this form . and until now i don't know how i solve this problem

    thanks

  • Hi

    You need to check what the code is doing while it runs

    In the classic client, Click on tools -> debugger -> and make sure both options are ticked

    Then run the report and use F8 to step through the code while looking at the record values in the bottom section of the debugger, check to see if the system is finding the released production order and retrieving the date.

    You should see what the issue is by using the debugger

    Cheers

    Nev

    Neville Foyn
    NAV Developer, Consultant & Trainer (Since 2001)
    MCTS NAV, CRM, Sharepoint, SQL
    MCITP NAV
    MCT 

  • I write this code on pre data item in production order table on report 5405 calc consumption report

    RESET;

    SETRANGE(Status,Status::Released);

    SETRANGE("No.","No.");

    IF FIND('+') THEN

    //ProdNo:= "No." ;

    due_date:= "Due Date" ;

    VALIDATE("Due Date",due_date);

    what i need when  press function button and select calc consumption then select no due date goted in posting date in request form.How i do that are this code wrong.

    to your notes i make that because useres in my company register data before 3 monthes so that i need due date come based on last record released production order

    please help me

    thanks