based on selected record from parent code lookup modify item id in purchase order.
create a new custom lookup form as shown below.
override closeselect method :
Public void closeselect(str _selectString)
{
FormRun formrun;
Object formrunobj;
super(_selectString);
if(element.args() != null
&& element.args().caller() != null
&& SysDictClass::is(element.args().caller(),classnum(FormRun ))
{
formrun = element.args().caller();
if(formHasMethod(formrun,identifierstr(PurchTable)))
{
formrunobj = formrun;
}
}
}
override init method :
set Autodeclaration Yes Highlited control in
Public void int()
{
super();
element.selectMode(InventTable_ParentCode);
}
override runmethod :
Public void run()
{
FormStringControl callingcontrol;
boolean filterlookup;
FormRun formrun;
if(element.args() && element.args().caller())
{
if(SysDictClass::is(element.args().caller(),classnum(FormRun )))
{
formrun = element.args().caller();
}
super();
}
call Lookup form in ParentCode control level in PurchTable form.
Args args = new Args();
FormRun lookupform;
InventTable inventTable;
args.name(formstr(parentlookup));
args.parm(PurchLine.ItemId);
lookupform = new FormRun(args);
lookupform .init();
this.performFormLookup(lookupform);
lookupform.wait();
if(lookupform.closeOk())
{
inventTable = lookupform.docCursor();
}
}
Get RecId from inventTable modify ItemId from modified method.