Skip to content

Finding Field and labels with string type

There is easiest way to find the field and labels using X++ Code.

static void FieldInfo_Type(Args _args)
{
DictTable dictTable;
DictField dictField;
int fieldIdx;
str tablename = "BOMTable";
;
info("Table|Field|Field Id|Label|Type|String length");

dictTable = new DictTable(tablename2id(tablename));
for(fieldIdx=1; fieldIdx <= 60000; fieldIdx++)
{
    dictField = dictTable.fieldObject(fieldIdx);
    if(dictfield)
    {
        info(       dictTable.name()
              +"|"+ dictField.name()
              +"|"+ int2str(fieldIdx)
              +"|"+ dictField.label()
              // label in English / German (other language than in line above)??
              +"|"+ enum2str(dictField.baseType())
              +"|"+ int2str(dictField.stringLen())

             );
    }
}
}
Published inTechnical Blog