SAP Tutorials Blog


 

 


DATA ts7 TYPE utclong.

ts7 = utclong_current( ).

DATA ts8 TYPE utclong VALUE '2024-11-05 15:30:00'.

DATA(ts9) = CONV utclong( '2024-11-03 05:30:00' ).


"Using XCO

"As above, the return value is of type string. Various methods, formatting options,

"etc. are available.

DATA(ts10) = xco_cp_time=>moment( iv_year   = '2024'

                                  iv_month  = '01'

                                  iv_day    = '01'

                                  iv_hour   = '12'

                                  iv_minute = '34'

                                  iv_second = '55' 

                                )->as( xco_cp_time=>format->iso_8601_extended 

                                )->value.


*&---------------------------------------------------------------------*

*& Modifying time stamps (XCO)

*&---------------------------------------------------------------------*


"As covered for date and time types, you can modify time stamps using string 

"processing functionalities. They are not covered here. XCO provides, for 

"example, the 'overwrite' method. Optional parameters are available.

DATA(ts11) = xco_cp_time=>moment( iv_year   = '2024'

                                  iv_month  = '03'

                                  iv_day    = '05'

                                  iv_hour   = '02'

                                  iv_minute = '54'

                                  iv_second = '12' ).


"2025-07-15T01:54:12

DATA(ts12) = ts11->overwrite( iv_year = '2025' 

                              iv_month = '07' 

                              iv_day = '15' 

                              iv_hour = '01'

                            )->as( xco_cp_time=>format->iso_8601_extended 

                            )->value.


Serkan AKKAVAK

Computer Engineer BSc

Head of SAP & Software Department

Contact : serkurumsal@yandex.com