ERCP can aid in diagnosing pancreatic cancer by providing images of the pancreatic ducts, but additional tests may be needed for a definitive diagnosis.