Olaparib is used as maintenance treatment in patients with advanced ovarian cancer, fallopian tube cancer, or primary peritoneal cancer with a certain type of inherited (germline) or acquired (somatic) abnormal BRCA gene. Your doctor will test for the presence of this gene.