Varios ejemplos C# .net para conectar con AX 4.0 utilizando Bussines conector

Filed under:.NET,4.0,Uncategorized,axapta,desarrollo,dynamics — posted by admin on June 24, 2010 @ 1:20 am

UAN

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx;
            DynAx =3D new =
Microsoft.Dynamics.BusinessConnectorNet.Axapta();
            // Test the connection to the .NET Business Connector=20
            // by using the proxy user.
            System.Net.NetworkCredential nc =3D new =
            System.Net.NetworkCredential("proxyBCAX", "********");
            try
            {
                DynAx.LogonAs("proxyBCAX", "", nc, "", "", "", =
                   "C:\\Documents and Settings\\1314\\Escritorio\\BC.AXC");
                //DynAx.LogonAs(Environment.UserName, "", null, "", "", =
                 "", "C:\\Documents and Settings\\1314\\Escritorio\\BC.AXC");
                Console.WriteLine( "Success Login OK");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }
    }
}

CHU
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                label1.Text = "";

                Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new
                    Microsoft.Dynamics.BusinessConnectorNet.Axapta();
                Microsoft.Dynamics.BusinessConnectorNet.AxaptaRecord DynRec;

                // Authenticate the user and establish a session.
                DynAx.Logon(Company.Text, null, AOS.Text, Configuration.Text);
                if (DynAx != null)
                {
                    label1.Text = ("Login OK");
                }

                // Define the record as the AddressState table.
                DynRec = DynAx.CreateAxaptaRecord("AddressState");

                // Define the query that will run on the AddressState records.
                // This will return all the data in the AddressState table with
                // the cursor positioned at the first record in the table.
                DynRec.ExecuteStmt("select * from %1");

                // Check if the query returned any data.
                if (DynRec.Found)
                {
                    // Display the record on the form that was retrieved from the query.
                    textBox1.Text = (string)DynRec.get_Field("Name");

                }
            }
            catch (Exception ex)
            {
                textBox1.Text = (ex.ToString());
                textBox1.Text += (ex.Message);
                label1.Text = ("Login Filed");
            }
        }
    }
}
ZRI
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

                label1.Text = "";

                Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new
                    Microsoft.Dynamics.BusinessConnectorNet.Axapta();
                Microsoft.Dynamics.BusinessConnectorNet.AxaptaRecord DynRec;

            // Authenticate the user and establish a session.
                System.Net.NetworkCredential nc = new System.Net.NetworkCredential(USER.Text, PASS.Text);
            try
            {
                //"C:\\Documents and Settings\\1314\\Escritorio\\BC.AXC"
                DynAx.LogonAs(AXUser.Text, Domain.Text, nc, Company.Text, null, AOS.Text, Configuration.Text);

                if (DynAx != null)
                {
                    label1.Text = ("Login OK");
                }

                // Define the record as the AddressState table.
                DynRec = DynAx.CreateAxaptaRecord("AddressState");

                // Define the query that will run on the AddressState records.
                // This will return all the data in the AddressState table with
                // the cursor positioned at the first record in the table.
                DynRec.ExecuteStmt("select * from %1");

                // Check if the query returned any data.
                if (DynRec.Found)
                {
                    // Display the record on the form that was retrieved from the query.
                    textBox1.Text = (string)DynRec.get_Field("Name");

                }
                //DynAx.Logoff();
            }
            catch (Exception ex)
            {
                textBox1.Text = (ex.ToString());
                textBox1.Text += (ex.Message);
                label1.Text = ("Login Filed");
            }
        }
    }
}

CLRInterop AX example (Como calcular el SHA1 de un fichero desde AX 2009)

Filed under:5.0,axapta,desarrollo,dynamics2009,x++ — posted by admin on February 26, 2009 @ 8:51 am

