Problem with TransactionType in NAV 2009 RTC

havhav Member Posts: 299
edited 2010-11-29 in NAV Three Tier
Hi All,

I have written a codeunit with below function whose purpose is to cancel reservations and refresh the firm planned produciton order having source as FamilyNo passed as an argument.
CancelAndRefreshProdOrder(FamilyNo : Text[30])
//Purpose: Reserve the stock for the FamilyLines by refreshing the Production Order.
//Input:  Family Number
//Output: Stock reserved only for the FamilyLines present in the Family record.

COMMIT;
ProductionOrder.RESET;
ProductionOrder.SETRANGE(Status, ProductionOrder.Status::"Firm Planned");
ProductionOrder.SETRANGE("No.", FamilyNo);
IF ProductionOrder.FIND('-') THEN
BEGIN
     ReservEntry.RESET;
     ReservEntry.SETRANGE(ReservEntry."Source ID", ProductionOrder."No.");
     ReservEntry.SETRANGE("Reservation Status", ReservEntry."Reservation Status"::Reservation);
     IF ReservEntry.FIND('-') THEN
     BEGIN
     REPEAT
           ReservEngineMgt.CloseReservEntry2(ReservEntry);
           COMMIT;
     UNTIL ReservEntry.NEXT = 0;
     END;

     COMMIT;
     CURRENTTRANSACTIONTYPE := TRANSACTIONTYPE::Update;
     ProdOrder.RESET;
     ProdOrder.SETRANGE(Status, ProdOrder.Status::"Firm Planned");
     ProdOrder.SETRANGE("No.", ProductionOrder."No.");
     REPORT.RUNMODAL(REPORT::"Refresh Production Order",FALSE,TRUE,ProdOrder);
     COMMIT;
END;

When i run NAV 2009 Classic Client, the function is executed properly and the respective Firm Planned Production Order is refreshed to carry out reservation of required stocked components.
However, if i test this function in NAV 2009 RTC, it generates error as below:


The error is generated at the line where i change the transaction type
i.e.

COMMIT;
CURRENTTRANSACTIONTYPE := TRANSACTIONTYPE::Update;


Before COMMIT, the transactiontype is UpdateNoLocks, which i change it to Update after the COMMIT so that the report "Refresh Production Order" runs in Update mode.

I am not sure why the error appears in RTC only inspite of the fact that i have changed the transaction type from UpdateNoLocks to Update.

If i do not put the COMMIT and do not set the transaction type then the same error is displayed in both Classic Client and RTC and the report is not executed.

Any idea what is going wrong here?

Regards,
Hemant
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)

Comments

  • havhav Member Posts: 299
    Hey guys,
    Is there anything to do with hiding the report request form by passing the argument as false when i call the report to run modally?
    REPORT.RUNMODAL(REPORT::"Refresh Production Order",FALSE,TRUE,ProdOrder);
    

    The 2nd argument above.

    I also noticed that the TransactionType property of the report "Refresh Production Order" is set to Update.
    So do i explicitly need to change the transactiontype before running the report?
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • havhav Member Posts: 299
    This is creating a mystery for me and i am unable to fix it.
    Pls help.
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • krikikriki Member, Moderator Posts: 9,115
    I think I have a good idea.

    I think you are running NAV2009 without SP1.

    The COMMIT statements do NOT do a COMMIT in the webservices (and RTC uses webservices to connect to the database). So in reality you are NOT doing a COMMIT where your COMMIT-statement is and thus your transaction is NOT closed. And you can't change the transaction type in the middle of a transaction.

    There is a bugfix for that problem, but I don't know the KB or the build of NAV for it (I have it all on my dead portable :( ). If you open a request in Microsoft stating you want the bugfix for the COMMIT that does not do a COMMIT in the webservices, they 'll know what you need.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • havhav Member Posts: 299
    Hi Kriki,
    Thanks for your reply.
    kriki wrote:
    I think you are running NAV2009 without SP1.
    No.
    I am using NAV 2009 NA SP1
    kriki wrote:
    If you open a request in Microsoft stating you want the bugfix for the COMMIT that does not do a COMMIT in the webservices, they 'll know what you need.
    You mean to post query to mbsquery@microsoft.com?

    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • krikikriki Member, Moderator Posts: 9,115
    Sorry it took so long, but there was Directions EMEA 2010 and a portable crash in between...

    No, you have to go on partnersource and create a request there.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • zdundazdunda Member Posts: 2
    Hi, here could you find the solution: https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?WTNTZSMNWUKNTMMYYMYQKSYMXOSOOUMLWQOVNNOWZUMLSYZMNOURUYYKVTSMNQKL. You have to click the View and request hotfix downloads.

    I was trying to run report after filtering records into temporary table and the RTC client returned the same error. After instalation (copying of files) of this hotfix and inserting Commits it is working.

    Hope, this helps...
  • havhav Member Posts: 299
    I am using NAV 2009 SP1 hence i think the hotfix should be included in it.

    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Sign In or Register to comment.