Problem with TransactionType in NAV 2009 RTC

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.

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);

```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 below error :![5140.Error.JPG|512x384](upload://3z9CTv1KLSv8zva7vNz9qZ0F5Gn.jpeg)

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?

Is there anything to do with hiding the report request form/page 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

Hi Guys,

Can anyone have a look at this and help me resolve the issue?

Note that i have asked the same problem in NAV community. Refer http://social.microsoft.com/Forums/en-US/partnerdynamicsnav/thread/1e4a090a-51a9-449e-8bd1-5c02a895a25f However this requires me to log a chargeable support incident which i cannot opt for at the moment.

Any idea?

I think the fact that it errors in the RTC stack is a bug - are you using SP1?

Have you tried just using COMMIT and not setting a transaction type? The transaction type is used to determine the default isolation level and locking against SQL Server, and is really needed.

Hi,

Thanks for your reply.

I too doubt it to be a bug.

Yes i am using SP1.

I had tried earlier and today also by just using the COMMIT but it still errors in both Classic and RTC.

Note that “Refresh Production Order” is a processing only report with TransactionType property set to Update.