Qualtrics CEO Ryan Smith (L) and SAP CEO Bill McDermott (R) Ari Levy | CNBC

Of the many texts and emails that Qualtrics CEO Ryan Smith received since Sunday afternoon after agreeing to sell his software company to Germany's SAP for $8 billion, one in particular stood out. It was from Utah Jazz star Ricky Rubio. The Spanish point guard congratulated Smith on the deal, but he was really texting about something else. Rubio wanted to know what the acquisition meant for 5 for the Fight, an organization launched by Smith and his family in 2016 to raise money for cancer research by encouraging people to donate $5 in the name of someone battling cancer. Local basketball fans know the slogan because it's emblazoned on Jazz uniforms, and they know Qualtrics because the company is based in Provo, 45 miles south of Salt Lake City. For Rubio, the cause is personal. His grandmother died from cancer, and his mother succumbed to the disease in 2016. Rubio has been declared the group's first ambassador, speaking publicly about his story and raising money in support. "They wear 5 for the Fight on their jersey and he wanted to know what's going to happen to it," said Smith, who co-founded Qualtrics in 2002 while his dad, Scott, was being treated for throat cancer. "I said nothing's going to change. We're all in."

It's the same message Smith gave to SAP CEO Bill McDermott and then to his 2,000 employees over a whirlwind weekend that saw Qualtrics pivot from a planned IPO to a blockbuster acquisition — the second-biggest in SAP's history. Smith and McDermott spoke with CNBC on Monday from a hotel in downtown San Francisco, where they had just arrived after flying in from Provo. They were in town for press meetings during the day before heading to Palo Alto to meet with employees at SAP's Silicon Valley office. SAP, which specializes in enterprise resource management software, had been in casual talks for several months with Qualtrics. In late summer, McDermott had lunch with Ryan Smith, his brother and co-founder, Jared, and Scott at Marea, an Italian restaurant in midtown Manhattan. They talked about entrepreneurship, building a business and some areas where their companies overlap. SAP serves critical software to the world's biggest companies, and Qualtrics, at a much smaller scale, sells software to help companies understand and retain their customers and employees. "We really weren't in M&A discussions at that point," McDermott said. "We were like-minded individuals, very cloud oriented, very growth oriented. I'm obsessed with customers. Ryan is obsessed with their experiences." Sometimes a lunch is just a lunch. And while McDermott was running a company with 95,000 people across the globe, Smith was working full speed towards an IPO. Qualtrics hired Goldman Sachs and Morgan Stanley to lead its offering and publicly filed its prospectus in October. SurveyMonkey, its biggest rival in the survey software market, had gone public the prior month, and it was immediately clear that Qualtrics would command a much higher market value because it's the bigger and more profitable of the two, and is growing faster. Smith and the Qualtrics team spent early November on the road talking to public market investors and readying them for the upcoming offering. But this past Saturday night, McDermott boarded a plane from New York to Provo with a plan that he wasn't certain would work. From 39,000 feet in the air, he called Smith with a proposal. He wanted to see if Smith would be willing to pass up a Nasdaq listing and join forces with SAP. At the time, investors were clamoring for shares in a company that was likely to be valued at between $5 billion and $6 billion and, given how cloud software companies trade, was almost guaranteed to pop in its debut.

"It was never about, gee-whiz, can I be convincing enough to have Ryan join up with," McDermott said. He told Smith, "You have options. You're 13 times oversubscribed. You can sell the company to anybody but you can also take it public. I really want you to do this if you truly want to do this." Smith asked McDermott about his current whereabouts. "I'm flying over Mount Rushmore," he said. The pitch worked. Smith said he was "fired up" about the opportunity to keep running Qualtrics while taking advantage of SAP's massive sales force and customer base and being able to fold in Qualtrics' data that it's obtained from from analyzing and measuring customer experience. He also gets to ramp up hiring. Qualtrics hired Frank Quattrone's Qatalyst Partners as an adviser. Smith declined to say if other bidders emerged, but he said that throughout the company's history potential acquirers have constantly circled. Still, there was work to do. McDermott had to now sell his board on the deal. At $8 billion, Qualtrics was going to cost SAP over 6 percent of its market capitalization. When projecting Qualtrics' 2019 sales of $575 million, it worked out to 14 times forward revenue, and was up there with how much Salesforce paid for MuleSoft and what Microsoft paid for GitHub. But unlike Salesforce and Microsoft, which have rewarded investors handsomely of late, SAP's stock is down in 2018 and has lagged its peers over the past two years. McDermott spent Saturday night at a hotel in Sundance, north of Provo, and woke up early Sunday morning to try and get board approval while thousands of miles away from fellow directors. He dialed in from his hotel room to talk over the details.

Meanwhile, Smith was 20 miles away at his headquarters, still unsure if he was getting ready to go public or sell his business. Either way, his family, which owns over 40 percent of the company's outstanding shares, was gong to be worth billions. "We had a management meeting set up at 2 (4 p.m. in New York) to either talk about the IPO or talk about this," Smith said. When the board voted unanimously on the deal, the company immediately prepared its documents for German regulators and drafted its press release. McDermott hustled down to Provo by car to meet with the Qualtrics management team and then to talk publicly about the deal on the call with analysts. Smith also had to inform the bankers at Goldman and Morgan Stanley that there wouldn't be an IPO. "I called them and I said, 'hey look, this came quickly, it came in hot, it came in on Sunday,'" Smith said. "The way this happened was so fast, everyone was planning for an IPO, including ourselves." Smith and McDermott stayed up to host a call with the Qualtrics team in the Asia Pacific region before taking a quick nap and preparing for a long Monday. They started the official workweek back at the Qualtrics headquarters, where they held an all-hands meeting for about 1,000 local employees, with others dialing in from Dublin, Seattle, Dallas and Raleigh, North Carolina. "I was telling employees today, in 16 years I've never had a morning where I felt as pumped as I did with Bill," Smith said. "We were on an hour of sleep. We were fired up." From there, they headed to the Provo airport to hop on a flight to San Francisco.

Maintaining cancer research