[ABAP] OS-Platform ermitteln

TRY.
    DATA(lv_platform) = cl_gui_frontend_services=>get_platform( ).

    CASE lv_platform.
      WHEN cl_gui_frontend_services=>platform_aix.
        WRITE / 'aix'.
      WHEN cl_gui_frontend_services=>platform_hpux.
        WRITE / 'hpux'.
      WHEN cl_gui_frontend_services=>platform_linux.
        WRITE / 'linux'.
      WHEN cl_gui_frontend_services=>platform_mac.
        WRITE / 'mac'.
      WHEN cl_gui_frontend_services=>platform_macosx.
        WRITE / 'macosx'.
      WHEN cl_gui_frontend_services=>platform_nt351.
        WRITE / 'nt351'.
      WHEN cl_gui_frontend_services=>platform_nt40.
        WRITE / 'nt40'.
      WHEN cl_gui_frontend_services=>platform_nt50.
        WRITE / 'nt50'.
      WHEN cl_gui_frontend_services=>platform_os2.
        WRITE / 'os2'.
      WHEN cl_gui_frontend_services=>platform_solaris.
        WRITE / 'solaris'.
      WHEN cl_gui_frontend_services=>platform_tru64.
        WRITE / 'tru64'.
      WHEN cl_gui_frontend_services=>platform_unknown.
        WRITE / 'unknown'.
      WHEN cl_gui_frontend_services=>platform_windows95.
        WRITE / 'windows95'.
      WHEN cl_gui_frontend_services=>platform_windows98.
        WRITE / 'windows98'.
      WHEN cl_gui_frontend_services=>platform_windowsxp.
        WRITE / 'windowsxp'.
      WHEN OTHERS.
        WRITE / 'Other'.
    ENDCASE.
  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.

Windows Betriebssystemversion ermitteln

using System;

/// <summary>
/// freeware helper class for getting OS info
/// (W) 2011 by admin of codezentrale.de
/// </summary>
public static class OSVersion
{
    /// <summary>
    /// version string for current system
    /// </summary>
    public static string VersionString
    {
        get
        {
            string sRetVal = string.Empty;

            Version osver = Environment.OSVersion.Version;

            switch (Environment.OSVersion.Platform)
            {
                // Windows 95 wird von .NET nicht unterstützt
                // Windows 98, Windows 98SE, Windows Me
                case PlatformID.Win32Windows:
                    if (osver.Major == 4)
                    {
                        switch (osver.Minor)
                        {
                            case 10: sRetVal = "Windows 98"; break;
                            case 90: sRetVal = "Windows Me"; break;
                        }
                    }
                    break;
                case PlatformID.Win32NT:
                    // Windows NT 3.51 wird von .NET nicht unterstützt
                    // Windows NT 4.0
                    if (osver.Major == 4) sRetVal = "Windows NT 4.0";

                    // Windows 2000, XP, Server 2003
                    if (osver.Major == 5)
                    {
                        switch (osver.Minor)
                        {
                            case 0: sRetVal = "Windows 2000"; break;
                            case 1: sRetVal = "Windows XP"; break;
                            case 2: sRetVal = "Windows Server 2003"; break;
                        }
                    }
                    // Windows Vista, Windows Server 2008, Windows 7
                    if (osver.Major == 6)
                    {
                        switch (osver.Minor)
                        {
                            case 0: sRetVal = "Windows Vista / Windows Server 2008"; break;
                            case 1: sRetVal = "Windows 7 / Windows Server 2008 R2"; break;
                            case 2: sRetVal = "Windows 8 / Windows Server 2012"; break;
                        }
                    }
                    break;
            }

            if (sRetVal == string.Empty) sRetVal = "unbekannte oder von .NET nicht unterstützte Windows-Version";
            else sRetVal += " [" + Environment.OSVersion.VersionString + ", rev " + osver.Revision.ToString() + "]";

            return sRetVal;
        }
    }
}