Monday, January 16, 2017

Reversing Number sequence Ax 2012

public void revSequenceByOne(ItemGroupId _groupId)

{
          NumberSequenceTable     numberSeqTableRev,numberSeqLastRec;
          InventItemGroup         invItemGroup;
          str                     autonumber;
    
          ttsBegin;
          invItemGroup = InventItemGroup::find(_groupId);
    
          if (invItemGroup && invItemGroup.NumberSequenceCode)
          {
              autonumber = invItemGroup.NumberSequenceCode;
              numberSeqTableRev      = NumberSequenceTable::findByNaturalKey(autonumber);
    
              select forUpdate firstOnly numberSeqLastRec
                  where numberSeqLastRec.RecId == numberSeqTableRev.RecId;
              if (numberSeqLastRec.RecId && numberSeqLastRec.NextRec != 1)
              {
                 numberSeqLastRec.NextRec -= 1;
                 numberSeqLastRec.update();
              }
          }
          ttsCommit;
}

On Hand Opening Qty for item wise and dimension Wise by date

Onhand Opening Qty

// Opening Qty for item wise and dimension Wise

enable flag in InventDimParm

Class -->InventSumFinancial
Class--> InventSettlement

static void Fcc_OnhandOpenQTyTest(Args _args)
{
    InventDim           inventDimSum;
    InventDimParm       inventDimParm;
    InventSum           inventSum;
    InventSumFinancial  inventSumFinancial;
    TransDate           Start = mkDate(1,1,2016);
    Qty                 balanceQty;
    Amount              totalBal;
    Amount              amount;
    ;
   
    inventDimParm.ItemIdFlag            = NoYes::Yes;
    inventDimParm.InventLocationIdFlag  = NoYes::Yes;
    inventDimParm.InventSiteIdFlag  = NoYes::Yes;
    while select inventSum
            where inventSum.ItemId == "CW-AR-PCB-4CX25MM"
    {
        inventDimSum = inventSum.inventDim();
        inventSumFinancial                  = InventSumFinancial::newSumReport(Start-1, inventSum, inventDimSum, inventDimParm);
        balanceQty                          = inventSumFinancial.qty(); // on hand Physical Qty
        totalBal                            = inventSumFinancial.value(); // On Hand Financial COst Amount Posted
        amount = InventSettlement::dateCostAmountAdjustment(Start -1 ,inventSum.ItemId,inventDimSum,inventDimParm); // Cost Amount Adjustment
        info(strFmt("%1,%2,  %3,%4,%5",inventSum.ItemId,balanceQty,totalBal,inventSum.costPricePcs(),amount));
    }
}

Customize field in LedgerJournalTable/Trans flow to GL posted Record (Ex: generalJournalAccountEntry)


// Customize field in LedgerJournalTable/Trans
 flow to GL posted Record (Ex: generalJournalAccountEntry)

// Ledger Transaction
1) Create New field in Both GeneralJournalAccountEntry and LedgerJournalTrans/ledgerjournalTable
   and also in LedgerPostingTransactionTmp // Standard Tmp Table for GL posting Purpose
2) Declare Newly created field in Class --> LedgerVoucherOject
3) Create New Parm method for new field in Class --> LedgerVoucherObject
   sample method Code Ex
   public RegNo parmRegNo(RegNo _RegNo = RegNo) 
   { 
    RegNo = _RegNo; 
    return RegNo; 
   }
4) Declare Newly created field in Class --> LedgerVoucherTransOject
5) Create New Parm method for new field in Class --> LedgerVoucherTransOject
   Sample method Code Ex
   public RegNo parmRegNo(RegNo _RegNo = RegNo) 
   { 
    generalJournalAccountEntry.RegNo  = _RegNo; 
    return generalJournalAccountEntry.RegNo ; 
   }
6) Add code in method Class --> LedgerVOucherTransObject/getLedgerPostingTransaction
   Sample Code Ex
   ledgerPostingTransaction.RegNo = generalJournalAccountEntry.RegNo
7) Add code in method Class --> LedgerVOucherTransObject/initFromLedgerPostingTransactoin
   Sample Code Ex
   generalJournalAccountEntry.RegNo = _LedgerPostingTransaction.RegNo;
