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. ... Your bile ducts are tubes that carry bile from your liver to your gallbladder and duodenum.