Yes, ramipril can cause diarrhea while your body adjusts to this drug. But it is not serious and should subside with time. Also, caution should be maintained while concommitantly using potassium supplements with this drug. Pain in the flank region could be due to various reasons like renal stones, muscle spasm, urinary tract infection etc. I would recommend that you get a urine analysis, ultrasound abdomen and consult a urologist for further assistance on this. Best.