static void MouliExcel(Args _args)
{
EmplTable EmplTableLocal;
SysExcelApplication excelApp;
SysExcelWorkSheet excelWorksheet;
SysExcelRange excelRange;
SysExcelCells excelCells;
SysExcelCell excelCell;
ComVariant cellValue;
Int i=1;
;
excelApp = SysExcelApplication::construct();
cellValue = new ComVariant() ;
excelApp.workbooks().add();
excelWorksheet = excelApp.worksheets().itemFromNum( 1 );
excelCells = excelWorksheet.cells();
while select * from EmplTableLocal
{
excelCells.item(i+4,4).value(cellValue.bStr(EmplTableLocal.EmplId));
excelCells.item(i+4,5).value(cellValue.bStr(EmplTableLocal.Name));
i++;
}
excelApp.visible(true);
//excelApp.quit();
}
Thursday, August 7, 2008
export a document to MS Word from axapta using X++
COM wordApplication;
COM wordDocuments;
COM wordDocument;
COM wordRange;
;
wordApplication = new COM("word.application");
wordApplication.visible(TRUE);
wordDocuments = wordApplication.Documents();
wordDocument = wordDocuments.add();
wordDocument.saveas("c:\\YourDocument.doc");
wordDocument.activate();
wordRange = wordDocument.range(0,0);
wordRange.insertafter("mouli);
wordRange = wordDocument.range(6,19);
wordRange = wordDocument.range(11,26);
wordRange.italic(true);
wordDocument.save();
wordDocument.close();
wordApplication.quit();
COM wordDocuments;
COM wordDocument;
COM wordRange;
;
wordApplication = new COM("word.application");
wordApplication.visible(TRUE);
wordDocuments = wordApplication.Documents();
wordDocument = wordDocuments.add();
wordDocument.saveas("c:\\YourDocument.doc");
wordDocument.activate();
wordRange = wordDocument.range(0,0);
wordRange.insertafter("mouli);
wordRange = wordDocument.range(6,19);
wordRange = wordDocument.range(11,26);
wordRange.italic(true);
wordDocument.save();
wordDocument.close();
wordApplication.quit();
sending Emails using X++ Code in Axapta
ysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
mailer.fromAddress('moulikaku@hotmail.com');
mailer.fromName('minnu@gmail.com');
mailer.subject('What are you doing tonite???');
if (parameters.DNSServerName)
{
mailer.DNSServers().add(parameters.DNSServerName,
parameters.DNSTCPIPRetryCount,
parameters.DNSUDPRetryCount);
}
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServers().add(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPServerIPAddress,
parameters.SMTPUserName,
parameters.SMTPPassword);
}
// Add your own code here, then send the message
======================================================
SysMailer mailer = new SysMailer();
mailer.body("My Body :)");
mailer.subject("WOW Baby");
mailer.fromAddress("minnu@anderson.com");
mailer.fromName("Peter Villadsen");
mailer.tos().add("moulikaku@gmail.com");
mailer.SMTPRelayServers().add("MyRelayServer");
mailer.sendMail();
======================================================
SysINetMail Mail=new SysINetMail() ;
Mail.sendMailAttach("minnu@gmail.com",
"mouli@gmail.com,
"WOW",
"My Body Text ;-)",
false,
"Attachment Path");
All the Best :-)
Publish Post
mouli
SysEmailParameters parameters = SysEmailParameters::find();
mailer.fromAddress('moulikaku@hotmail.com');
mailer.fromName('minnu@gmail.com');
mailer.subject('What are you doing tonite???');
if (parameters.DNSServerName)
{
mailer.DNSServers().add(parameters.DNSServerName,
parameters.DNSTCPIPRetryCount,
parameters.DNSUDPRetryCount);
}
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServers().add(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPServerIPAddress,
parameters.SMTPUserName,
parameters.SMTPPassword);
}
// Add your own code here, then send the message
======================================================
SysMailer mailer = new SysMailer();
mailer.body("My Body :)");
mailer.subject("WOW Baby");
mailer.fromAddress("minnu@anderson.com");
mailer.fromName("Peter Villadsen");
mailer.tos().add("moulikaku@gmail.com");
mailer.SMTPRelayServers().add("MyRelayServer");
mailer.sendMail();
======================================================
SysINetMail Mail=new SysINetMail() ;
Mail.sendMailAttach("minnu@gmail.com",
"mouli@gmail.com,
"WOW",
"My Body Text ;-)",
false,
"Attachment Path");
All the Best :-)
Publish Post
mouli
Upgrade from AX 3.0 , AX4.0 to AX 2009
The steps below provide a high-level overview of the tasks that you must complete to upgrade from Microsoft Dynamics AX 3.0 to Microsoft Dynamics AX 2009.
•Back up your existing database and application files.
•Import two .xpo files from the installation media to assist with data upgrade.
• UpgradeColumnList.xpo, for 32-bit to 64-bit RecId field conversion.
• LeftJustified.xpo, for removing any trailing spaces from fields.
* Note: To help improve performance, you can apply the LeftJustified.xpo on the database that you create in step 4 after you’ve used the Microsoft Dynamics AX DB Upgrade Preparation tool but before you start the Microsoft Dynamics AX 2009 AOS.
•(Optional) To help improve performance, remove all user data and logs of Microsoft Dynamics AX 3.0. For example, clean up the SysDatabaseLog table.
•Create an empty database for Microsoft Dynamics AX 2009 in SQL Server 2005.
•(Optional) To help improve performance, set initial data and log file sizes so that they don’t increase while you perform the data upgrade process.
•(Optional) To help improve performance, set the recovery model to Simple for the Microsoft Dynamics AX 2009 Database.
•Run AXDBUpgrade.exe (The Microsoft Dynamics AX DB Upgrade Preparation tool). Note: To help improve performance, you can run this tool in Multithreaded mode. For example, to run this tool in 10 threads, enter AxDbUpgrade.exe P/10 at a command prompt.
•(Optional) Apply the LeftJustify file imported in step 2 to the Microsoft Dynamics AX 2009 database created in step 4.
•Back up your Microsoft Dynamics AX database. Your database is ready to be upgraded. •Run the Microsoft Dynamics AX 2009 Setup file from the installation media. During installation, select the database that you created in step 4.
•Copy your upgraded customized file into the correct application directory.
•Start the AOS.
•Start the Microsoft Dynamics AX 2009 client. The Upgrade checklist is displayed automatically.
•Complete the steps in the Upgrade checklist to finish upgrading.
The steps below provide a high-level overview of the tasks that you must complete to upgrade from Microsoft Dynamics AX 4.0 to Microsoft Dynamics AX 2009.
- Back up your existing database and application files. - (Optional) To help improve performance, remove all user data and logs of Microsoft Dynamics AX 4.0. For example, clean up the SysDatabaseLog table.
- (Optional) To help improve performance, set initial data and log file sizes so that they don’t increase while you perform the data upgrade process.
- (Optional) To help improve performance, set the recovery model to Simple for the Microsoft Dynamics AX 2009 Database. - Back up your Microsoft Dynamics AX database. Your database is ready to be upgraded.
- Run the Microsoft Dynamics AX 2009 Setup file from the installation media. During installation, select your existing Microsoft Dynamics AX database.
- Start the Microsoft Dynamics AX 2009 client. The Upgrade checklist is displayed automatically.
- Complete the steps in the Upgrade checklist to finish upgrading.
Upgrading to Microsoft Dynamics AX 4.0 and Microsoft Dynamics AX 2009 -convergence session please check following link Click Here
•Back up your existing database and application files.
•Import two .xpo files from the installation media to assist with data upgrade.
• UpgradeColumnList.xpo, for 32-bit to 64-bit RecId field conversion.
• LeftJustified.xpo, for removing any trailing spaces from fields.
* Note: To help improve performance, you can apply the LeftJustified.xpo on the database that you create in step 4 after you’ve used the Microsoft Dynamics AX DB Upgrade Preparation tool but before you start the Microsoft Dynamics AX 2009 AOS.
•(Optional) To help improve performance, remove all user data and logs of Microsoft Dynamics AX 3.0. For example, clean up the SysDatabaseLog table.
•Create an empty database for Microsoft Dynamics AX 2009 in SQL Server 2005.
•(Optional) To help improve performance, set initial data and log file sizes so that they don’t increase while you perform the data upgrade process.
•(Optional) To help improve performance, set the recovery model to Simple for the Microsoft Dynamics AX 2009 Database.
•Run AXDBUpgrade.exe (The Microsoft Dynamics AX DB Upgrade Preparation tool). Note: To help improve performance, you can run this tool in Multithreaded mode. For example, to run this tool in 10 threads, enter AxDbUpgrade.exe P/10 at a command prompt.
•(Optional) Apply the LeftJustify file imported in step 2 to the Microsoft Dynamics AX 2009 database created in step 4.
•Back up your Microsoft Dynamics AX database. Your database is ready to be upgraded. •Run the Microsoft Dynamics AX 2009 Setup file from the installation media. During installation, select the database that you created in step 4.
•Copy your upgraded customized file into the correct application directory.
•Start the AOS.
•Start the Microsoft Dynamics AX 2009 client. The Upgrade checklist is displayed automatically.
•Complete the steps in the Upgrade checklist to finish upgrading.
The steps below provide a high-level overview of the tasks that you must complete to upgrade from Microsoft Dynamics AX 4.0 to Microsoft Dynamics AX 2009.
- Back up your existing database and application files. - (Optional) To help improve performance, remove all user data and logs of Microsoft Dynamics AX 4.0. For example, clean up the SysDatabaseLog table.
- (Optional) To help improve performance, set initial data and log file sizes so that they don’t increase while you perform the data upgrade process.
- (Optional) To help improve performance, set the recovery model to Simple for the Microsoft Dynamics AX 2009 Database. - Back up your Microsoft Dynamics AX database. Your database is ready to be upgraded.
- Run the Microsoft Dynamics AX 2009 Setup file from the installation media. During installation, select your existing Microsoft Dynamics AX database.
- Start the Microsoft Dynamics AX 2009 client. The Upgrade checklist is displayed automatically.
- Complete the steps in the Upgrade checklist to finish upgrading.
Upgrading to Microsoft Dynamics AX 4.0 and Microsoft Dynamics AX 2009 -convergence session please check following link Click Here
How to call Axapta methods from .net
Using .NET Business Connector, you can access Microsoft Dynamics AX data or business logic from a .NET-connected application.
To add a reference to .NET Business Connector
•Open Visual Studio.
•In Solution Explorer, right-click References and select Add Reference.
•In the Add Reference window, select the Browse tab.
•Specify the location of Microsoft.Dynamics.BusinessConnectorNet.dll, and then click Add.
Add code to call a Microsoft Dynamics AX method in Visual Studio C#.
using System;
using Microsoft.Axapta.BusinessConnector;
namespace AXMethodCall
{
class Class1
{
static void Main(string[] args)
{
// Create the .NET Business Connector objects.
Axapta ax;
object o;
bool b;
try
{
// Login to Microsoft Dynamics Ax.
ax = new Axapta();
ax.Logon(null, null, null, null);
}
catch (Exception e)
{
Console.WriteLine("An error occurred in object creation or Axapta logon: {0}", e.Message);
return;
}
// Logon was successful.
try
{
// Call a static class method.
o = ax.CallStaticClassMethod("Class Name ", "Method Name",Argument);
}
catch (Exception e)
{
Console.WriteLine("An error has been encountered during CallStaticClassMethod: {0}", e.Message);
b = ax.Logoff();
return;
}
// Log off from Microsoft Dynamics AX.
b = ax.Logoff();
}
}
}
To add a reference to .NET Business Connector
•Open Visual Studio.
•In Solution Explorer, right-click References and select Add Reference.
•In the Add Reference window, select the Browse tab.
•Specify the location of Microsoft.Dynamics.BusinessConnectorNet.dll, and then click Add.
Add code to call a Microsoft Dynamics AX method in Visual Studio C#.
using System;
using Microsoft.Axapta.BusinessConnector;
namespace AXMethodCall
{
class Class1
{
static void Main(string[] args)
{
// Create the .NET Business Connector objects.
Axapta ax;
object o;
bool b;
try
{
// Login to Microsoft Dynamics Ax.
ax = new Axapta();
ax.Logon(null, null, null, null);
}
catch (Exception e)
{
Console.WriteLine("An error occurred in object creation or Axapta logon: {0}", e.Message);
return;
}
// Logon was successful.
try
{
// Call a static class method.
o = ax.CallStaticClassMethod("Class Name ", "Method Name",Argument);
}
catch (Exception e)
{
Console.WriteLine("An error has been encountered during CallStaticClassMethod: {0}", e.Message);
b = ax.Logoff();
return;
}
// Log off from Microsoft Dynamics AX.
b = ax.Logoff();
}
}
}
Send Alert to user from code in AX 4.0
// To send Alert to User From Code
void sendAlertToUsers()
{
SysMailer mail;
UserInfo UserInfo;
EventInbox inbox;
EventInboxId inboxId;
;
select UserInfo where UserInfo.id == CurUserId();
inboxId = EventInbox::nextEventId();
inbox.initValue();
inbox.ShowPopup = NoYes::Yes; // To show Pop up
inbox.Subject = "Aleart Message Through Code";
inbox.Message = "Testing Alerts";
inbox.AlertedFor = "This alert is just for information(Testing)";
inbox.SendEmail = false;
inbox.UserId = UserInfo.Id;
inbox.TypeId = classnum(EventType);
//Enter Table and Field Details
inbox.AlertTableId = TableNum(EmplTable); // Table for which Alert is Generated
inbox.AlertFieldId = fieldNum(Empltable ,Name); // Field for which Alert is Generated
inbox.TypeTrigger = EventTypeTrigger::FieldChanged;
inbox.CompanyId = CurExt();
inbox.InboxId = inboxId;
inbox.AlertCreatedDate = systemdateget();
inbox.AlertCreateTime = timeNow();
inbox.insert();
}
void sendAlertToUsers()
{
SysMailer mail;
UserInfo UserInfo;
EventInbox inbox;
EventInboxId inboxId;
;
select UserInfo where UserInfo.id == CurUserId();
inboxId = EventInbox::nextEventId();
inbox.initValue();
inbox.ShowPopup = NoYes::Yes; // To show Pop up
inbox.Subject = "Aleart Message Through Code";
inbox.Message = "Testing Alerts";
inbox.AlertedFor = "This alert is just for information(Testing)";
inbox.SendEmail = false;
inbox.UserId = UserInfo.Id;
inbox.TypeId = classnum(EventType);
//Enter Table and Field Details
inbox.AlertTableId = TableNum(EmplTable); // Table for which Alert is Generated
inbox.AlertFieldId = fieldNum(Empltable ,Name); // Field for which Alert is Generated
inbox.TypeTrigger = EventTypeTrigger::FieldChanged;
inbox.CompanyId = CurExt();
inbox.InboxId = inboxId;
inbox.AlertCreatedDate = systemdateget();
inbox.AlertCreateTime = timeNow();
inbox.insert();
}
Subscribe to:
Posts (Atom)