It is good, especially when you have ready to use map for all concrete tables. It is more difficult to create such map id you haven't.
For example you can not just declare fact, that you have same name for a field in each table; uou should: either repeatedly add declaration of all field mappings, or generate it by reflection code, or generate it in xpo.
The following dynamic code uses only list of tables and the fact, that ItemID has the same name:
static void Test_DictTab(Args _args)
{
container tables = [
tableNum(InventTable),
tableNum(InventJournalTable),
tableNum(InventJournalTrans)
];
int i;
void processTable(TableID _tableID)
{
SysDictTable table = SysDictTable::newTableId(_tableID);
Common record = table.makeRecord();
FieldID itemField = table.fieldName2Id(fieldStr(InventTable, ItemID));
;
while select count(recID) from record
where record.(itemField) == '001'
{
info(strFmt("%1 = %2", table.label(), record.RecId));
}
}
;
for(i=1; i<=conLen(tables); i++)
processTable(conPeek(tables, i));
}