ERCP is used primarily to diagnose and treat conditions of the bile ducts and main pancreatic duct, including gallstones, inflammatory strictures, leaks and cancer. Endoscopic retrograde cholangiopancreatography (ERCP) uses a bendable, telescope-like instrument to detect any abnormalities, such as blockages or tumors, in the tubes that drain the liver and the pancreas.