Assume that we need to add a lookup to the existing PONum field in Inbound–> PO Receiving in the screen below.

POReceive

Use the Class WhsWorkExecuteDisplayPOItemReceiving for the below changes.

 

Step1: Create a method to initialize the control with PO numbers

protected str buildPOGroupString(
boolean _showBlank)
{
PurchTable  purchTable;
boolean             first = true;
str                 elements;

if (_showBlank)
{
elements = ‘||’;
}
while select PurchId
from purchTable
order by purchId

{
if (first)
{
first = false;
}
else
{
elements += ‘||’;
}

elements += purchTable.purchId;
}
return elements;
}

Step2: Create a new method for PONum control

 

container buildPONum(container    _con,
str          _label = ”,
boolean      _showRemove = false,
boolean      _showBlank  = false,
boolean      _showOK     = true,
str          _selected   = ”,
boolean      _enabled    = true)
{
container           ret = _con;
str                 elements;
str                 label = _label;

ItemId              itemId;

if (pass.exists(#ItemId))
{
itemId = pass.lookup(#ItemId);
}

elements = this.buildPOGroupString( _showBlank);

ret += [this.buildControl(#RFCombobox, #PONum, label, 1, elements, #WHSRFUndefinedDataType, ”, 0, _enabled, _selected ? _selected : ”)];

if (_showRemove)
{
ret += [this.buildControl(#RFButton, “@SYS26394”, “@WAX879″, 1, ”, #WHSRFUndefinedDataType, ”, 0)];
}

if (_showOK)
{
ret += [this.buildControl(#RFButton, #RFOK, “@SYS5473″, 1, ”, #WHSRFUndefinedDataType, ”, 1)];
}

return ret;
}

 

Step3: Replace code in “buildPOItemReceiving” as shown below

ret += [this.buildControl(#RFText, #POLineNum,”@WAX1236″, 1, int642str(poLineNum), extendedTypeNum(LineNum), ”, 0, false)];

replace with

ret = this.buildPONum(ret,”, false, false, false, pass.lookupStr(#SelectedValueUOM));

Step4: Similary perform Step3 in “buildGetPOLineLP”