How do we fill the current item row fields with the highlighted item's data?

We have a requirement such that, upon searching for a product in the Purchase and Sales Invoices, at least the Available Qty and Valuation Rate fields of the current row must be updated as the user navigates the list of products.

So, if a user taps the down arrow key, the Available Qty and Valuation Rate for the highlighted item must be shown in their respective fields of the row.

Any ideas on how we may achieve it?