SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

How to Check Installed Excel Version in ABAP


ABAP programmers can check installed Excel version using ABAP class method cl_gui_frontend_services=>registry_get_value. I will share sample ABAP program codes to read registry entry using ABAP static class method cl_gui_frontend_services=>registry_get_value with corresponding registy path and registry key in this ABAP tutorial.

Excel version on a computer can be viewed by looking its registry entry as seen in following screenshot.

check Excel version by ABAP code

You can see in the registry screenshot that the registry key is can be reached by following registry path:
HKEY_CLASSES_ROOT\EXCEL.APPLICATION\CURVER

From our previous ABAP tutorials, SAP developers can remember read registry entries using ABAP class cl_gui_frontend_services and its static method registry_get_value
Let's use ABAP class method cl_gui_frontend_services=>registry_get_value and read registry entry for installed Excel application version on a computer.

data lv_version type string.

call method cl_gui_frontend_services=>registry_get_value
 exporting
  root = 0 " => HKEY_CLASSES_ROOT
  key = 'EXCEL.APPLICATION\CURVER'
 importing
  reg_value= lv_version
 exceptions
  get_regvalue_failed = 1
  cntl_error = 2
  error_no_gui = 3
  not_supported_by_gui = 4
  others = 5.
Code

The returned lv_version variable will include the Excel version.
You can map the application version to Excel product using below table.

Excel 97 = 8
Excel 2000 = 9
Excel 2002 = 10
Excel 2003 = 11
Excel 2007 = 12
Excel 2010 = 14
Excel 2013 = 15
Excel 2016 = 16

For example, I have "Excel.Application.16" for returned lv_version variable when I execute above ABAP code which maps to Microsoft Excel 2016



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.