Hi Blue Wang,
we have only one Legal entity ,
below is the code which we have return for inserting data:
static void ProjPostingImport(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row = 2;
Name name;
FileName filename;
ProjPosting projPosting;
DimensionAttributeValueCombination dimensionAttributeValueCombination;
ProjFundingSource projFundingSource;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "D:\\temp\\Proj posting testing";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
projPosting.ProjCode = TableGroupAll::Table;
projPosting.CategoryCode = TableGroupAll::All;
projPosting.ProjRelation = cells.item(row, 1).value().bStr();
/* select dimensionAttributeValueCombination
where dimensionAttributeValueCombination.DisplayValue == cells.item(row, 2).value().bStr()
&& dimensionAttributeValueCombination.LedgerDimensionType == LedgerDimensionType::DefaultAccount;*/
//projPosting.LedgerDimension = dimensionAttributeValueCombination.RecId;
select projFundingSource
where projFundingSource.FundingSourceId == cells.item(row, 3).value().bStr();
ProjPosting.ProjFundingSource = projFundingSource.RecId;
projPosting.ProjAccountType = new DictEnum(enumNum(ProjAccountType)).name2Value(cells.item(row,4).value().bStr());
projPosting.Insert();
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
info('Lines inserted..');
}
error :

Regards,
Akbar