So really this is two questions ?
Cooking inside the can, straight onto the fire ?
or
Boiling the can in a pot of water on the fire?
Boiling an unopened can in a pot of water is fine, it's how we make condensed milk into caramel for Millionaire's shortbread, because the temperature of the water is the upper limit of the heat.
Just take care to open the can facing away from you incase it spurts, and it's sorted.
(neat idea on bashing the side of the can to tell that it's heated through, Tonyuk

)
Can straight onto the fire….hmmm, with care and opened methinks. That said, we used to heat up soup like that so many years ago I daren't count back

almost completely opened the lid first, and then folded it back over to stop ash falling in and to help keep the heat.
Not worth doing with Heinz tomato; it sticks. Veg was okay, and so was the leek and potato.
Hotdogs I don't think of as food, and really don't think I ever did. Like a meaty version of that plasticy processed cheese stuff. Weird texture

Ikea's veggie hotdogs are just as bad. I can't think of a much less appealling food tbh.
You can cook proper bangers on a stick if you don't want to dirty a pan, y'know. Even cub scouts do that

…or you could seal them up in one of the oven roasting bags, and pop that into a Dutch oven, and kind of roast them. I think that would work quite well. Yes/ No?
That said, a campfire 'can' get up to 600C (with a bit of care and attention, etc.,) so heaven knows just how hot you could get a Dutch oven
M