Monday, 20 October 2014

while Importting Ax 2012 r3 contoso data Error

while Importting Ax 2012 r3 contoso data  Error

Unhandled Exception: System.NotSupportedException: The given path's format is no
t supported.
   at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boo
lean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[
] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, AccessControlActions control, String[] pathListOrig, Boolean check
ForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFul
lPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String origina
lUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`
1 resultHandler, Boolean checkHost)
   at System.IO.Directory.InternalGetFileDirectoryNames(String path, String user
PathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, S
earchOption searchOption, Boolean checkHost)
   at System.IO.Directory.InternalGetFiles(String path, String searchPattern, Se
archOption searchOption)
   at Microsoft.Dynamics.AX.Dataport.SqlHelper.GetDifferentialTableNames(Datapor
tDatabase db, String directory) in e:\bt\110700\Source\DataPort\Dataport\Library
\SqlHelper.cs:line 721
   at DP.Program.Execute(String currentDirectory, DataportDirection direction, S
tring directory, String database, String server, DataportAction action) in e:\bt
\110700\Source\DataPort\DP\Program.cs:line 183
   at DP.Program.Main(String[] args) in e:\bt\110700\Source\DataPort\DP\Program.
cs:line 82


solution : Give the read ,write and DB-owner access of database.

Tuesday, 14 October 2014

Dynamics Ax or D365 F & O SSRS Reports Error

Publish-AXReport : An error occurred : The network path was not found.
If User Account Control (UAC) is enabled on the machine, close the
application, right-click the application, and then click Run  as administrator.
At line:1 char:1
+ Publish-AXReport -ReportName *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Dynam...erConfigura
   tion:VerifyReportServerConfiguration) [Publish-AXReport], InvalidOperation
  Exception
    + FullyQualifiedErrorId : An error occurred : The network path was not fou
   nd.
    If User Account Control (UAC) is enabled on the machine, close the applica
   tion, right-click the application, and then click Run as administrator.,Mi
  crosoft.Dynamics.AX.Framework.Management.Reports.PublishReportCommand

Publish-AXReport : The deployment was aborted. You do not have privileges to
deploy to server: ignblr-pothuraj. For deployment, you must have
administrative rights to the SQL Server Reporting Services (SSRS) server.
Contact your administrator to deploy.
At line:1 char:1
+ Publish-AXReport -ReportName *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (Microsoft.Dynam...ReportsDeploye
   r:ReportsDeployer) [Publish-AXReport], SecurityException
    + FullyQualifiedErrorId : The deployment was aborted. You do not have priv
   ileges to deploy to server: ignblr-pothuraj. For deployment, you must have
   administrative rights to the SQL Server Reporting Services (SSRS) server.
  Contact your administrator to deploy.,Microsoft.Dynamics.AX.Framework.Man
agement.Reports.PublishReportCommand



Solution :
Remote Registry”-service is not enabled by default. After enabling and starting the service via Start -> Administrative Tools -> Services deployment of
 AX 2012 default SRS reports was successful. I suggest changing Start type from Manually to Automatic.




Friday, 10 October 2014

commands for Compilation of Ax2012 R3

 the Bellow commands for Compilation of Ax2012 R3

Open the command prompt  Run as Administrator

C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAXR3\bin\
  axbuild.exe  xppcompileall  /s=01
     /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"


CD  C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAXR3\bin

above the installation of file path.

Cd   axbuild.exe  xppcompileall  /s=01
     /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"


Thursday, 9 October 2014

Date Range query(From date ...Todate ) on MS Dynamics Ax using x++ code

 
    Query                   q;
    QueryBuildDataSource    qbd;
    QueryBuildRange         qbr,qbr1;

   // ret = super();

    q = new Query();
    qbd = q.addDataSource(TableNum( RateLine));
    qbr = qbd.addRange(FieldNum( RateLine, StartDate));
    qbr1 = qbd.addRange(FieldNum( RateLine, InflationTypeID));
    qbr1.value(InflationRate_Type.valueStr());
    qbr.value(strfmt('"%1".."%2"',FromDate.dateValue(), editEndDateRange.dateValue()));
    RateLine_ds.query(q);
    RateLine_ds.executeQuery();

Wednesday, 24 September 2014

How to Import XML file Through X++ coding , SalesOrder XML file How to Import using X++ code

static void SalesOrderCreatandInvoice(Args _args)
{
    RetailTransactionService    RetailTransactionService;
    str   dc;

    XmlDocument doc;
    XmlNodeList data;
    XmlElement nodeTable;
    XmlElement nodeAccount;
    XmlElement nodeName;
    #define.filename(@'C:\Temp\CreateCustomerOrder.xml')
    doc = XmlDocument::newFile(#filename);
    doc.load(@'C:\Temp\CreateCustomerOrder.xml');
   // dc = any2str(doc.lo);

    RetailTransactionService::createCustomerOrder(doc.toString());
}



XML file:

Customer Order / SalesOrder file .

<CustomerOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <AutoPickOrder>false</AutoPickOrder>
  <TransactionId>0000000296</TransactionId>
  <OrderType>SalesOrder</OrderType>
  <Status>0</Status>
  <DocumentStatus>0</DocumentStatus>
  <CustomerAccount>2002</CustomerAccount>
  <AddressRecord>22565427550</AddressRecord>
  <InventLocationId>BOSTON</InventLocationId>
  <StoreId>BOSTON</StoreId>
  <TerminalId>BOSTON-1</TerminalId>
  <TotalManualDiscountAmount>0</TotalManualDiscountAmount>
  <TotalManualDiscountPercentage>0</TotalManualDiscountPercentage>
  <ExpiryDate>2014-09-10</ExpiryDate>
  <HourOfDay>16</HourOfDay>
  <DeliveryMode>60</DeliveryMode>
  <RequestedDeliveryDate>2014-08-11</RequestedDeliveryDate>
  <Comment />
  <PrepaymentAmountOverridden>false</PrepaymentAmountOverridden>
  <PrepaymentAmountApplied>95.61</PrepaymentAmountApplied>
  <PreviouslyInvoicedAmount>0</PreviouslyInvoicedAmount>
  <SalespersonStaffId>000137</SalespersonStaffId>
  <CurrencyCode>USD</CurrencyCode>
  <LoyaltyCardId />
  <HasLoyaltyPayment>false</HasLoyaltyPayment>
  <ChannelReferenceId>STONON-1300001</ChannelReferenceId>
  <Email>marykay@contoso.com</Email>
  <Items>
    <Item ItemId="0061" RecId="0" Quantity="1" QuantityPicked="0" Unit="ea" Price="24.9900000000000000" Discount="0" DiscountPercent="0" NetAmount="24.99" Comment="" TaxGroup="MA" TaxItemGroup="RP" SalesMarkup="0" Status="0" InventLocationId="BOSTON" DeliveryMode="60" RequestedDeliveryDate="2014-08-11" AddressRecord="22565427550" BatchId="" SerialId="" VariantId="" LineDscAmount="0" PeriodicDiscount="0" PeriodicPercentageDiscount="0" LineManualDiscountAmount="0" LineManualDiscountPercentage="0" TotalDiscount="0" TotalPctDiscount="0" IgnDeliveryTime="00:00:00">
      <Charges />
      <Discounts />
      <Salespersons>
        <Salesperson SalespersonId="000100" SalespersonName="Josh Edwards" />
        <Salesperson SalespersonId="000155" SalespersonName="Renata Krausova" />
      </Salespersons>
    </Item>
    <Item ItemId="0066" RecId="0" Quantity="1" QuantityPicked="0" Unit="ea" Price="74.9900000000000000" Discount="0" DiscountPercent="0" NetAmount="74.99" Comment="" TaxGroup="MA" TaxItemGroup="RP" SalesMarkup="0" Status="0" InventLocationId="BOSTON" DeliveryMode="60" RequestedDeliveryDate="2014-08-11" AddressRecord="22565427550" BatchId="" SerialId="" VariantId="" LineDscAmount="0" PeriodicDiscount="0" PeriodicPercentageDiscount="0" LineManualDiscountAmount="0" LineManualDiscountPercentage="0" TotalDiscount="0" TotalPctDiscount="0" IgnDeliveryTime="00:00:00">
      <Charges />
      <Discounts />
      <Salespersons>
        <Salesperson SalespersonId="000110" SalespersonName="Dan Park" />
        <Salesperson SalespersonId="000111" SalespersonName="Patrick Elliot" />
        <Salesperson SalespersonId="000120" SalespersonName="Andrew Lan" />
        <Salesperson SalespersonId="000137" SalespersonName="Emma Harris" />
      </Salespersons>
    </Item>
  </Items>
  <Charges />
  <Payments>
    <Payment PaymentType="1" Amount="10.62" Currency="" Prepayment="false" />
  </Payments>
  <Affiliations />
</CustomerOrder>

Thursday, 18 September 2014

getting buf2Buf by using x++ coding

This method takes two table buffers (from and To) as the parameter and copies the value from the Form Table Buffer to the To Table Buffer.

static void buf2BufByName(Common  _from, Common  _to)
{
    DictTable   dictTableFrom   = new DictTable(_from.TableId);
    DictTable   dictTableTo     = new DictTable(_to.TableId);
    DictField   dictFieldFrom;
    FieldId     fieldIdFrom     = dictTableFrom.fieldNext(0);
    FieldId     fieldIdTo
    ;

    while (fieldIdFrom && ! isSysId(fieldIdFrom))
    {
        dictFieldFrom   = new DictField(_from.TableId, fieldIdFrom);
        if(dictFieldFrom)
        {
            fieldIdTo = dictTableTo.fieldName2Id(dictFieldFrom.name());
           // info(dictFieldFrom.name());

            if(fieldIdTo)
                _to.(fieldIdTo) = _from.(fieldIdFrom);
        }
        fieldIdFrom = dictTableFrom.fieldNext(fieldIdFrom);
    }
}
 

Thursday, 11 September 2014

Lookup method in Ax 2012 R3 using X++ code


Custom lookup method in ax 2012 R3 using X++ code

client server public static void lookup(FormControl  _formControl)
{
 SysTableLookup sysTableLookup;
 Query   query;
 QueryBuildDataSource qbd;
 RetailStoreTable  retailStoreTable;
 RetailChannelTable  retailChannelTable;
 TmpLegalentitywisestore TmpLegalentitywisestore;
 OMOperatingUnit   OMOperatingUnit;


  // This collection will store the records that must be inserted into the database
 RecordInsertList CurrCompanyToBeInserted = new RecordInsertList(tableNum(TmpLegalentitywisestore));
 delete_from TmpLegalentitywisestore;

while select retailChannelTable where retailChannelTable.inventLocationDataAreaId == curext()
join retailStoreTable where retailStoreTable.RecId == retailChannelTable.RecId
join OMOperatingUnit where OMOperatingUnit.RecId == retailChannelTable.OMOperatingUnitID
 {
 TmpLegalentitywisestore.StoreID = retailStoreTable.StoreNumber;
 TmpLegalentitywisestore.Name = OMOperatingUnit.Name;
 CurrCompanyToBeInserted.add(TmpLegalentitywisestore); // it to the RecordInsertList array
}

 CurrCompanyToBeInserted.insertDatabase(); // read to execute the insert operation
 sysTableLookup = SysTableLookup::newParameters(tablenum(TmpLegalentitywisestore), _formcontrol);
 query = new Query();
 qbd = query.addDataSource(tablenum(TmpLegalentitywisestore));
// add the fields to the lookup list
 sysTableLookup.addLookupfield(fieldnum(TmpLegalentitywisestore,storeid));
 sysTableLookup.addLookupfield(fieldnum(TmpLegalentitywisestore,Name));
 sysTableLookup.parmQuery(query);
 sysTableLookup.performFormLookup();

 }

call this method on form data source.>> field >>Lookup method
public void lookup(FormControl _formControl, str _filterStr)
{
     IgnTmpLegalentitywisestore::lookup(_formControl);
}




 
 
 

Tuesday, 9 September 2014

Default finance dimensions In Ax 2012 R3 using X++ code

How to create Default finance dimensions  in Ax 2012 R3 using x++ code

create a new field on your table like table name Invent location
fieldType : Int64
Name : STBDefaultDimension

//On form
create new tab like named :TabSTBFinancialDimensions

class declaration

DimensionDefaultingController dimensionDefaultingController; // <pvk>
init method
 // <pvk>
    dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(true, true, true, 0, this, TabSTBFinancialDimensions, "@SYS138487");
    dimensionDefaultingController.parmAttributeValueSetDataSource(inventLocation_ds, fieldStr(InventLOcation, STBDefaultDimension));
 // </PVK>
add methods on form>>datasource level
public void delete()
{
    super();
    dimensionDefaultingController.deleted();
}
public void write()
{
  
    dimensionDefaultingController.writing(); // <pvk>
    super();
}

public int active()
{
    int ret;
    ret = super();
    dimensionDefaultingController.activated(); // <pvk>
    return ret;
}

public void pageActivated()
{
    dimensionDefaultingController.pageActivated();
    super();
}