Override the lookup method on Formdatasource field(on which you want to show lookup) , and copy the following code to your method.
Comment the super() method in the lookup.
Comment the super() method in the lookup.
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup; // systemclass to create //customlookup
Query query;
QueryBuildDataSource qbd;
;
sysTableLookup = SysTableLookup::newParameters(
tablenum(Dimensions),
_formcontrol);
// Construct query on the table,
// whose records you want to show as lookup.
query = new Query();
qbd = query.addDataSource(tablenum(Dimensions));
qbd.addRange(fieldnum(Dimensions, DimensionCode)).value(enum2str(SysDimension::Niveau_I));
// add the fields to the lookup list
sysTableLookup.addLookupfield(fieldnum(Dimensions,DimensionCode));
sysTableLookup.addLookupfield(fieldnum(Dimensions,Num));
// pass the query as parameter
// system will show the records in the lookup
// as per your query
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}