8) Add code in method Class --> LedgerVOucherTransObject/newTransLedgerJournal
   Sample Code Ex // here Std input buffer is journalTrans
   ledgerTransObject.parmRegNo("your field name from Master");

// Cust / vend / Bank Account Transaction Ledger with GeneralJournalEntry
1) Create New field in Both GeneralJournalAccountEntry and Cust/vend/Bank Transaction
2) Map --> CustVendTrans ( map newly created Field in AOT Map)
3) Class-->CustVendVoucher for Cust/vend Transaction
   Class--> BankVoucher for Bank Account Transaction
4) Declare Newly created field in Class
5) Create New Parm Method in class
   sample method Code Ex
   public RegNo parmRegNo(RegNo _RegNo = RegNo) 
   { 
    RegNo = _RegNo; 
    return RegNo; 
   }
6) Add Param Method in class--> ledgerVoucherTransObject
7) Add code in Class-->CustVendVoucher/initCustVendTrans
   custVendTrans.RegNo = RegNo;
8) For Customer/Vendor  Add Code in Class -->CustVendVoucher/Post
   For Bank Add Code in Class -->BankVoucher/Post
   ledgerVoucherTransObject.parmRegNo((RegNo);
9) For Cust Transaction Class-->CustVoucher/newCustVoucherJournal
   For Vendor Transaction Class--> VendVoucher/newVendVoucherJournal
   For Bank Account Transaction Class --> BankVoucher/createBankAccountTrans
   Sample Method Code Ex
   custVoucher.parmRegNo(RegNo);

SSRS Report Timeout issue ax 2012

//SSRS Timeout issue ax 2012


Source;

http://axmentor.com/learning-lab/blog/reporting/how-to-fix-ssrs-timeouts-in-ax-2012-the-right-way/

Shrinking DB


//Shrinking DB

USE MicrosoftDynamicsAX;
ALTER DATABASE MicrosoftDynamicsAX
SET RECOVERY SIMPLE;
DBCC SHRINKFILE (MicrosoftDynamicsAX_Log, 0);
ALTER DATABASE MicrosoftDynamicsAX
SET RECOVERY FULL;

Hiding Parameter in UI builder ax 2012 from Controller class caller


//Hiding Parameter in UI builder ax 2012 based on Controller caller class


if (this.controller().parmArgs().menuitemName() == #yourMenuItemName)
     {
           grp.visible(false);
     }

Inventory Posting Profile Upload in ax 2012


//Inventory Posting Profile ax 2012

1) Inventory Sales Posting Profile data
//Format 1.ItemgroupId,2.SOIssue,3.SOConsumption,4.SORevenue
static void ImportSalesPosting(Args _args)
{
    SysExcelApplication     application;
    SysExcelWorkbooks       workbooks;
    SysExcelWorkbook        workbook;
    SysExcelWorksheets      worksheets;
    SysExcelWorksheet       worksheet;
    SysExcelCells           cells;
    COMVariantType          type;
    int                     row = 2;
    InventPosting           inventPosting;
    ItemGroupId             itemGroupId;
    MainAccountNum          salesOrderIssue, salesOrderConsumption, salesOrderRevenue;
    ;
    application =   SysExcelApplication::construct();
    workbooks   =   application.workbooks();
    try
    {
        workbooks.open(@"filename");
    }
    catch(Exception::Error)
    {
        throw error("File not found");
    }
    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
    try
    {
        ttsBegin;
        do
        {
            itemGroupId = cells.item(row, 1).value().bStr();
            salesOrderIssue = cells.item(row, 3).value().bStr();
            salesOrderConsumption = cells.item(row, 4).value().bStr();
            salesOrderRevenue = cells.item(row, 5).value().bStr();

            if (salesOrderIssue)
            {
                try
                {
                    // sales issue
                    inventPosting.InventAccountType = InventAccountType::SalesIssue;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(salesOrderIssue).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, salesOrderIssue));
                }
            }
            if (salesOrderConsumption)
            {
                try
                {
                    // sales order consumption
                    inventPosting.InventAccountType = InventAccountType::SalesConsump;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(salesOrderConsumption).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, salesOrderConsumption));
                }
            }
            if (salesOrderRevenue)
            {
                try
                {
                    // sales order revenue
                    inventPosting.InventAccountType = InventAccountType::SalesRevenue;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(salesOrderRevenue).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, salesOrderRevenue));
                }
            }
            row ++;
            type = cells.item(row, 1).value().variantType();
        }
        while (type != COMVariantType::VT_EMPTY);
        ttsCommit;
    }
    catch
    {
        application.quit();
        throw error(strFmt("%1 Line Error", row));
    }
    application.quit();
    info("Import completed");
}

