OMOperatingUnit omOperatingUnit;
DirOrganization dirOrganization;
DirParty dirParty;
Name storeName = 'AjayStore';
Name storeNameAlias = 'AjayStore';
LanguageId languageId = 'EN-US';
dirOrganization.clear();
dirOrganization.Name = storeName;
dirOrganization.NameAlias = storeNameAlias;
dirOrganization.LanguageId = languageId;
dirOrganization.insert();
dirParty = new DirParty(dirOrganization);
omOperatingUnit.initFromDirParty(dirParty);
omOperatingUnit.Name = storeName;
omOperatingUnit.OMOperatingUnitNumber = NumberSeq::newGetNum(OMOperatingUnit::getNumberSequenceReference()).num();
omOperatingUnit.OMOperatingUnitType = OMOperatingUnitType::RetailChannel;
omOperatingUnit.LanguageId = languageId;
omOperatingUnit.insert();
retailStoreTable.initValue();
retailStoreTable.OMOperatingUnitID = omOperatingUnit.RecId;
retailStoreTable.DefaultCustAccount = // Default account num;
retailStoreTable.inventLocation = // Default invent location;
retailStoreTable.StoreNumber = NumberSeq::newGetNum(RetailParameters::numRefStoreId()).num();
retailStoreTable.Currency = //currency;
retailStoreTable.taxGroup = // sales tax group;
if (retailStoreTable.validateWrite())
{
retailStoreTable.insert();
}