Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get destop/pc time SAP ABAP

former_member396057
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member

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.
4 REPLIES 4

Former Member
0 Kudos

Do you need time zone of desktop, too ?

former_member396057
Participant
0 Kudos

Hi Tibor,

Thanks for reply.

It is not required time zone of desktop.I need only desktop/pc time.

Former Member

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.

Sandra_Rossi
Active Contributor
0 Kudos

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.