Hello and welcome to e health forum.
Based on the history, it seems that your right sided abdominal pain could be associated with the following conditions :-
1. Hepatitis, or
2. gall bladder inflammation (Cholecystitis ) OR gall stones (Cholelithiasis).
3. GERD or Peptic ulcer disease
4. Colitis ( inflammation of the right colon)
5. Right sided renal stones.
Since the pain is of very severe nature, you might benefit by getting tested for the above conditions by tests including - blood tests (liver function tests), A liver ultrasound or a abdominal CT scan. These tests in addition to the endoscopy (that has been scheduled) will be helpful to give a proper diagnosis.
I Hope this helps.