Because of the success of medical therapy in the management of peptic ulcer disease (PUD), surgery currently plays only a very limited role, and elective peptic ulcer surgery has been virtually abandoned. In the 1980s, the number of elective operations for PUD dropped more than 70%; 80% of these procedures were emergency operations. 
For more information, please see Peptic Ulcer Disease.
Indications for Surgery vs Conservative Management
Generally, 5% of bleeding ulcers require operative management at some point. The following are indications for urgent surgery:
Failure to achieve hemostasis endoscopically
Recurrent bleeding despite endoscopic attempts at achieving hemostasis
With respect to the third indication, many clinicians advocate surgery after two failed endoscopic attempts. Several studies have shown that some perforated peptic ulcers can be treated nonoperatively. Although each of these studies used different indications for surgery, they generally agreed that any patient with a perforated peptic ulcer who has peritoneal signs should undergo exploratory laparotomy.
Wangensteen et al reported that in a patient who has a small perforation without peritoneal signs, it can be assumed that the perforation has sealed off physiologically.  Conservative treatment may be a safe option for such a patient. However, these authors also supported operative treatment in patients with perforated ulcer and evidence of pneumoperitoneum.
Berne and Donovan emphasized the use of a water-soluble upper gastrointestinal (GI) study to prove that perforation no longer exists. [4, 5] As many as 40% of perforated peptic ulcers had no evidence of leak on upper-GI contrast studies. These authors reported mortality figures of 6% in the operative group and 3% in the nonoperative group.
Despite arguments favoring conservative management of patients with a perforated peptic ulcer, delaying the initiation of surgery more than 12 hours after presentation is associated with poor outcomes. Therefore, when indicated, a laparotomy should be performed as soon as possible. 
General Surgical Considerations
Choice of surgical procedure
The location and nature of the ulcer dictates the appropriate surgical procedure. Most authors recommend simple oversewing of the ulcer in addition to treating the underlying Helicobacter pylori infection or cessation of nonsteroidal anti-inflammatory drugs (NSAIDs) for bleeding peptic ulcer disease (PUD). Additional surgical options for refractory or complicated PUD include vagotomy and pyloroplasty, vagotomy and antrectomy with gastroduodenal reconstruction (Billroth I) or gastrojejunal reconstruction (Billroth II), or a highly selective vagotomy.
A prospective, randomized trial comparing laparoscopic surgery with open surgery for perforated ulcer showed that the only differences between these groups were a reduced need for analgesia and an increased operating time in the laparoscopic group. 
Preparation for surgery
Initiation of fluid resuscitation should start as soon as the diagnosis is made. Insertion of a nasogastric tube to decompress the stomach and a Foley catheter to monitor urine output are essential steps. In select cases, inserting a central venous line or a Swan-Ganz catheter may be necessary for accurate fluid resuscitation and monitoring. Application of well-known guidelines similar to the "Surviving Sepsis" treatment protocol to the resuscitation algorithm, along with prompt surgical intervention, has been demonstrated to improve survival. 
The patient is placed in a supine position. A midline incision is the incision of choice, and it can be extended to the symphysis pubis, if necessary. After entry into the abdomen, a thorough inspection of the abdominal cavity is performed. The stomach and duodenum are carefully examined to determine the exact site of perforation. If the anterior surfaces of the stomach and duodenum show no abnormalities, the posterior surface of the stomach should be examined.
The choice of operative procedure depends on variables such as the following:
Life-threatening comorbid conditions
Size of the perforation
Duration of symptoms
Patient's history of chronic peptic ulceration
In cases of hemodynamic instability and gross intra-abdominal contamination, the safest technique for an acute anterior duodenal perforation is a simple closure with a Graham patch, using omentum. Several full-thickness simple silk sutures are placed across the perforation, and a segment of omentum is placed over the perforation. The silk sutures are secured. Laparoscopic closure of perforated peptic ulcer is increasingly being performed. [9, 10, 11]
A definitive ulcer procedure (see Definitive Ulcer Procedures) can be performed if contamination of the upper abdomen is minimal and the patient is stable. This may include a highly selective vagotomy, a truncal vagotomy and pyloroplasty, or vagotomy and antrectomy for a perforated duodenal ulcer.
If the patient is hemodynamically stable, the ulcer should be completely excised and sent for frozen section to exclude malignancy. For a benign disease, distal gastrectomy should be performed with restoration of gastrointestinal (GI) continuity by means of either a Billroth I gastroduodenostomy or a Billroth II gastrojejunostomy.
Definitive Ulcer Procedures
Truncal vagotomy and drainage
The esophagus is retracted to patient's left, and the left hemiliver is retracted to the patient's right side. A transverse incision is made in the peritoneum overlying the esophagus at the hiatus in the diaphragm. This opening is widened. A right-angle clamp can be used to pass a Penrose drain around the esophagus. The anterior vagal trunk is then sought and separated from the esophagus. The posterior vagus is usually felt as a cord lying posterior to the esophagus.
After the vagal trunks have been transected, the distal 5-6 cm of the esophagus should be cleared by meticulous dissection and division of nerve fibers and blood vessels. The criminal nerve of Grassi, which is a branch of the posterior vagus nerve, must be sought and divided. Careful attention to operative technique is essential to ensure complete vagotomy. The drainage procedure depends on the condition of the duodenum. Pyloroplasty (see below) is preferred by most surgeons; if the duodenum is inflamed, a gastrojejunostomy (see below) is the safest alternative.
A Kocher maneuver is performed to mobilize the second part of the duodenum. Two silk stay sutures are made at the superior and inferior aspects of the pylorus. A 6- to 10-cm longitudinal incision is made, starting from the antrum and extending across the pylorus and into the first part of the duodenum. This incision is closed transversely with an inner layer of interrupted 3-0 absorbable sutures encompassing all layers; this is followed by a seromuscular layer of 3-0 silk Lembert sutures.
A loop of jejunum approximately 12-15 cm from the ligament of Treitz is lifted and brought next to the greater curvature of the stomach through an opening in the transverse mesocolon, usually to the left of the middle colic vessels. A gastrotomy is made in the prepyloric region or at the most dependent portion of the stomach.
Before the bowel is opened, noncrushing clamps are placed on both sides of the proposed anastomosis sides. The area of the anastomosis is isolated with moist laparotomy pads to avoid spillage and contamination. The stomach and the adjacent jejunum are then opened. A full-thickness inner layer is started posteriorly with 3-0 absorbable sutures and completed anteriorly with inverting Connell sutures. Alternatively, a stapled anastomosis can be performed by putting one limb of stapler in the gastrotomy and the other in the jejunotomy.
Billroth I and II gastrectomy
The greater omentum is identified at the greater curvature of the stomach. It is separated from the proximal half of the transverse colon. Next, branches from the gastroepiploic arcade to the greater curvature are divided. The posterior wall of the first part of the duodenum is separated from the pancreas and divided with a gastrointestinal anastomosis (GIA)-60 linear stapler. The right gastric artery above the pylorus is identified and divided. The gastrohepatic ligament is divided proximally with an electrocautery along the lesser curvature. The left gastric vessels lying along the lesser curvature are ligated. The stomach is divided with a GIA-90 linear stapler.
A Billroth I gastroduodenal anastomosis can be constructed if an adequate length normal duodenum is available. A two-layer anastomosis is performed, with an outer layer of interrupted Lembert sutures and an inner layer of full-thickness continuous absorbable sutures.
If a Billroth II gastrojejunostomy is a chosen, a loop of proximal jejunum is selected and brought in an antecolic or retrocolic fashion toward the transected stomach. For a hand-sewn anastomosis, a posterior layer of interrupted Lembert sutures is placed. A longitudinal enterotomy is made in the loop of jejunum, and the appropriate length of adjacent gastric staple line is excised. The inner layer of continuous 3-0 absorbable sutures is placed. Then, anterior interrupted Lembert 3-0 silk sutures are placed.
For a stapled Billroth II anastomosis, stay sutures are placed so that the loop of jejunum is held adjacent to the gastric remnant. A small stab incision is made in the jejunum and at the adjacent posterior wall along the greater curvature of the stomach. The limbs of the GIA stapler are inserted and fired.
Highly selective vagotomy
Patient positioning and incision are the same as for truncal vagotomy and pyloroplasty. The key step is identification of the anterior nerve of Latarjet, which leaves the esophagogastric junction and runs in the lesser omentum parallel to the lesser curvature. In order to enter the lesser sac, the gastrocolic ligament is divided. Neurovascular branches are carefully ligated with the help of a fine clamp. Next, the stomach is turned upward, and posterior denervation is conducted in a similar fashion.
Depending on the return of gastrointestinal function, the nasogastric tube can be discontinued on postoperative day 2 or 3, and diet can be slowly advanced. Patients with H pylori infection should receive the appropriate antibiotic regimen. Patients with high serum gastrin levels should undergo an evaluation for Zollinger-Ellison syndrome.
Surgical complications include the following:
Abdominal abscess (15%)
Cardiac problems (especially in those younger than 70 years)
Diarrhea (30% after vagotomy)
Dumping syndromes (10% after vagotomy and drainage procedures)