Simple runtime lookup code in axapta x++ language of Microsoft
public void lookup()
{
//super();
SysTableLookup tableLookup;
QueryBuildDataSource qbds_Test_Item_YN;
Query q = new Query();
;
tableLookup = SysTableLookup::newParameters(tableNum(Test_ItemYN),this);
tableLookup.parmUseLookupValue(false);
qbds_Test_Item_YN = q.addDataSource(tableNum(Test_ItemYN));
tableLookup.parmQuery(q);
tableLookup.addLookupfield(fieldNum(Test_ItemYN,ItemId));
tableLookup.addLookupfield(fieldNum(Test_ItemYN,ItemName));
tableLookup.performFormLookup();
}