An ERCP can be used to diagnose and treat diseases of the upper digestive system.