By Harro Ten Wolde

FRANKFURT (Reuters) - Unexpectedly strong growth in high-margin packaged software licenses fueled quarterly earnings of Europe's largest software company SAP <SAPG.DE>, which confirmed its full-year outlook.

Second-quarter operating profit, excluding special items, rose 9 percent to 1.52 billion euros ($1.67 billion), beating average analysts' expectations of 1.45 billion euros in a Reuters poll.

SAP, whose customers include many of the world's biggest multinational corporations, specializes in business applications ranging from accounting to human resources to supply-chain management.

It and its established rivals such as Oracle <ORCL.N> and IBM <IBM.N> are racing to fend off pure cloud software rivals like <CRM.N> and Workday Inc <WDAY.N> in the market for running complex business operations.

Cloud software, which is delivered via the Internet, has lower profit margins than packaged products, of which SAP sold more in the second quarter.

Software licenses rose by 10 percent to 1.04 billion euros, excluding the effect of foreign exchange rates. Analysts were expecting a rise by only 1.8 percent to 997 million euros.

Oracle, IBM and Microsoft <MSFT.O> also recently reported better-than-expected results, saying their cloud strategies were paying off.

SAP's non-IFRS operating margin rose to 28.9 percent in the second quarter compared with 23.4 percent in the first quarter of 2016 and 28 percent in the second quarter of last year.

SAP shares were indicated to open 4.2 percent higher, outperforming the German blue chip index <.GDAXI> which was indicated 0.2 percent higher.

"SAP reported a second quarter with very strong operating profit and margin way above expectations," said a Frankfurt-based trader.

"Revenues were in line as cloud revenues hit estimates while licenses surprised positively."

SAP's stock has lost 2.8 percent so far this year, broadly in line with the STOXX Europe 600 Technology index <.SX8P> which is down 3.8 percent as the global economy and a slowdown in business spending weigh on the sector's sentiment.

SAP said it still expected full-year operating profit to come to between 6.4 billion and 6.7 billion euros.

Analysts polled by Reuters forecast a 2016 profit of 6.61 billion euros, with individual estimates of 18 analysts ranging from 6.42 billion to 7.05 billion euros.

SAP's Chief Executive Bill McDermott told journalists that SAP did not experience a negative impact from Britain's decision to leave the European Union.

Some analysts had expected a negative effect following the June 23 Brexit vote. Software companies traditionally generate 50 to 60 percent of their quarterly license business in the last two weeks of the quarter.

(Editing by Maria Sheahan and Richard Pullin)