UPDATE 1-SAP posts Q2 profit below forecast on higher cloud costs

(Adds cost details; 2017 outlook, new 500 mln euro share buyback)

FRANKFURT, July 20 (Reuters) - SAP, Europe's most valuable technology firm, posted rapid growth in its cloud services business in both revenue as well as expenses, putting a damper on its quarterly operating profit, which came in slightly below expectations.

The German company reported revenue for the second quarter rose 10.4 percent to 5.78 billion euros ($6.65 billion) from a year ago, beating average analyst expectations of 5.71 billion euros, according to a Reuters poll.

SAP, the world's biggest maker of business planning software used by multinationals, said core profits excluding special items, rose 3 percent in constant currencies to 1.57 billion euros from a year-ago.

That was below the average forecast of 1.59 billion euros of 14 analysts polled by Reuters, with individual forecasts ranging from 1.46 billion to 1.66 billion euros.

Research and development costs rose 19 percent, while sales and marketing rose 16 percent compared to a year ago, when these increasing costs to drive future new cloud business growth were offset by prior restructuring benefits, SAP executives said.

Nonetheless, SAP said it expects to meet or slightly beat its full-year results targets. These forecasts exclude the impact of currency swings, where a recent rise in the euro has slightly dented international results after currency translation.

"We expect continuing momentum in the second half and confidently raise our guidance for the full year," SAP Chief Executive Bill McDermott said in a statement. SAP slightly increased its sales forecast for the full year, to a range between 23.3 billion and 23.7 billion euros from its prior target of 23.2 billion and 23.6 billion euros. It left its 2017 operating profit unchanged at around 6.8 billion to 7.0 billion euros.

The company also announced a planned 500 million euro share buyback to start shortly and to be carried out in several tranches through the remainder of 2017.

Including special items under IFRS accounting standards, SAP's second-quarter operating profit fell 27 percent, weighed down by restructuring and stock option costs.

The latest quarter also faced difficult comparisons with a record-breaking year-ago second quarter, when it had reported double-digit operating profit growth based on both IFRS and non-IFRS accounting standards. ($1 = 0.8693 euros) (Reporting By Eric Auchard and Ilona Wissenbach in Frankfurt; Editing by Edward Taylor and Biju Dwarakanath)