-------------------------------------------------------------------------------------------------------------------------------

2) Inventory Purchase Posting  Profile Data
//Format 1.ItemgroupId,2.prodReciptAcc,3.PurchExpUnInvoicedAcc,4.PurchInvReceiptAcc,5.PurchExpProdAcc,6.purchAccrualAcc
static void ImportPurchasePosting(Args _args)
{
    SysExcelApplication     application;
    SysExcelWorkbooks       workbooks;
    SysExcelWorkbook        workbook;
    SysExcelWorksheets      worksheets;
    SysExcelWorksheet       worksheet;
    SysExcelCells           cells;
    COMVariantType          type;
    int                     row = 2;
    InventPosting           inventPosting;
    ItemGroupId             itemGroupId;
    MainAccountNum          productReceiptAccount, purchaseExpenditureUnInvoicedAccount, purchaseInventoryReceiptAccount,    purchaseExpenditureProductAccount,    purchaseAccrualAccount;
    ;
    application =   SysExcelApplication::construct();
    workbooks   =   application.workbooks();
    try
    {
        workbooks.open(@"filename");
    }
    catch(Exception::Error)
    {
        throw error("File not found");
    }
    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
    try
    {
        ttsBegin;
        do
        {
            itemGroupId = cells.item(row, 1).value().bStr();
            productReceiptAccount = cells.item(row, 3).value().bStr();
            purchaseExpenditureUnInvoicedAccount = cells.item(row, 4).value().bStr();
            purchaseInventoryReceiptAccount = cells.item(row, 5).value().bStr();
            purchaseExpenditureProductAccount = cells.item(row, 6).value().bStr();
            purchaseAccrualAccount = cells.item(row, 7).value().bStr();
            if (productReceiptAccount)
            {
                try
                {
                    // product receipt
                    inventPosting.InventAccountType = InventAccountType::PurchPackingSlip;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(productReceiptAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, productReceiptAccount));
                }
            }
            if (purchaseExpenditureUnInvoicedAccount)
            {
                try
                {
                    // purchase expenditure unInvoiced
                    inventPosting.InventAccountType = InventAccountType::PurchPackingSlipOffsetAccount;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(purchaseExpenditureUnInvoicedAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, purchaseExpenditureUnInvoicedAccount));
                }
            }
            if (purchaseInventoryReceiptAccount)
            {
                try
                {
                    // purchase inventory receipt
                    inventPosting.InventAccountType = InventAccountType::PurchReceipt;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(purchaseInventoryReceiptAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, purchaseInventoryReceiptAccount));
                }
            }
            if (purchaseExpenditureProductAccount)
            {
                try
                {
                    // purchase expenditure product
                    inventPosting.InventAccountType = InventAccountType::PurchConsump;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(purchaseExpenditureProductAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, purchaseExpenditureProductAccount));
                }
            }
            if (purchaseExpenditureProductAccount)
            {
                try
                {
                    // purchase accrual
                    inventPosting.InventAccountType = InventAccountType::PurchPackingSlipPurchaseOffsetAccount;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(purchaseExpenditureProductAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, purchaseExpenditureProductAccount));
                }
            }
            row ++;
            type = cells.item(row, 1).value().variantType();
        }
        while (type != COMVariantType::VT_EMPTY);
        ttsCommit;
    }
    catch
    {
        application.quit();
        throw error(strFmt("%1 Line Error", row));
    }
    application.quit();
    info("Import completed");
}

----------------------------------------------------------------------------------------------------------------------------

