Search This Blog

Thursday, May 31, 2012

AX2012 StrSplit Function with list Iterator in X++


May be this is useful for lot of persons while importing or exporting for splitting the string and get the string of the required position

private str strSplit(str _splitString,str _splitchar,int _pos)
{
    List strlist=new List(Types::String);
    ListIterator    iterator;
    container       packedList;
    ;
    strlist=strSplit(_splitString,_splitchar);
    iterator = new ListIterator(strlist);
    while(iterator.more())
    {
        packedList += iterator.value();
        iterator.next();
    }
    return conPeek(packedList,_pos);
}

To call you can use like following


str strvalue="Test|Test2|Test3|Test4";
info(createProduct.strSplit(strvalue,"|",2));

Wednesday, May 23, 2012

AX2012 QueryHavingFilter usage


In this Example I am showing how to QueryHavingfilter(New class in AX2012) class
Before seeing this post please see my previous post explains the QueryFilter Class
http://krishhdax.blogspot.com/2012/05/ax2012-query-filter-usage.html

If we want to get this following Query format from X++ then we can use the QueryHavingFilter class.
Select VendGroup,Count(*) from VendTable group by VendGroup having Count(*) >2


static void Krishh_HavingQueryFilter(Args _args)
{
    Query                   query;
    QueryBuildDataSource    datasource;
    QueryBuildRange         range;
    QueryHavingFilter       havingFilter;
    QueryRun                queryRun;
    int                     counter = 0, totalCounter = 0;
    VendTable               vendTable;
 
    query = new Query();
    datasource = query.addDataSource(tableNum(VendTable));
    datasource.addSelectionField(fieldNum(VendTable, RecId),
            SelectionField::Count);
    datasource.orderMode(OrderMode::GroupBy);
    datasource.addGroupByField(fieldNum(VendTable, Vendgroup));
 
    havingFilter = query.addHavingFilter(datasource, fieldStr(VendTable, RecId),
            AggregateFunction::Count);
    havingFilter.value('>2');
 
    queryRun = new QueryRun(query);
    while (queryRun.next())
    {
        vendTable = queryRun.getNo(1);
        info(strFmt("Group %1: %2", vendTable.VendGroup, vendTable.RecId));
    }
}

AX2012 Query Filter Usage


In this Example I am using QueryFilter(new class in AX2012 introduced), So I am using this class to filter the data accordingly which have the outerjoins and get the number of records in each table.

static void Krishh_QueryRangeFilter(Args _args)
{
    Query                   query;
    QueryBuildDataSource    datasource;
    QueryBuildRange         range;
    QueryFilter             filter;//new class in Ax2012
    QueryRun                queryRun;
     int                     counter = 0, totalCounter = 0;
 
    query = new Query();
    datasource = query.addDataSource(tableNum(ChangeOrderJournal));
    datasource = datasource.addDataSource(tableNum(ChangeOrderProduct));
    datasource.joinMode(JoinMode::OuterJoin);
    datasource.relations(true);
    datasource.addLink(fieldNum(ChangeOrderJournal, ChangeOrderNum),
            fieldNum(ChangeOrderProduct, ChangeOrderNum));

// initializes the filter for the specific field.
    filter = query.addQueryFilter(datasource, fieldStr(ChangeOrderProduct, PartNumber));
    filter.value("2-24-05902");

// this is the querybuildRange usage
 //range = datasource.addRange(fieldNum(ChangeOrderProduct ,   PartNumber));
 //range.value(SysQuery::value(' 2-24-05902 '));
 
    queryRun = new QueryRun(query);
    while (queryRun.next())
    {
        totalCounter++;
        if (queryRun.changed(tableNum(ChangeOrderProduct)))
            counter++;
    }
    info(strFmt("ChangeOrderProduct Counter: %1", counter));
}

Tuesday, May 22, 2012

AX2012 Date Ranges using Query Service




Before using this sample please refer this link that which I posted earlier.
http://krishhdax.blogspot.com/2012/02/ax2012-consume-query-service.html

