Top of the Generate Browse routine.
But if you want to limit the code to running only once, I guess you need to set, and test a session variable to see if you've bene here before. Somethign along the lines of
if p_web.gsv('here') = 0
p_web.ssv('here',1)
! whatever else
end