static void AXL_TestSHA1(Args _args)
{
#define.ClrFileStream (‘System.IO.FileStream’)
#define.ClrFileModeEnum (‘System.IO.FileMode’)
#define.ClrFileModeOpen (‘Open’)
#define.ClrFileAccessEnum (‘System.IO.FileAccess’)
#define.ClrFileAccessWrite (‘Write’)
#define.ClrFileAccessRead (‘Read’)//(‘ReadWrite’)

System.IO.FileStream fileStream;
ClrObject fileMode;
ClrObject fileAccess;
str _filename = ‘C:\\Log.txt’;

System.Type typeOfByte;
System.Array arrayOfByte;
int arrayOfByteLength = 1;
int i;
System.Security.Cryptography.SHA1CryptoServiceProvider SHA1;
System.Text.ASCIIEncoding encoding;

str strError;
CLRObject exc;
CLRObject innerExc;
CLRObject clrExcMessage;
int Struct1[];
container cont;
;
try
{
typeOfByte = System.Type::GetType(“System.Byte”);
arrayOfByte = System.Array::CreateInstance( typeOfByte, arrayOfByteLength );

fileMode = CLRInterop::parseClrEnum(#ClrFileModeEnum, #ClrFileModeOpen);
fileAccess = CLRInterop::parseClrEnum(#ClrFileAccessEnum, #ClrFileAccessRead);
SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
fileStream = new CLRObject(#ClrFileStream, _filename, fileMode, fileAccess);
arrayOfByte = SHA1.ComputeHash(fileStream);
fileStream.Close();

arrayOfByteLength = ClrInterop::getAnyTypeForObject(arrayOfByte.get_Length());
for( i = 0; i < arrayOfByteLength; ++i )
{
cont = conins(cont,i+1,(ClrInterop::getAnyTypeForObject( arrayOfByte.GetValue( i ) )));
print int2hex(ClrInterop::getAnyTypeForObject( arrayOfByte.GetValue( i ) ));
}
}
catch( Exception::Internal )
{
// BP Deviation Documented
exc = CLRInterop::getLastException();
if( exc )
{
clrExcMessage = exc.get_Message();
// BP Deviation Documented
strError = CLRInterop::getAnyTypeForObject( clrExcMessage );

throw error(strError);
}

}
catch( Exception::CLRError )
{
// BP Deviation Documented
exc = CLRInterop::getLastException();
if( exc )
{
clrExcMessage = exc.get_Message();
innerExc = exc.get_InnerException();

while(innerExc != null)
{
clrExcMessage = innerExc.get_Message();
innerExc = innerExc.get_InnerException();
}

// BP Deviation Documented
strError = CLRInterop::getAnyTypeForObject( clrExcMessage );

throw error(strError);
}

}

pause;
}

Uso de contenedores Con AX Business Connector Net

Filed under:.NET,4.0,5.0,axapta,desarrollo,dynamics,dynamics2009,x++ — posted by admin on February 2, 2009 @ 7:54 am

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Security.Cryptography;
using System.IO;
using Microsoft.Dynamics.BusinessConnectorNet;

namespace ConsoleApplication3
{
class Program
{

static void Main(string[] args)
{
Axapta AX;
AX = new Axapta();
AX.Logon(“CNS”, null, “DYmanicsAx1:2713″ , null);
object[] Parmlist = new object[1];

AxaptaContainer Container = AX.CreateAxaptaContainer();
Container = (AxaptaContainer)AX.CallStaticRecordMethod(“InventDim”, “dimEnabledFieldList”, 1);
Console.WriteLine(BankAccountTable.Call(“balanceCur”, Container));

AX.Logoff();
}

Microsoft.Axapta.BusinessConnector Code Samples

Filed under:.NET,4.0,5.0,axapta,desarrollo,x++ — posted by admin on January 23, 2009 @ 5:29 am

Delete sample

// Execute a query to retrieve an editable record
// where the name is MyStateUpdated.
axRecord.ExecuteStmt(“select forupdate * from %1 where %1.Name ==
‘MyStateUpdated’”);

// If the record is found then delete the record.
if (axRecord.Found)
{
// Start a transaction that can be committed.
ax.TTSBegin();
axRecord.Delete();
// Commit the transaction.
ax.TTSCommit();
}

INSERT

// Create the .NET Business Connector objects.
Axapta ax;
AxaptaRecord axRecord;
string tableName = “AddressState”;

try
{
// Login to Microsoft Dynamics AX.
ax = new Axapta();
ax.Logon(null, null, null, null);

// Create a new AddressState table record.
using (axRecord = ax.CreateAxaptaRecord(tableName));
{

// Provide values for each of the AddressState record fields.
axRecord.set_Field(“NAME”, “MyState”);
axRecord.set_Field(“STATEID”, “MyState”);
axRecord.set_Field(“COUNTRYREGIONID”, “US”);
axRecord.set_Field(“INTRASTATCODE”, “”);

// Commit the record to the database.
axRecord.Insert();
}
}
catch (Exception e)
{
Console.WriteLine(“Error encountered: {0}”, e.Message);
// Take other error action as needed.
}
READ

// Create the .NET Business Connector objects.
Axapta ax;
AxaptaRecord axRecord;
string tableName = “AddressState”;

// The AddressState field names for calls to
// the AxRecord.get_field method.
string strNameField = “NAME”;
string strStateIdField = “STATEID”;

// The output variables for calls to the
// AxRecord.get_Field method.
object fieldName, fieldStateId;

try
{
// Login to Microsoft Dynamics AX.
ax = new Axapta();
ax.Logon(null, null, null, null);

// Create a query using the AxaptaRecord class
// for the StateAddress table.
using (axRecord = ax.CreateAxaptaRecord(tableName));
{

// Execute the query on the table.
axRecord.ExecuteStmt(“select * from %1″);

// Create output with a title and column headings
// for the returned records.
Console.WriteLine(“List of selected records from {0}”,
tableName);
Console.WriteLine(“{0}\t{1}”, strNameField, strStateIdField);

// Loop through the set of retrieved records.
while (axRecord.Found)
{
// Retrieve the record data for the specified fields.
fieldName = axRecord.get_Field(strNameField);
fieldStateId = axRecord.get_Field(strStateIdField);

// Display the retrieved data.
Console.WriteLine(fieldName + “\t” + fieldStateId);

// Advance to the next row.
axRecord.Next();
}
}
}

catch (Exception e)
{
Console.WriteLine(“Error encountered: {0}”, e.Message);
// Take other error action as needed.
}

UPDATE

// Create an Axapta record for the StateAddress table.
axRecord = ax.CreateAxaptaRecord(tableName);

// Execute a query to retrieve an editable record where the name is MyState.
axRecord.ExecuteStmt(“select forupdate * from %1 where %1.Name ==
‘MyState’”);

// If the record is found then update the name.
if (axRecord.Found)
{
// Start a transaction that can be committed.
ax.TTSBegin();
axRecord.set_Field(“Name”, “MyStateUpdated”);
axRecord.Update();

// Commit the transaction.
ax.TTSCommit();
}

Guía rápida de instalación ax2009. Sobre W2003 R2 y SQL2005

Filed under:5.0,axapta,dynamics2009 — posted by admin on @ 5:21 am

Guía rápida de instalación ax2009. Sobre W2003 R2 y SQL2005

Instalación del servidor Windows 2003.

Instalación de SQL server 2005

Instalar Aplication Role

Al ejecutar el instalador nos cargara los prerrequisitos automáticamente.

Necesario permisos de Administrador.

Crear base de datos para AX 2009.

Para ello el usuario(login) debe ser miembro del grupo “dbcreator“ en SQL server.

Instalar el AOS Role.

Dar permios al usuario(login) que instala AOS dentro de la base de datos como securityadmin.

Comprobar tras la instalación que se crea el inicio de sesión para el AOS “domain\host$” con los permisos “db_datareader”, “db_datawriter”, “db_ddladmin”, “public” sobre la BBDD.

Validar permisos de ejecución para el inicio de sesión del usuario de AOS (“domain\host$”) y las credenciales que arranque del servicio de AOS para los procedimientos almacenados, “CREATESERVERSESSIONS”, “CREATEUSERSESIONS”

Instalar Client Role.

Necesario permisos de Administrador.

Al iniciar sesión se crean los perfiles ,“Admin “y “guest” en la “userinfo” .

Instalar .NET bussines conector.

User: AXDOS\ProxyAX .

pass: Axapta20.

Instalar Role center and Enterprise Portal.

Necesario permisos de Administrador.

Requisitos previos:

- Crear la cuenta bussines conector en el dominio.

- Instalar el framework 3.5 básico sin SP

- Crear un grupo de aplicaciones en IIS y asignarle el usuario para Bussines conector.

- Crear un directorio virtual y asignarle la aplicación anterior.

- ASP .NET 2.0.

- Microsoft SQL Server 2005 ADOMD.Net

- Microsoft Windows SharePoint Service 3.0 SP1

Estos se instalan de forma automática con desde el instaler de AX2009.

Es necesario descargar de la pagina de Microsoft Sharepoint sp1.

http://www.microsoft.com/downloads/details.aspx?familyid=EF93E453-75F1-45DF-8C6F-4565E8549C2A&displaylang=en

Durante la instalación puede aparecer el siguiente error:

Error executing code: SysDevelopmentProxy (object) has no valid runable code in method ‘generate’.

(C)\Classes\SysDevelopmentProxy\generate
(C)\Classes\SysEPDeployment\clrGenerateProxies – line 7
(C)\Classes\SysEPDeployment\deployProxies
(C)\Classes\SysEPDeployment\deployAllWebParts
(C)\Classes\SysEPDeployment\deployEPOnSharepoint
(C)\Classes\SysEPDeployment\installEnterprisePortal


Microsoft.Dynamics.BusinessConnectorNet.BusinessConnectorException
at Microsoft.Dynamics.BusinessConnectorNet.AxaptaObject.Call(String methodName, Object[] paramList)
at Microsoft.Dynamics.BusinessConnectorNet.AxaptaObject.Call(String methodName, Object param1)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsObjectAdapter.Call(String methodName, Object param1)

An error occurred during setup of Role Centers and Enterprise Portal.
Reason: No .NET Business Connector session could be found.
=== Rolling back setup of Role Centers and Enterprise Portal due to error =

Este es provocado por un error en la referencia al conector, al compilar la aplicación sin haber instalado el “bussines conector”.

Puede aparecer este error el desplegar las áreas de negocio.

Ha ocurrido un error inesperado.

A ProgressTemplate must be specified on UpdateProgress control with ID ‘AxProgressControl’.

System.InvalidOperationException

at System.Web.UI.UpdateProgress.CreateChildControls()

at System.Web.UI.Control.EnsureChildControls()

at System.Web.UI.UpdateProgress.get_Controls()

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxProgressControl.Create()

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxProgressControl.AddToPage(Control control)

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxContentPanel.Page_PreLoad(Object sender, EventArgs e)

at System.EventHandler.Invoke(Object sender, EventArgs e)

at System.Web.UI.Page.OnPreLoad(EventArgs e)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Este error es debido a la instalación del SP1 sobre el framework 3.5. El Share point y Dynamics no admiten este parche.

SQL sever 2008 + Dynamics 2009

Filed under:5.0,SQL,axapta,dynamics2009 — posted by admin on July 7, 2008 @ 3:03 am

La idea de hacer experimentos con gaseosa siempre nos ha llamado la atención debe ser esa parte animal que dentro de nuestros cerebros se resiste a desaparecer y que hace reacción ante cualquier botón o lucecita q se nos ponga delante. Algo parecido nos sucede con las nuevas versiones y los download. Todo es descargar y probar. XDD

A lo que vamos, nos hemos propuesto instalar lo último de lo más en y ello vamos.

Tras descargar la imagen iso de sql Server 2008, le damos setup, este nos recomienda que nos instalemos una serie de parches, la cosa funciona sola y las actualizaciones necesarias se descargan y actualizan sin mucho esfuerzo.

Después llega el momento del siguiente, siguiente, siguiente que tanto nos gusta a los grandes gurus de la informática.

Nos peleamos un poco con los permisos de los servicios y las configuración standrad.

Para reducir esperas le damos a todo como administrador del domino que para eso lo hemos creado, ejjeje y asin no tenemos que pagarle horas extras al externo que nos lo mantiene.

Todo ok. Sql chutando y el AX 2009 prepardo para instalar.

Un poco de lo mismo (Siguiente siguente siguiente..) y ya tenemos la instalación preparada para compilar.

Despues de todo esto, provaremos el rendimiento de sql 2008 y alguna cosilla nueva. .

“Una experiencia nunca es un fracaso, pues siempre viene a demostrar algo”.
Thomas Alva Edison (1847-1931);

PD: Hasta un consultor financiero se podria instalar esto …. XDDDD

Como instalar Google analytics en Enterpraiseportal de axapta 3.0

Filed under:3.0,aeportal,axapta,desarrollo — posted by admin on June 2, 2008 @ 11:17 pm

Para poder colocar las estadisticas de google o cualquier otro servidor de analisis, solo necesitamos localizar la pagina que siempre se ejecutara por defecto en nuestro AEportal. En este caso Standard Home page.

Introducimos el jscript que nos proporciona el servidor de analisis y actualizamos la version.

dibujo1111.JPG

dibujo11112.JPG

Microsoft Dynamics 2009

Filed under:5.0,axapta,dynamics,dynamics2009,oracle — posted by admin on May 16, 2008 @ 1:04 am

Ya esta aquí, la pre-released de axapta 2009 y como lo han bautizado Dynamics 2009.

Bueno puestos a probarla, pues hay va el resumen de la instalación, lo cierto que esta nueva versión tiene muchas cosas nuevas que iremos descubriendo y probando, así rápido de decir que podremos configurar en nuestros clientes el consumo de memoria en función de la instalación he incluso en que cpu queremos que se ejecute nuestro aos. También hay nuevos conceptos que la parte de desarrollo que consiguen una perfecta integración y nos facilitara la vida a todos los X frikis. 

Diario de una instalación.

Herramientas:

-Windosw 2003 R2

-Oracle express 10 g

Después de hacernos con la copia de dynamics 2009 en el mercado negro por supuesto.

La tostamos por que queda muy chuli eso de ir enseñando el dvd por hay .. jejej…

y le damos cera a la instalación.

dibujo_1.JPG

Uno empieza a darle a los botones todo loko de contento cuando se encuentra con que no se puede instalar en sql server 2000, el framework 3.5 y un par de cosillas mas, eso me pasa por darle y no leer las especificaciones de instalación.

Suerte que los pakistanies que ha puesto  M$ a trabajar en esta versión se han puesto las pilas y se nota que son de donde son… total q la cosa y a viene lista sin andar por hay buscando parches y otras fiestas…

dibujo_2.JPG

dibujo_3.JPG

Tras  pegarnos con la instalación de oracle, configurar el usuario y el active directori que no falte… (estos siempre barriendo pa su casa)

dibujo_5.JPG

Una de las cosas mas interesantes que trae este pre-released es la posibilidad de consultar un log con todas las maldades que nos ha ido haciendo en el sistema, lo que proporcina una gran ayuda para solventar posibles errores.

dibujo_6.JPG

Es importante que la instalación al igual que 4.0 nos envia bastante información al visor de sucesos.

Durante una de las pruebas el tablespaces de systema se nos quedo pequeño al configurar mal  la ubicación de tablas lo que nos produjo unos cuantos errores de sincronización, como unos 800, total que por suerte en 2 minutos se pudo averiguar la causa y solventarla.

dibujo_7.JPG

Esta versión ya podemos decir que es un producto tecnologicamente mas competitivo y mas estable.

dibujo_8.JPG

Estas son los comandos para crear un tablespaces de pruebas y un usuario valido, a la vez que la autentificación  externa.

SQL> alter system set os_authent_prefix =”OPS$” scope=SPFILE;
SQL> create user “OPS$DOM\ADMINISTRADOR” identified externally;

Usuario creado.

SQL> grant connect to “OPS$DOM\ADMINISTRADOR”;

Concesi¾n terminada correctamente.

SQL>
create tablespace AXDATA datafile ‘C:\oraclexe\oradata\XE\AXDATA.dbf’
size 50M autoextend on;

create tablespace AXINDEX datafile ‘C:\oraclexe\oradata\XE\AXINDEX.dbf’
size 50M autoextend on;

Rápido y conciso no ???

No hay para mas que el jefe me pide cerrar  iva y no llegamos..

JAJJAJAJA

How to your Oracle database as a multithreaded server

Filed under:3.0,axapta,oracle,system — posted by admin on April 18, 2008 @ 9:30 am

Un documento de cuando AX era Daangard

When setting up an Oracle database to work with Axapta it is often (normally) configured as a dedicated database server for the following reasons:

· Until now this has been the default behavior of an Oracle database.

· Early versions of the multithreaded server was known to be unstable and with some annoying bugs.

The backside of configuring the database as a dedicated server is:

· Each new database connection creates a process / thread on the server.

· Each new database connection allocates more memory for PGA purposes than a similar multithreaded connection.

As you increase the number of concurrent users in an Axapta system you will also increase the administrative burden of the Oracle database server, because you will start new processes / threads on the database server for each new Axapta session. At one point this task of switching between processes / threads will be so overwhelming big part of the servers activity that it will “kill performance” on the server.

Large Oracle Axapta installation with several hundred concurrent Axapta session are therefore more or less forced to configure their database as a multi threaded server.

Axapta running in 2-tier mode has in average 3-4 database connection, which is why configuring your Oracle database as multithreaded will ease the database servers tasks of administer the processes / threads and decrease the consumption of memory. Even though Axapta in 2-tier mode is more expensive database connection wise compared to 3-tier mode you will still benefit from using multithreaded server when running Axapta in 3-tier mode.

This document describes in short how to your Oracle database as a multithreaded server.


1. Oracle init.ora parameters

If you want to understand the way a multithreaded server works compared to a dedicated server, then you can read about this in the following 2 Oracle manuals:

· Oracle Concepts

· Oracle Administrator guide

The following Oracle kernel parameters must or can be specified in order to make the Oracle database server run in multithreaded server mode. A detailed description of these parameters can be found in the “Oracle Reference” manual.

Parameters  
mts_dispatchers:   Controls the protocol and number of dispatcher processes started at instance start. In the most simple way you just specify the protocol and the number of dispatcher processes stated at instance start:
·    mts_dispatcher=”(protocol=<protocol>)(dispatchers=<n>)”

<protocol> would typically be TCP and <n> is the number of dispatchers. You can specify multiple MTS_DISPATCHERS in the initialization file, but they must be adjacent to each other.

To specify that you want to start 5 dispatchers for the TCP/IP protocol at instance start you must specify as follows:
·    mts_dispatcher=”(protocol=TCP)(dispatchers=5)”

mts_max_dispatchers:  Specifies the maximum number of dispatcher processes allowed to be running simultaneously. Default: 5 or the number of dispatchers configured, whichever is greater. For most systems, a value of 200 – 250 connections per dispatcher provides good performance.
mts_servers :  Specifies the number of server processes that you want to create when an instance is started up. If system load decreases, this minimum number of servers is maintained. Therefore, you should take care not to set mts_servers too high at system startup.
mts_max_servers:   Specifies the maximum number of shared server processes allowed to be running simultaneously. If artificial deadlocks occur too frequently on your system, you should increase the value.
Default: Derived from mts_servers (either 20 or 2*mts_servers) .
Tests in out benchmark lap shows that in order to avoid artificial deadlocks in a 3-tier environment you should specify mts_max_servers as 1.2 * Number of active Axapta sessions. If you have 500 concurrent Axapta sessions, then you should specify mts_max_servers to be 600.
instance_name :  Name of the instance. Default value is the instance’s SID. NB! Due to a bug in Oracle 8.1.7 you must specify this parameter in order to run multithreaded server.

2. Start of multithreaded database environment

After you has changed the Oracle initialization parameters in your init.ora file, then you must bounce the database (shutdown and start again). This you have to do to let the dispatcher processes be registered by the listener process and thereby start the database as multithreaded. When running a multithreaded database you must always start the listener processes before you start the database. If the database is started before the listener, then the database will start the dispatcher processes, but because the listener don’t know their existence the database will run as a dedicated server.

Check in your alert log for your database that the dispatchers has started. Just after the start banners of the database and non-default system parameters you should find 2 lines looking something like this:

starting up 5 shared server(s) …

starting up 2 dispatcher(s) for network address ‘(ADDRESS=(PARTIAL=YES)(PROTOCOL=tcp))’…

To make sure that the listener has registered the dispatcher processes correctly start the listener control utility and list services supported by the listener (bold text indicates the commands you have to execute):

C:\>lsnrctl

LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 – Production on 14-MAY-2001 12:37:27

(c) Copyright 1998 Oracle Corporation. All rights reserved.

Welcome to LSNRCTL, type “help” for information.

LSNRCTL> set password oracle

The command completed successfully

LSNRCTL> services

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wk0-kma-dev-nt4)(PORT=1

21)))

Services Summary…

AXDB has 3 service handler(s)

DEDICATED SERVER established:0 refused:0

LOCAL SERVER

DISPATCHER established:0 refused:0 current:0 max:1022 state:ready

D001 <machine: WK0-KMA-DEV-NT4, pid: 338>

(ADDRESS=(PROTOCOL=tcp)(HOST=wk0-kma-dev-nt4.intern.dd.dk)(PORT=1196))

DISPATCHER established:0 refused:0 current:0 max:1022 state:ready

D000 <machine: WK0-KMA-DEV-NT4, pid: 337>

(ADDRESS=(PROTOCOL=tcp)(HOST=wk0-kma-dev-nt4.intern.dd.dk)(PORT=1195))

The command completed successfully

In the case above is the listener named “listener” (the default value) and there is no database explicit specified in the listener SID_LIST_<listener> in the listener.ora file.

To check that the connection is established in shared mode you can query services again and check if the established counter for one of the dispatchers has been increased.
The listener.ora file used in the above shown example look like:

# LISTENER.ORA Network Configuration File: D:\ORACLE\NETWORK\ADMIN\listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = wk0-kma-dev-nt4)(PORT = 1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = WK0KMA))

)

)

