Determining the SAP Logon Client Version for a User in ABAP program

Determining the SAP Logon Client Version for a User in ABAP program

Explanation of the Issue

The vendor regularly releases updates for SAP Logon, fixing various bugs identified by users and developers during use. These software bugs or shortcomings in SAP Logon, although indirectly, can impact the behavior of your developments. This may manifest as incorrect program behavior for specific users.

This issue is especially relevant in organizations where software is not centrally managed, resulting in users having different versions and patch levels of the SAP Logon client—including versions no longer supported by the vendor.

It is possible to determine a user’s SAP Logon client and patch version using ABAP.

Solution

Use the get_gui_version method from the class cl_gui_frontend_services in your development:

DATA: lt_vtab  TYPE  filetable,
      lt_vinfo TYPE file_table,
      rc       TYPE i.
 
CALL METHOD cl_gui_frontend_services=>get_gui_version
  CHANGING
    version_table            = lt_vtab
    rc                       = rc
  EXCEPTIONS
    get_gui_version_failed   = 1
    cant_write_version_table = 2
    gui_no_version           = 3
    cntl_error               = 4
    error_no_gui             = 5
    not_supported_by_gui     = 6
    OTHERS                   = 7.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
 
 
read table lt_vtab into lt_vinfo index 1.
write:/ 'SAP GUI' , lt_vinfo.
read table lt_vtab into lt_vinfo index 4.
write:/ 'SAP GUI build' , lt_vinfo.
read table lt_vtab into lt_vinfo index 3.
write:/ 'SAP GUI patch' , lt_vinfo.

As a result of calling this method, you can retrieve information similar to the following: