Endoscopic retrograde cholangiopancreatography (ERCP) is a procedure that combines upper gastrointestinal (GI) endoscopy and x-rays to treat problems of the bile and pancreatic ducts. Doctors use ERCP to treat problems of the bile and pancreatic ducts. Doctors also use ERCP to diagnose problems of the bile and pancreatic ducts if they expect to treat problems during the procedure. For diagnosis alone, doctors may use noninvasive tests—tests that do not physically enter the body—instead of ERCP. Noninvasive tests such as magnetic resonance cholangiopancreatography (MRCP)—a type of magnetic resonance imaging (MRI) —are safer and can also diagnose many problems of the bile and pancreatic ducts. Doctors perform ERCP when your bile or pancreatic ducts have become narrowed or blocked because of
gallstones that form in your gallbladder and become stuck in your common bile duct
infection
acute pancreatitis
chronic pancreatitis
trauma or surgical complications in your bile or pancreatic ducts
pancreatic pseudocysts
tumors or cancers of the bile ducts
tumors or cancers of the pancreas