public void krishh_QueryServiceDateRangeFilter()
   {
      QueryServiceClient client = new QueryServiceClient();
      DataSet dataSet;
      Paging paging = new ValueBasedPaging() { RecordLimit = 1000 };
      QueryMetadata query;
      QueryDataSourceMetadata employeeDataSource;
      QueryDataRangeMetadata employeeRange;
      query = new QueryMetadata();
      // Set the properties of the query.
      query.QueryType = QueryType.Join;
      query.DataSources = new QueryDataSourceMetadata[1];
      // Set the properties of the EmployeeDataSource
      employeeDataSource = new QueryDataSourceMetadata();
      employeeDataSource.Name = "Employee";
      employeeDataSource.Enabled = true;
      employeeDataSource.Table = "HcmEmployment";
      //This property will set for Dataset to Retrieve all fields
      employeeDataSource.DynamicFieldList = true;  
      // Add the data source to the query
      query.DataSources[0] = employeeDataSource;
      // filter for active employees only
      employeeRange = new QueryDataRangeMetadata();
      employeeRange.TableName = "HcmEmployment";
      employeeRange.FieldName = "ValidTo";
      employeeRange.Value = "31/12/2154 11:59 PM";
      employeeRange.Enabled = true;
      employeeDataSource.Ranges = new QueryDataRangeMetadata[1];
      employeeDataSource.Ranges[0] = employeeRange;
      // Exeucte the Query and load the data into the Dataset
      dataSet = client.ExecuteQuery(query, ref paging);
     // load your dataset to your grid or gridview.
    }

Monday, May 21, 2012

Ax2012 Validate XML and Show XML in form

The following sample job used to show any xml,XSLT,XSD schema in the form and validate that XML.



In this example I have the table with the xml value stored in it.
if you want to validate from file also we can do as well.


static void Krishh_LoadXmlform(Args _args)
{
    ChangeOrderSourceLog sourceLog;
    AifXmlViewer viewer;
    ;
    select firstOnly from sourceLog where sourceLog.changeOrdernum='3369';
    if(sourceLog )
   {

      // construct the AIFXMLViewer class object by the xml value and the type of the  XMLFile.
      viewer=AifXmlViewer::construct(sourceLog.ChangeOrderSourceXML,AifXmlType::XML);
       viewer.show();

   }
 
}

Wednesday, May 16, 2012

Ax2012 Import Fixed Assets Table


Following function is used to create the Assets into the Asset Table.

public void createAssetTable(
    AssetId                     _assetId
    , AssetGroupId              _assetGroupId
    , AssetName                 _assetName
    , AssetLocationId           _assetLocationId
    , Num                       _num
    , AssetType                 _assetType
    , AssetNameAlias            _assetNameAlias
    , AssetNotes                _assetNotes
    , AssetMajorTypeId          _assetMajorTypeId)
{
    AxAssetTable        axAssetTable;
    ;
    axAssetTable    = new AxAssetTable();
    axAssetTable.validateInput(true);

    axAssetTable.parmAssetId(_assetId);
    axAssetTable.parmAssetGroup(_assetGroupId ? _assetGroupId : assetGroupId);
    axAssetTable.parmName(_assetName);
    axAssetTable.parmLocation(_assetLocationId);
    axAssetTable.parmSerialNum(_num);
    axAssetTable.parmAssetType(_assetType);
    axAssetTable.parmNameAlias(_assetNameAlias);
    axAssetTable.parmNotes(_assetNotes);
    axAssetTable.parmMajorType(_assetMajorTypeId);

    axAssetTable.save();
}

// creates the Assets book