PASSWORDS_LISTENER= (oracle)

From Axapta point of view you don’t have to change anything to utilize the new setup at the database unless you for some reason wants to connect to the database in dedicated mode. To do so you have make a new entry in your tnsnames.ora file where you (SERVER=DEDICATED) in your CONNECT_DATA section for that entry.

AXDBTCP.WORLD = (DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(Host = dbserver)(Port = 1521))

)

(CONNECT_DATA = (SID = AXDB)(SERVER=DEDICATED))

)

Be aware that for Oracle databases running on a Windows server is TCP/IP the only supported protocol for multithreaded connections.

Como contabilizar facturas de clientes o proveedores sin usar secuencias numericas

Filed under:3.0,axapta,desarrollo,x++ — posted by admin on April 7, 2008 @ 3:31 am

Buenas a todas y a todos. Por regla general las secuencias de facturación suelen configurarse y no dar problemas, pero en el caso que nos ocupa tenemos una multinacional que utiliza unos terminales de venta para generar facturas y albaranes etc, con numeraciones propias y esto hay que trasladarlo al AX con el minimo de problemas y de accesos a base de datos.

Nada de soluciones Salomónicas de update a “cholones” contra la custinvoicejour y cosas así que se os ve la pinta de “programatas” de medio pelo salidos de la vieja escuela del “clipper 5″, ahora el famoso “Delfi 6″. (jejejejej)

Bueno lo dicho aquí va el código para contabilizar facturas o albaranes con la numeración que queramos sin que el estándar de deje de chutar.

protected void insertJournal()
{;
ttsbegin;

numberSeq = this.allocateNumAndVoucher();
//axl numero de factura..
if (salesParmUpdate.invoiceid != ”)
{
number = salesParmUpdate.invoiceid;
numberSeq.parmNumberSequenceCode(”);
ttsbegin;
voucher = numberSeq.voucher();
ttscommit;
}
else
{
[number, voucher] = this.getNumAndVoucher();
}

if (this.updateNow())
{
this.postUpdate();

TransactionLog::create(this.transactionLogType(),this.transactionLogTxt());
ttscommit;
}
else
throw error(strFmt(“@SYS21533″));
}

Tan solo hay que sobre escribir el método insertjournal de la salesformletter


next page


image: detail of installation by Bronwyn Lace