Assuming this relationship:
LayoutTable::__pkTableID = PortalTable::_fkTableID
on a layout based on LayouTable with a portal referring to PortalTable....
Set Variable [$TableID ; value: LayoutTable::__pkTableID ]
Go to Layout ["PortalTable" (PortalTable) ]
Set Field [PortalTable::_fkTableID ; $TableID ]
Set FIeld [PortalTable::Qty ; 1 ]
Set Field [PortalTable::Amt ; Your amount goes here ]
Go to Layout [ original layout ]
Note: This script can trip a number of script triggers on exiting and entering layouts. Sometimes additional step must be taken to keep such trigger performed scripts from interfering.