The stock area is loaded automatically from the program self. You don't find an SQL statement behind this list.
It's not possible to change the sql statement.
It is only possible to change sorting and filter inside the result.
For this use the windowevent postredrawsubtables
Note: Before you must check, if this is a batch- or serial managed item.
Example: change sorting for serial numbers by serial number descending
windowevent postredrawsubtables
if <dw_2.item.mansernum.value> = "Y" then
dw_3.setsort=BatchNumber desc
dw_3.sort
end event