protected void CreateAssetBook(container _conLine)
{
    #Define.AssetId(1)
    #Define.BookId(2)
    #Define.PostingProfile(9)
    #Define.LifeTime(11)
    #Define.LifeTimeRest(12)
    #Define.DepreciationStartDate(16)
    #Define.LastDepreciationDate(18)
    #Define.AcquisitionDate(27)

    AssetBook               assetBook;
    AxAssetBook             axAssetBook                          =   AxAssetBook::construct();
    SysDictClass            sysDictClassAxAssetBook       =   new SysDictClass(classIdGet(AxAssetBook));
    ;

    assetBook   = AssetBook::find(this.getLineValue(_conLine, #AssetId), this.getLineValue(_conLine, #BookId), true);

    if(assetBook)
    {
        axAssetBook = AxAssetBook::newAssetBook(assetBook);

        // AssetId
        axAssetBook.parmAssetId(this.getLineValue(_conLine,#AssetId))

        // BookId
        axAssetBook.parmBookId(this.getLineValue(_conLine,#BookId));

        // PostingProfile
        axAssetBook.parmPostingProfile( this.getLineValue(_conLine, #PostingProfile) );

        // LifeTime
        axAssetBook.parmLifeTimes(str2num(this.getLineValue(_conLine,#LifeTime)));

        // LifeTimeRest
        axAssetBook.parmLifeTimeRest(str2num(this.getLineValue(_conLine,#LifeTimeRest)));

        // DepreciationStartDate
axAssetBook.parmDepreciationStartDate(str2date((this.getLineValue(_conLine,#DepreciationStartDate),123));
        // LastDepreciationDate
        axAssetBook.parmLastDepreciationDate(str2dat(this.getLineValue(_conLine,#LastDepreciationDate),123));

        // AcquisitionDate
        axAssetBook.parmAcquisitionDate(str2date(this.getLineValue(_conLine,#AcquisitionDate),123));

        axAssetBook.save();
    }
    else
    {
        throw error(strFmt(AssetBook::txtNotExist(), this.getLineValue(_conLine, #AssetId),  
                 this.getLineValue(_conLine, #BookId)));
    }
}

// gets the value from the container
protected anytype getLineValue(container    _conLine,
                               int          _columnNum,
                               Types        _valueType  =   Types::String,
                               EnumId       _enumId     =   0)
{
    str         strValue;
    anytype     anyTypeValue;
    DictEnum    dictEnum;

    strValue    =   conPeek(_conLine,
                            _columnNum);

    switch(_valueType)
    {
        case    Types::String       :

            anyTypeValue    =   strValue;
            break;

        case    Types::Integer      :

            if(strValue)
            {
                anyTypeValue    =   str2int(strValue);
            }
            else
            {
                anyTypeValue    =   0;
            }
            break;

        case    Types::Real         :

            if(strValue)
            {
                anyTypeValue    =   str2num(strValue);
            }
            else
            {
                anyTypeValue    =   0.00;
            }
            break;

        case    Types::Enum         :

            if(!_enumId)
            {
                throw error(strFmt("@SYS22828", funcName()));
            }

            dictEnum        =   new DictEnum(_enumId);

            if(!dictEnum)
            {
                throw error(strFmt("@SYS22828", funcName()));
            }

            if(strValue)
            {
                anyTypeValue    =   dictEnum.name2Value(strValue);
            }
            else
            {
                anyTypeValue    =   0;
            }
            break;

        case    Types::Date         :

            if(strValue)
            {
                anyTypeValue    =   str2date(strValue,123);
            }
            else
            {
                anyTypeValue    =   dateNull();
            }
            break;

        case    Types::UtcDateTime  :

            if(strValue)
            {
                anyTypeValue    =   DateTimeUtil::parse(strValue);
            }
            else
            {
                anyTypeValue    =   utcDateTimeNull();
            }
            break;

        default                     :

            throw error(strFmt("@SYS26908", _valueType));
    }

    return anyTypeValue;
}



AX2012 Import Fixes Assests journals


This class is used to load the fixed asset journal lines , before using this class you can write to read the data from the CSV and call the function called as createJournalLine(parameters)


When you run this batch you will get the dialog to select which journal number you want to insert into.


publi class krishh_FixedAssetsJournal extends RunBaseBatch
{
    LedgerJournalId         journalNum;
    DialogField                dlgJournalNum;

    LedgerJournalTable      ledgerJournalTable;
    Map                     voucherMap;

    #define.CurrentVersion(1)
    #localmacro.CurrentList
        journalNum
    #endmacro
}


public Object dialog(Dialog _dialog)
{
    ;
    _dialog = super(_dialog);
    _dialog.addGroup("Assets");
    dlgJournalNum         = _dialog.addFieldValue(extendedtypestr(LedgerJournalId), journalNum,"@SYS328705", "General journal that transactions will be imported to.");

    return _dialog;
}


private Voucher findCreateVoucher(Voucher _voucher)

{
    Voucher ret;
    ;
    if (!voucherMap.exists(_voucher))
    {
        ret = new JournalVoucherNum(JournalTableData::newTable(ledgerJournalTable)).getNew(false);
        voucherMap.insert(_voucher, ret);
    }
    else
    {
        ret = voucherMap.lookup(_voucher);
    }
    return ret;
}
public void findJournal()

{
    ;
    ledgerJournalTable  = LedgerJournalTable::find(JournalNum);
}



public boolean getFromDialog()
{
    ;
    journalNum       = dlgJournalNum.value();
    return super();
}



public void new()
{
    ;
  voucherMap = new Map(Types::String, Types::String);
}


public container pack()
{
    return [#CurrentVersion,#CurrentList, super()];
}


public LedgerJournalId parmJournalNum(LedgerJournalId _journalNum = journalNum)
{
    journalNum = _journalNum;
    return journalNum;
}


public boolean unpack(container _packedClass)
{
    Version         version     = RunBase::getVersion(_packedClass);
    container       packedSuper;
    ;
    switch (version)
    {
        case #CurrentVersion :
            [version, #CurrentList, packedSuper] = _packedClass;

            if (packedSuper)
                super(packedSuper);
            break;

        default :
            return false;
    }
  return true;
}

// this Method is used to Find and if not find create the dimension with the dimension values for Department and project.

static RecId findCreateDimension(str _project, str _department)
{
    RecId                               ret;

    DimensionAttributeValueSetStorage   dimStorage;
    DimensionAttributeValue             dimensionAttributeValue;
    DimensionAttribute                  dimensionAttribute;
    ;
    if (_project || _department)
    {
        dimStorage              = new DimensionAttributeValueSetStorage();
        if (_project)
        {
            dimensionAttribute      = AxdDimensionUtil::validateFinancialDimension("project");
            dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, _project);
            dimStorage.addItem(dimensionAttributeValue);
        }
        if (_department)
        {
            dimensionAttribute      = AxdDimensionUtil::validateFinancialDimension("Department");
            dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, _department);
            dimStorage.addItem(dimensionAttributeValue);
        }
        ret = dimStorage.save();
    }
    return ret;
}

// This function  is used to load into the fixed Asset journal.

public void createJournalLine(
    TransDate               _transDate
    , LedgerJournalACType   _ledgerJournalACType
    , MainAccountNum           _mainAccount
    , LedgerJournalTransTxt _transactionText
    , AmountCurDebit        _debitAmount
    , AmountCurCredit       _creditAmount
    , CurrencyCode          _currencyCode
    , str                   _department
    , str                   _project
    , Voucher               _voucher)
{
    LedgerJournalTrans ledgerJournalTrans;
    LedgerJournalTrans_Asset   ledgerJournalTransAssets;
    AssetTable                 assetTable ;
    LedgerDimensionDefaultAccount defaultAccount;
    LedgerJournalEngine           ledgerJournalEngine;
    AssetBook                  assetBook;


    ledgerJournalTrans.clear();

     assetTable=assetTable::find(_mainAccount);
     assetBook=AssetBook::find(assetTable.AssetId,AssetParameters::find().BookIdDefault);
    if(assetTable && assetBook)
    {
        ledgerJournalTrans.CurrencyCode         =   _currencyCode;
        ledgerJournalTrans.initValue();

        if (!ledgerJournalTable)
        {
            this.findJournal();
        }
        ledgerJournalTrans.LedgerDimension          = DimensionStorage::getDynamicAccount(_mainAccount,_ledgerJournalACType);
        ledgerJournalTrans.parmAccount(assetBook.AssetId, LedgerJournalACType::FixedAssets);
        ledgerJournalTrans.TransDate            = _transDate;
        ledgerJournalTrans.JournalNum           = ledgerJournalTable.JournalNum;
        ledgerJournalTrans.Txt                  = _transactionText;
        ledgerJournalTrans.AccountType          = _ledgerJournalACType;
        ledgerJournalTrans.Voucher              = this.findCreateVoucher(_voucher);
        ledgerJournalTrans.PostingProfile           =AssetParameters::find().PostingProfile;

        ledgerJournalTrans.Company              = curext();

        ledgerJournalTrans.OffsetCompany        = curext();
        ledgerJournalTrans.OffsetDefaultDimension = 0;
        ledgerJournalTrans.OffsetAccountType    = LedgerJournalACType::Ledger;


        ledgerJournalTrans.AmountCurCredit      =   _creditAmount;
        ledgerJournalTrans.AmountCurDebit       =   _debitAmount;

        ledgerJournalTrans.DefaultDimension     = GNDTDestAxLedgerDailyJournal::findCreateDimension(_project, _department);
        ledgerJournalTrans.OffsetAccountType    = ledgerJournalTable.OffsetAccountType;
        ledgerJournalTrans.OffsetLedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(ledgerJournalTable.OffsetLedgerDimension, ledgerJournalTrans.DefaultDimension);


        defaultAccount = AssetTable::find(assetTable.AssetId).assetOffsetLedgerDimension(ledgerJournalTrans.PostingProfile,
                                                                                     AssetPost::assetTransTypeJournal2AssetTransType(AssetTransTypeJournal::Acquisition),
                                                                                    AssetBook.BookId);

        ledgerJournalTrans.parmOffsetLedgerDimension(ledgerJournalTrans.getOffsetLedgerDimensionForLedgerType(defaultAccount, ledgerJournalTrans.getOffsetCompany()));

        // Calculate AmountMST
        ledgerJournalTrans.calcAmountMST();


        ledgerJournalTransAssets.BookId         = assetBook.BookId;
        ledgerJournalTransAssets.TransType      = AssetTransTypeJournal::Acquisition;
        ledgerJournalTransAssets.AssetId        = ledgerJournalTrans.parmAccount();
        ledgerJournalTransAssets.Company        = ledgerJournalTrans.Company;

        ledgerJournalEngine = new LedgerJournalEngine();
        ledgerJournalEngine.initDefaultDimension(ledgerJournalTrans, ledgerJournalTransAssets);

        ledgerJournalTrans.insert();

        ledgerJournalTransAssets.RefRecId       = ledgerJournalTrans.RecId;
        ledgerJournalTransAssets.insert();

        this.storeItem();

        journalNum     = ledgerJournalTable.JournalNum;
    }
    else
    {
        info(strFmt("Asset Id not found %1",_mainAccount));
    }
}







Friday, May 11, 2012

Ax2012 Import Items from CSV file

I am posting only the method where the Input was Container.

Before using this code write your logic to read the CSV file using COMMAIO and get the container and pass to the below method.
And I created the Macro with the position numbers that i used in the below code.
I am using the AX classes to save the records into the Tables.
In AX2012 we have to create the Records for ECOResProduct.

ECOResProduct is the abstract Table and the following tables are inherited from this.
ECORESProductMaster,EcoResdistinctProduct.
When we are creating the new product in form if you select the productsubtype as productMaster then we have to insert into the ECORESProductMaster and we have to pass this recid into the inventTable.

When the productSubtype is Products then we have to use EcoResdistinctProduct  and pass the recid to inventTable.
Below I am using the Products.

Macro:-
//InventTable

#define.InventTable_ItemId_ColumnNum(1)
#define.InventTable_PrimaryVendorId_ColumnNum(2)
#define.InventTable_NetWeight_ColumnNum(3)
#define.InventTable_UnitVolume_ColumnNum(4)
#define.InventTable_AltItemId_ColumnNum(5)
#define.InventTable_Intracode_ColumnNum(6)
#define.InventTable_ABCRevenue_ColumnNum(7)
#define.InventTable_NameAlias_ColumnNum(8)
#define.InventTable_Classification_ColumnNum(9)
#define.InventTable_Integration_ColumnNum(10)
  
//InventItemLocation columns
#define.InventItemLocation_ItemId_ColumnNum(11)

//Invent GroupItem
#define.InventItemGroupItem_ItemId_ColumnNum(12)
#define.InventItemGroupItem_ItemGroupId_ColumnNum(13)

//InventModelGroupItem
#define.InventModelGroupItem_ItemId_ColumnNum(14)

//ECOResProduct translation for english
#define.EcoResProductTranslationENG_Description_ColumnNum(15)
#define.EcoResProductTranslationENG_Name_ColumnNum(16)

//InventItemPurchSetup for default order settings
#define.InventItemPurch_ItemId_ColumnNum(17)

//inventItemInventSetup for Default order settings
#define.InventItemInvent_ItemId_ColumnNum(18)
#define.InventItemInvent_LowestQty_ColumnNum(19)
#define.InventItemInvent_HighestQty_ColumnNum(20)
#define.InventItemInvent_StandardQty_ColumnNum(21)

//InventItemSupplySetup
#define.InventItemSetupSupplytype_ItemId_ColumnNum(22)




Public class Krishh_ImportItem 
{
//Macro which contains the column positions.
    #ItemImport

    AxInventTable      axInventTable;
    AxInventItemGroupItem axInventGroupItem;
    AxInventModelGroupItem axInventModelGroupItem;
    AxEcoResProductTranslation axProductTranslation;
    AxInventItemInventSetup    axInventItemInventSetup;
    AxInventItemPurchSetup     axInventItemPurchSetup;
    InventItemSetupSupplyType  inventItemSetupSupplyType;
    EcoResDistinctProduct        ecoResDistictProduct;
}



protected void createInventTable(container _conLine)
{

    ItemId  itemId;
    InventTable inventTable;
    InventItemGroupItem inventItemGroupItem;
    ;

    itemId  =   this.getLineValue(_conLine,#InventTable_ItemId_ColumnNum);
    inventTable= InventTable::find(itemId);
    if(!inventTable)
    {
        ecoResDistictProduct.clear();
        ecoResDistictProduct.initValue();
        ecoResDistictProduct.DisplayProductNumber=itemId;
        ecoResDistictProduct.ProductType=ecoResProductType::Item;
        ecoResDistictProduct.SearchName=this.getLineValue(_conLine,#InventTable_NameAlias_ColumnNum);
        ecoResDistictProduct.insert();

        axInventTable=axInventTable::construct();
        axInventTable.parmItemId(this.getLineValue(_conLine,#InventTable_ItemId_ColumnNum));
        axInventTable.parmItemType(ItemType::Item);

        axInventTable.parmPrimaryVendorId(this.getLineValue(_conLine,#InventTable_PrimaryVendorId_ColumnNum));
        axInventTable.parmNetWeight(this.getLineValue(_conLine,#InventTable_NetWeight_ColumnNum));
        axInventTable.parmProduct(ecoResDistictProduct.RecId);


        axInventTable.parmUnitVolume(this.getLineValue(_conLine,#InventTable_UnitVolume_ColumnNum));

        axInventTable.parmUseAltItemId(ItemNumAlternative::Always);
        axInventTable.parmAltItemId(this.getLineValue(_conLine,#InventTable_AltItemId_ColumnNum));
        axInventTable.parmIntracode(this.getLineValue(_conLine,#InventTable_Intracode_ColumnNum));
        axInventTable.parmABCRevenue(this.getLineValue(_conLine,#InventTable_ABCRevenue_ColumnNum));
        axInventTable.parmNameAlias(this.getLineValue(_conLine,#InventTable_NameAlias_ColumnNum));
        axInventTable.parmClassification(this.getLineValue(_conLine,#InventTable_Classification_ColumnNum));

        //TODO uncomment once the parm methods where builded
        //   axInventTable.parmIntegration(this.getLineValue(_conLine,#InventTable_Integration_ColumnNum));
        //   axInventTable.parmRevisionId(this.getLineValue(_conLine,#InventTable_RevisionId_ColumnNum));

        //InventItemInventSetup
        axInventItemInventSetup=AxInventItemInventSetup::construct();
        axInventItemInventSetup.parmItemId(itemId);
        axInventItemInventSetup.parmLowestQty(this.getLineValue(_conLine,#InventItemInvent_LowestQty_ColumnNum));
        axInventItemInventSetup.parmHighestQty(this.getLineValue(_conLine,#InventItemInvent_HighestQty_ColumnNum));
        axInventItemInventSetup.parmStandardQty(this.getLineValue(_conLine,#InventItemInvent_StandardQty_ColumnNum));
        axInventTable.axInventItemInventSetup(axInventItemInventSetup);
//
        //////InventPurchSetup
        axInventItemPurchSetup=AxInventItemPurchSetup::construct();
        axInventItemPurchSetup.parmItemId(itemId);
        axInventTable.axInventItemPurchSetup(axInventItemPurchSetup);

        axInventTable.save();



        //InventGroup Item
        axInventGroupItem=AxInventItemGroupItem::construct();
        axInventGroupItem.parmItemId(itemId);
        axInventGroupItem.parmItemGroupId(this.getLineValue(_conLine,#InventItemGroupItem_ItemGroupId_ColumnNum));
        axInventGroupItem.parmItemGroupDataAreaId(curext());
        axInventGroupItem.save();

        //InventModelGroupItem
        axInventModelGroupItem=AxInventModelGroupItem::construct();
        axInventModelGroupItem.parmItemId(itemId);
        axInventModelGroupItem.parmModelGroupId("Std Cost");
        axInventModelGroupItem.parmModelGroupDataAreaId(curext());
        axInventModelGroupItem.save();

        //Product Translation
        axProductTranslation=AxEcoResProductTranslation::construct();
        axProductTranslation.parmDescription(this.getLineValue(_conLine,#EcoResProductTranslationENG_Description_ColumnNum));
        axProductTranslation.parmName(this.getLineValue(_conLine,#EcoResProductTranslationENG_Name_ColumnNum));
        axProductTranslation.parmProduct(ecoResDistictProduct.RecId);
        axProductTranslation.save();

        //InventItemSetupSupplyType
        inventItemSetupSupplyType.clear();
        inventItemSetupSupplyType.initValue();
        inventItemSetupSupplyType.DefaultOrderType=ReqPOType::Purch;
        inventItemSetupSupplyType.ItemId=itemId;
        inventItemSetupSupplyType.ItemDataAreaId=curext();
        inventItemSetupSupplyType.insert();

    }

}