How, and in which scenario have you achieved this? It´s one of the few ones that I have remaining, but I never see scenarios where I have an option to trap the ships in harbor in order to force them to scuttle ship.
i dont recall campaign or single player scenarios being workable for it. i think it can be achieved in multi-player scenarios, especially ones like 1941
When you attack a ship in port with a ground unit it will automatically leave port.
If there is no vacant hex, it will scuttle instead of retreating.
You can either block it in with ships (and the AI might have doen this for you) or in some scenarios it can be done with a ground unit (when the exit is a canal or river or has a bridge or port hex that can be occupied).
You don't get prestige for scuttled or surrendered ships but I feel very smug and superior when I do it, even though I only play single player.