I wonder whether we can use "bzw." instead of "beziehungsweise" in a formal text or not. I actually found this sentence in a formal text:
Achten Sie beim Verbinden der Stromversorgung bzw. des USB-Kabels darauf ...
I don't see any reason why you shouldn't use "bzw.". It's a very common abbreviation, after all.
But you can use even less known abbreviations or abbreviation specific to the text at hand (e.g. technical terms). Those are often introduced in the beginning or in an "Abkürzungsverzeichnis" (list of abbreviations).
For example, the Bundesministerium provides laws on the Internet. I guess we agree that laws are formal. If you skim over them, you'll notice that they contain "bzw." quite a lot. Other typical abbreviations that you find in laws are, for instance, "vgl." (vergleiche) and "Art." (Artikel).
But you also see some abbreviations specific to laws like "BGB" (Bürgerliches Gesetzbuch) and "ArbZG" (Arbeitszeitgesetz).