Struct struct = new Struct();
container ledgerDimension;
DimensionDefault DimensionDefault;
custTable.company(custTableStagging.LegalEntity);
custTable.initValue();
name = custTableStagging.FirstName + " "+ custTableStagging.LastName;
//CustTable
custTable.AccountNum = NumberSeq::newGetNum(CustParameters::numRefCustAccount()).num();//customer.parmAccountNum();
custTable.CustGroup = custTableStagging.CustGroup;
custTable.Currency = CompanyInfo::standardCurrency();
if (custTableStagging.Region != '')
{
struct.add('Region', custTableStagging.Region);
ledgerDimension += struct.fields();
ledgerDimension += struct.fieldName(1);
ledgerDimension += struct.valueIndex(1);
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
custTable.DefaultDimension = DimensionDefault;
}
// custTable.KPMGPayeeName = name;
custTable.insert(DirPartyType::Organization, name);
============
container cont1,cont2,offSetAcctPattern;
int cnt;
DimensionDynamicAccount ledgerDim, offsetledgerDim;
if(mLegalEntity != '')
{
cnt++;
cont2 += ['LegalEntity',mLegalEntity];
}
if(mLocationFacility != '')
{
cnt++;
cont2 += ['LocationFacility',mLocationFacility];
}
if(mDepartment != '')
{
cnt++;
cont2 += ['Department',mDepartment];
}
if(mCustomerGroup != '')
{
cnt++;
cont2 += ['CustomerGroup',mCustomerGroup];
}
if(mBusinessUnit != '')
{
cnt++;
cont2 += ['BusinessUnit',mBusinessUnit];
}
if(mLocationType != '')
{
cnt++;
cont2 += ['LocationType',mLocationType];
}
if(mCompetency != '')
{
cnt++;
cont2 += ['Competency',mCompetency];
}
if(mProject != '')
{
cnt++;
cont2 += ['Project',mProject];
}
if(mRegion != '')
{
cnt++;
cont2 += ['Region',mRegion];
}
if(mWorker != '')
{
cnt++;
cont2 += ['Worker',mWorker];
}
if(ledgerJournalTrans.AccountType == LedgerJournalACType::Ledger)
{
cont1 += ['MainAccount',AccountNumb,cnt];
cont1 += cont2;
ledgerDim = AxdDimensionUtil::getLedgerAccountId(cont1);
if(ledgerDim == 0)
{
offSetAcctPattern = [AccountNumb,AccountNumb];
ledgerDim = AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern);
}
ledgerJournalTrans.LedgerDimension = ledgerDim;
}
else
{
ledgerDim = DimensionStorage::getDynamicAccount(AccountNumb,ledgerJournalTrans.AccountType);
ledgerDimension += cnt;
ledgerDimension += cont2;
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
ledgerJournalTrans.LedgerDimension = ledgerDim;
LedgerJournalTrans.modifiedField(fieldNum(LedgerJournalTrans,LedgerDimension));
ledgerJournalTrans.DefaultDimension = DimensionDefault;
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
27 July 2016
Subscribe to:
Posts (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...