serial number in quality order form

hi all,

i want serial number lookup in quality order line result form (InventQualityOrderLineResults) which serial number is fetched from the purchase order registration form(inventtransregister). In the lookup i want all the serial number for a perticular item which is generated after spliting the item.

i write the code in the validate write method of InventQualityOrderLineResults form.

public boolean validateWrite()

{

boolean ret = super();

InventTrans _InventTrans;

InventTransOrigin _InventTransOrigin;

InventDim _inventdim;

InventQualityOrderTable _InventQualityOrderTable;

str 100 referenceid;

select _InventQualityOrderTable where _InventQualityOrderTable.QualityOrderId == this.QualityOrderId;

select _InventTransOrigin where _InventTransOrigin.ReferenceId == _InventQualityOrderTable.InventRefId

&& _InventTransOrigin.ItemId == _InventQualityOrderTable.ItemId;

while select _InventTrans where _InventTrans.InventTransOrigin == _InventTransOrigin.RecId

{

select _inventdim where _inventdim.inventDimId == _InventTrans.inventDimId;

this.RFL_SerialNumber = _inventdim.inventSerialId;

this.setTestResult(null, false);

return ret;

}

}

by this i get first serial number not a selected one or not a lookup of all serial numbers for a perticular item i also write the lookup method in the newly created field but by this code i get the lookup of all items not a selected one.

public void lookup()

{

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(InventQualityOrderLineResults), this);

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

;

sysTableLookup.addLookupfield(fieldnum(InventQualityOrderLineResults, RFL_SerialNumber));

// sysTableLookup.addLookupfield(fieldnum(InventQualityOrderLineResults, inventDimId));

//BP deviation documented

queryBuildDataSource = query.addDataSource(tablenum(InventQualityOrderLineResults));

queryBuildRange = queryBuildDataSource.addRange(fieldnum(InventQualityOrderLineResults, RFL_SerialNumber));

// queryBuildRange.value(Global::queryNotValue(InventQualityOrderLineResults.inventDimId));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

i am not understanding what would be wrong.

can anyone give me the solution.