3) //Inventory Invent posting ProfileData
static void ImportInventoryPosting(Args _args)
{
    SysExcelApplication     application;
    SysExcelWorkbooks       workbooks;
    SysExcelWorkbook        workbook;
    SysExcelWorksheets      worksheets;
    SysExcelWorksheet       worksheet;
    SysExcelCells           cells;
    COMVariantType          type;
    int                     row = 2;
    InventPosting           inventPosting;
    ItemGroupId             itemGroupId;
    MainAccountNum          inventoryIssueAccount, inventoryLossAccount, inventoryReceiptAccount, inventoryProfitAccount;
    ;
    application =   SysExcelApplication::construct();
    workbooks   =   application.workbooks();
    try
    {
        workbooks.open(@"filename");
    }
    catch(Exception::Error)
    {
        throw error("File not found");
    }
    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
    try
    {
        ttsBegin;
        do
        {
            itemGroupId = cells.item(row, 1).value().bStr();
            inventoryIssueAccount = cells.item(row, 3).value().bStr();
            inventoryIssueAccount = strReplace(inventoryIssueAccount, "~", "");
            inventoryLossAccount = cells.item(row, 4).value().bStr();
            inventoryLossAccount = strReplace(inventoryLossAccount, "~", "");
            inventoryReceiptAccount = cells.item(row, 5).value().bStr();
            inventoryReceiptAccount = strReplace(inventoryReceiptAccount, "~", "");
            inventoryProfitAccount = cells.item(row, 6).value().bStr();
            inventoryProfitAccount = strReplace(inventoryProfitAccount, "~", "");
            if (inventoryIssueAccount)
            {
                try
                {
                    // inventory issue
                    inventPosting.InventAccountType = InventAccountType::InventIssue;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(inventoryIssueAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, inventoryIssueAccount));
                }
            }
            if (inventoryLossAccount)
            {
                try
                {
                    // inventory loss
                    inventPosting.InventAccountType = InventAccountType::InventLoss;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(inventoryLossAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, inventoryLossAccount));
                }
            }
            if (inventoryReceiptAccount)
            {
                try
                {
                    // inventory receipt
                    inventPosting.InventAccountType = InventAccountType::InventReceipt;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(inventoryReceiptAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, inventoryReceiptAccount));
                }
            }
            if (inventoryProfitAccount)
            {
                try
                {
                    // inventory profit
                    inventPosting.InventAccountType = InventAccountType::InventProfit;
                    inventPosting.ItemCode = InventPostingItemCode::GroupId;
                    inventPosting.ItemRelation = itemGroupId;
                    inventPosting.CostCode = TableGroupAll::All;
                    inventPosting.LedgerDimension = DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(inventoryProfitAccount).RecId);
                    inventPosting.insert();
                }
                catch
                {
                    info(strFmt("Error: Item group: %1, Account: %2", itemGroupId, inventoryProfitAccount));
                }
            }
            row ++;
            type = cells.item(row, 1).value().variantType();
        }
        while (type != COMVariantType::VT_EMPTY);
        ttsCommit;
    }
    catch
    {
        application.quit();
        throw error(strFmt("%1 Line Error", row));
    }
    application.quit();
    info("Import completed");
}

Fixed Asset Posting Profile/Disposal (Sold/Scrap) Upload in ax 2012

