Story updated with statement from Léo Apotheker.

PALO ALTO, Calif. ( TheStreet) -- HP ( HPQ - Get Report) has appointed former SAP ( SAP - Get Report) chief Léo Apotheker as its new CEO, ending weeks of speculation about the company's new leader.

Apotheker spent more than 20 years at SAP prior to his resignation earlier this year and is credited with transforming the German firm into the world's largest business application software company. The appointment, however, comes as something of a surprise, particularly after rumors that HP was looking internally for Hurd's replacement. IBM ( IBM) software chief Steve Mills was also a rumored HP target.
Leo Apotheker
Leo Apotheker, HP's new CEO

HP's CEO search lasted almost eight weeks and followed the departure of former CEO Mark Hurd amid an expenses scandal. Hurd, who took the helm at HP following the departure of Carly Fiorina, turned the tech giant's fortunes around, and there has been intense speculation about his successor.

"I am deeply honored to be joining the more than 300,000 dedicated HP employees," said Apotheker, in a statement. "HP has a powerful mix of businesses, products and services, one of the most innovative cultures in the industry, and an accomplished management team who have played a critical role in its success."

Apotheker takes the company's reins from HP CFO and interim CEO Cathie Lesjak, who now returns to her former role. The computer and server maker will give additional details on Apotheker's appointment during a conference call on Friday morning.

HP's Board also elected Ray Lane, managing partner at Kleiner PerkinsCaufield & Byers, as a new member of the Board and designated him as non-executive Chairman.

Trading in HP shares was halted just before the news was announced, but rose slightly after market close. The company's stock gained 20 cents, or 0.49%, to reach $42.27.

SAP's stock rose 17 cents, or 0.35%, to reach $49.50.

--Written by James Rogers in New York.

>To follow the writer on Twitter, go to http://twitter.com/jamesjrogers.

>To submit a news tip, send an email to: tips@thestreet.com.