The Following Code will let you know the List of Mandatory Fields in a table
static void CheckMandatoryFieldsOnTable(Args _args)
{
DictTable dictTable;
DictField dictField;
Counter i;
TableId tableId = tablenum(CustTable);//Table name
dictTable = new DictTable(tableId);
info(strFmt("Total No. of fields in: %1 are: %2\n\n\n",tableId2name(tableId), dictTable.fieldCnt()));
info('Mandatory Fields are following');
for (i=1 ; i<=dictTable.fieldCnt() ; i++)
{
dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));
if (dictField.mandatory())
{
info(dictField.name());
}
}
}
static void CheckMandatoryFieldsOnTable(Args _args)
{
DictTable dictTable;
DictField dictField;
Counter i;
TableId tableId = tablenum(CustTable);//Table name
dictTable = new DictTable(tableId);
info(strFmt("Total No. of fields in: %1 are: %2\n\n\n",tableId2name(tableId), dictTable.fieldCnt()));
info('Mandatory Fields are following');
for (i=1 ; i<=dictTable.fieldCnt() ; i++)
{
dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));
if (dictField.mandatory())
{
info(dictField.name());
}
}
}
No comments:
Post a Comment