static void ImportAssetPostingProfile(Args _args)
{
    CommaTextIO                 csvFile;
    container                   readCon;
    counter                     icount,inserted;
    Dialog                      dialog;
    DialogField                 dfFileName,dfFAName;
    FileName                    fileName;
    AssetLedger                 assetLedger;
    AssetLedgerAccounts         asseteLedgerAccounts;
    AssetTransType              AssetTransType;
    TableGroupAll               TableGroupAll;
     #File
    //Function to creation Ledger dimension
    LedgerDimensionDefaultAccount CreateLedgerDimension(MainAccountNum  _Account)
    {
        return DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(_Account).RecId);
    }
    ;
    //Template
    //1)Account Type,2)Value Model,3)Grouping,4)FA Number/Group,5)Main Accounts,6)Offset Account
    dialog = new Dialog("Pick CSV file for upload");
    dfFileName = dialog.addField(extendedTypeStr("FilenameOpen"));
    dfFAName = dialog.addField(extendedTypeStr("AssetPostingProfile"));
    dialog.filenameLookupFilter(["All files", #AllFiles]);
    if (dialog.run())
    {
        if(dfFAName.value() == "")
        {
            throw warning("Select any one of Asset POsting profile");
        }
        assetLedger = AssetLedger::find(dfFAName.value(),false);
        csvFile = new CommaTextIo(dfFileName.value(), 'r');
        csvFile.inFieldDelimiter(',');
        readCon = csvFile.read();
        ttsBegin;
        while(csvFile.status() == IO_Status::OK)
        {
            readCon = csvFile.read();
            if(readCon)
            {
                asseteLedgerAccounts.clear();
                asseteLedgerAccounts.BookId                 = conPeek(readCon,2);
                asseteLedgerAccounts.AccountCode            = str2enum(TableGroupAll,conPeek(readCon,3));
                asseteLedgerAccounts.PostingProfile         = assetLedger.PostingProfile;
                asseteLedgerAccounts.TransType              = str2enum(AssetTransType,conpeek(readCon,1));
                asseteLedgerAccounts.AccountRelation        = conPeek(readCon,4);
                asseteLedgerAccounts.LedgerDimension        = CreateLedgerDimension(any2str(conPeek(readCon,5)));
                asseteLedgerAccounts.OffsetLedgerDimension  = CreateLedgerDimension(any2str(conPeek(readCon,6)));                               
                asseteLedgerAccounts.insert();
                icount++;
            }
        }
        ttsCommit;
    }
    info("Import COmpleted");
}
//FA disposal
static void ImportAssetPPDisposal(Args _args)
{
    CommaTextIO                 csvFile;
    container                   readCon;
    counter                     icount,inserted;
    Dialog                      dialog;
    DialogField                 dfFileName,dfFAName,dfSoldScarp;
    FileName                    fileName;
    AssetDisposalParameters     disposalParameters;
    AssetLedger                 assetLedger;
    AssetLedgerAccounts         asseteLedgerAccounts;
    AssetPostValue              AssetPostValue;
    TableGroupAll               TableGroupAll;
    AssetSoldScrap              AssetSoldScrap;
    FormStringControl   control,Control1;
     #File
    //Function to creation Ledger dimension
    LedgerDimensionDefaultAccount CreateLedgerDimension(MainAccountNum  _Account)
    {
       return DimensionStorage::getDefaultAccount(MainAccount::findByMainAccountId(_Account).RecId);
    }
    ;
    //Template
    //1)Account Type,2)Value Model,3)Grouping,4)FA Number/Group,5)Main Accounts,6)Offset Account
    dialog = new Dialog("Pick CSV file for upload");
    dfFileName = dialog.addField(extendedTypeStr("FilenameOpen"));
    dfFAName = dialog.addField(extendedTypeStr("AssetPostingProfile"));
    control1 = dfFAName.fieldControl();
    control1.mandatory(true);
    dfSoldScarp = dialog.addField(enumStr(AssetSoldScrap));
    control = dfSoldScarp.fieldControl();
    control.mandatory(true);
    dialog.filenameLookupFilter(["All files", #AllFiles]);
    if (dialog.run())
    {
        if(dfFAName.value() == "")
        {
            throw warning("Select any one of Asset POsting profile");
        }
        assetLedger = AssetLedger::find(dfFAName.value(),false);
        csvFile = new CommaTextIo(dfFileName.value(), 'r');
        csvFile.inFieldDelimiter(',');
        readCon = csvFile.read();
        ttsBegin;
        while(csvFile.status() == IO_Status::OK)
        {
            readCon = csvFile.read();
            if(readCon)
            {
                disposalParameters.clear();
                disposalParameters.BookId                 = conPeek(readCon,2);
                disposalParameters.SoldScrap              = str2enum(AssetSoldScrap,dfSoldScarp.Value());
                disposalParameters.AssetCode              = str2enum(TableGroupAll,conPeek(readCon,3));
                disposalParameters.PostingProfile         = assetLedger.PostingProfile;
                disposalParameters.PostValue              = str2enum(AssetPostValue,conpeek(readCon,1));
                disposalParameters.AssetRelation          = conPeek(readCon,4);
                disposalParameters.LedgerDimension        = CreateLedgerDimension(any2str(conPeek(readCon,5)));
                disposalParameters.OffsetLedgerDimension  = CreateLedgerDimension(any2str(conPeek(readCon,6)));                               
                disposalParameters.ValueType              = AssetPostType::All;
                disposalParameters.insert();
                icount++;
            }
        }
        ttsCommit;
    }
    info("Import COmpleted");
}