RSS

Tag Archives: Dynamics Ax 2009

Error Cannot create a record in TmpLedgerJournalPost TmpLedgerJournalPost). Insert operations are not allowed across companies. Please use changecompany keyword to change the current company before inserting the record.

There is a bug with changeCompany keyword which prevents usage of the same initialized table buffer in different companies. For example, in the following code:

LedgerJournalTrans ledgerJournalTrans;

changecompany(company)
{
ttsbegin;

if(this.parmLedgerJournalTable().RecId)
{
tmpLedgerJournalPost.JournalNum = this.parmLedgerJournalTable().JournalNum;
tmpLedgerJournalPost.Branch = ledgerTransactionVoucher.Branch;
tmpLedgerJournalPost.VoucherType= ledgerTransactionVoucher.VoucherType;
tmpLedgerJournalPost.TransDate = ledgerTransactionVoucher.TransDate;
tmpLedgerJournalPost.Company = ledgerTransactionVoucher.Company;
tmpLedgerJournalPost.insert();
}
//further operations
}

crosscompany error

Issue
On usage of change company keyword also the table buffers will hold the old values, so its necessary to explicitly clear the table buffer by assigning null.

Solution:

i was inserting the records through code in multiple companies using the same table buffer and i had to assign null to the table buffer after switching the company to resolve this issue as it was not assigning the buffer to null as expected.

LedgerJournalTrans ledgerJournalTrans;

changecompany(company)
{
// nulling
ledgerJournalTrans = null;
ledgerJournalTable = null;
// nulling
ttsbegin;

if(this.parmLedgerJournalTable().RecId)
{
tmpLedgerJournalPost.JournalNum = this.parmLedgerJournalTable().JournalNum;
tmpLedgerJournalPost.Branch = ledgerTransactionVoucher.Branch;
tmpLedgerJournalPost.VoucherType= ledgerTransactionVoucher.VoucherType;
tmpLedgerJournalPost.TransDate = ledgerTransactionVoucher.TransDate;
tmpLedgerJournalPost.Company = ledgerTransactionVoucher.Company;
tmpLedgerJournalPost.insert();
}
//further operations
}

Happy Daxing  🙂

Advertisements
 

Tags: , , , , , ,

Unable to validate the AX 2009 Workflow Webservice URL on a Windows Server 2008 R2 x64-Error :The request failed with HTTP status 405: Method Not Allowed.

I have recently successfully installed Dynamics Ax 2009 Workflow.this is running on the following System configuration:
1. Windows 2008 R2 64 bit.
2. SQL Server 2008
3. IIS 7.5

However when i tried to Validate the workflow URL (e.g. http://jai-mdas-05/MicrosoftDynamicsAXWorkflow50/AxWorkItem.asmx in the AX Client (AX 2009 Client -> Administration -> Setup -> Workflow infrastructure configuration wizard) I got the following error:

The request failed with HTTP status 405: Method Not Allowed.

However when we browse one of the web service pages, AxWorkItem.asmx, we get the following error:

"HTTP Error 404.17 – Not Found. The requested content appears to be script and will not be served by the static file handler"

i have done lots of Google searches to find out this error resolution and got to know that it is usually occurs when you have the 4.0 .NET framework installed on the machine.  The workflow web services are built with version 2.0 of .NET.  IIS has associated the workflow web service files with the 4.0 file handler and the services are not functional with that handler.

This indicates we have an asp.net handler issue and it cannot find the correct handler to process the .asmx file. So looking at the handler mappings for the MicrosoftDynamicsAXWorkflow50 application, identified that there was only one *.asmx handler and this was mapped to ASP.NET 4.0 (C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll)

 

image

 

 

To solve the issue, I basically have gone through following steps:

1. Deleted MicrosoftDynamicsAXWorkflow50 Application directory in IIS, under the default web site.

2.create a “Virtual Directory” to the same site and named the new virtual directory with the same name of the deleted application.

3.set the  physical path  as “D:\Program Files\Microsoft Dynamics AX\50\Workflow“of the newly created virtual directory named MicrosoftDynamicsAXWorkflow50 .This folder contains the web services of AX workflow.i have done dynamics ax installation in D Drive.most probably it will be in “C:Program FilesMicrosoft Dynamics AX50Workflow“.

4.Now select the virtual directory named MicrosoftDynamicsAXWorkflow50 and  by right-clicking that directory and clicking “Convert to Application”

5.then select the application and double click ”Authentication” and I insured that “ASP.NET Imporsenation” ,“Windows Authentication”and “Anonymous Authentication” are enabled and remains should be disabled.

6.Now went to the “Handler Mapping” of the Workflow Application. I selected “WebServiceHandlerFactory-ISAPI-2.0″ and then clicked “Edit”. I insured that the “Executable” path is pointing to the %windir%\Microsoft.NET\Framework64\v2.0.507\aspnet_isapi.dll.

Note:by default  the “Executable” path is pointing to the %windir%\Microsoft.NET\Framework\v2.0.507\aspnet_isapi.dll.

7.“Basic Authentication” should be disabled,otherwise you may face below error

 

image

 

 

Smile Happy Daxing

 
Leave a comment

Posted by on October 22, 2012 in Microsoft Dynamics AX, Workflow

 

Tags: ,

Ax error " A user session on the server could not be created. Try to start the client again. If the problem continues contact Ax Administrator

 

 

today we are having trouble with logging onto our Ax system.  The following errors occurs:

A user session on the server could not be created.  Try to start the client again.  If the problem continues contact Ax Administrator

 

this error is coming because of  AOS has no access to createusersessions stored procedure in the database.

 

finally got the conclusion that  the transaction log of the dbase is full, which will cause your login session to fail as well and throw the error

” A user session on the server could not be created. Try to start the client again. If the problem continues contact Ax Administrator”

 

 

the solution of this problem for

 

SQl Server 2008



EXEC sp_helpdb [DatabaseName]
ALTER DATABASE [Database Name] SET RECOVERY SIMPLE
go
DBCC
SHRINKFILE(Database_log)
go
Alter Database [Database Name] Set Recovery Full

EXEC sp_helpdb [DatabaseName]

 

 

SQL Server 2005

USE [DatabaseName];
GO;
SELECT file_id, name FROM
sys.database_files;

Backup log [DatabaseName] with Truncate_only;

DBCC Shrinkfile(DatabaseName_log)

 

SQL SERVER – Find Current Location of Data and Log File of All the Database

SELECT name, physical_name AS current_file_location

FROM sys.master_files

 
4 Comments

Posted by on October 9, 2012 in Microsoft Dynamics AX, SQL SERVER

 

Tags: ,