Assume that we need to add a lookup to the existing PONum field in Inbound–> PO Receiving in the screen below.
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”
thanks.
Just a comment on this. The number of elements that you can show in the lookup is limited by the field length of 255. So in my case I did not see everything in the lookup. When I increase the size of the WHSTmpWorkExecuteListBoxItems table field Elements (original size 255), I can now see everything that I expect to see in the lookup.