Hi Connie and welcome!
Are you talking about a microwave on a shelf, or an actual built in (over the counter) microwave? For an OTC, you get a mounting bracket with the microwave and it hangs on the wall below the bottom of the cabinet, just like an over-the-range microwave does. You just need a shorter wall cabinet to go above it. Most countertop microwaves are deeper than the wall cabinets are, though, so you need the extended shelf for it to sit on if you want to put it on a shelf. Some people have used countertop microwaves in base cabinets and trim them out to look built in, if that's an option for you, or you could install one in a deep tall pantry.