Viagra, commonly known as this drug , is mainly used to manage difficulty maintaining an erection in men. However be prescribed in certain situations for treating pulmonary hypertension . Its function involves loosening arteries in the penis allowing for more blood flow and enabling an erection .