Skip to Content
-1

How to get destop/pc time SAP ABAP

Hi,

I want to fetch the desktop/pc time into a variable.I used sy-uzeit,it is for application server time.But I need my desktop time using SAP ABAP.

Regards,

Shabbir

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 07 at 11:30 AM

    An idea to do it, but you didn't explain yet, if you connect with

    • SAP GUI for Windows
    • SAP GUI for Java
    • SAP GUI for MacOS
    • ITS
    • Netweaver Business Client
    • SAP GUI runs on Terminal server
    • ...
    METHOD desktop_datetime.
    
    *   Alternative:
    *   CL_GUI_HTML_VIEWER with SAPEVENT
    
        DATA:
          lt_clip     TYPE TABLE OF docs,
          lc_datetime TYPE string,
          li_length   TYPE i.
    
        CALL METHOD cl_gui_frontend_services=>execute
          EXPORTING
            application = 'cmd.exe'
            parameter   = '/c echo %date% %time% | clip'
            minimized   = 'X'
            synchronous = 'X'
          EXCEPTIONS
            OTHERS      = 1.
        CHECK sy-subrc EQ 0.
    
        CALL METHOD cl_gui_frontend_services=>clipboard_import
          IMPORTING
            data   = lt_clip
            length = li_length
          EXCEPTIONS
            OTHERS = 1.
        CHECK sy-subrc EQ 0.
    
        READ TABLE lt_clip INTO lc_datetime INDEX 1.
        CHECK sy-subrc EQ 0.
    
        WRITE: / lc_datetime.
    
      ENDMETHOD.
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 07 at 01:04 PM

    Maybe you'll prefer SY-DATLO and SY-TIMLO. It's the time based on the time zone in the SAP user's profile. It should be setup correctly of course.

    Add comment
    10|10000 characters needed characters exceeded