SYST-UZEIT in Formula Builder

Access to the BW Netweaver BW Application server date and time system fields in the SYST table is useful. Especially when automating data processing in Process Chains and Transformations.

The SY-DATUM field is the current application server date.
For Example: 19991231, 20080631, 20140317 and 20190723.

The SY-UZEIT field is the current application server time.
For Example: 020000, 083000, 115959, and 200000.

The list of available system fields in the Formula Builder should look like this:

BW Formula Builder System Fields (Including UZEIT)

You should have access to all four SYST date and time fields: DATUM, UZEIT, DATLO and TIMLO.

“unfortunately the SYST-UZEIT system field is
usually missing from the list of system fields”

Implement this interface method to enable access to the SYST-UZEIT system field in the BW Formula Builder.

method IF_EX_RSAR_CONNECTOR~GET.
*--------------------------------------------------------------------*
* Code Name: zlbw-cl-fb-c-syst-uzeit-if-ex-rsar-connector-get        *
* Code URI: http://lnxbw.co/hgyk-cod-1                               *
* Description: Enable access to the 'Current Time (SYST-UZEIT)'      *
* field in the SAP BW Formula Builder engine.                        *
* Version: 1.0.0                                                     *
* Author: John Lang                                                  *
* Author URI: https://www.johnlang.com.au/                           *
* License: BSD-New                                                   *
* License URI: http://opensource.org/licenses/BSD-3-Clause           *
*--------------------------------------------------------------------*
* Copyright (c) 2014, John Lang. All rights reserved.                *
*                                                                    *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met:                                                           *
*                                                                    *
* 1. Redistributions of source code must retain the above copyright  *
* notice, this list of conditions and the following disclaimer.      *
*                                                                    *
* 2. Redistributions in binary form must reproduce the above         *
* copyright notice, this list of conditions and the following        *
* disclaimer in the documentation and/or other materials provided    *
* with the distribution.                                             *
*                                                                    *
* 3. Neither the name of the copyright holder nor the names of its   *
* contributors may be used to endorse or promote products derived    *
* from this software without specific prior written permission.      *
*                                                                    *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,        *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           *
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS *
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,           *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED    *
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,      *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON  *
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,    *
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT *
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE.                                                       *
*--------------------------------------------------------------------*
* This is part of a Classic BAdI implementation (Transaction SE19).


constants:
  c_cat_tech type sfbefsym value 'C_SYST',
  c_cat_desc type c length 65 value 'System Fields (Custom)',
  c_fld_tech type sfbefsym value 'SYST-UZEIT',
  c_fld_desc type c length 65 value 'Current Time',
  c_fld_icon type icon_text value '@KRField@',
  c_fld_type type sfbetype value 'SYST-UZEIT'.
data: wa_fld type sfbeoprnd.

* Are we building the list of categories?
if i_key = space.

* Is the category already in the category list?
  read table c_operands transporting no fields
       with key tech_name = c_cat_tech.
  if sy-subrc <> 0.
*   No ... Add the category to the category list.
    clear: wa_fld.
    wa_fld-tech_name = c_cat_tech.
    wa_fld-descriptn = c_cat_desc.
    append wa_fld to c_operands.
  endif.

* Are we building the list of fields in the category?
  elseif i_key = c_cat_tech.

*   Is the field already in the category?
    read table c_operands transporting no fields
         with key tech_name = c_fld_tech.
    if sy-subrc <> 0.

*     No ... Add the field to the category.
      clear: wa_fld.
      wa_fld-tech_name = c_fld_tech.
      wa_fld-descriptn = c_fld_desc.
      wa_fld-icon = c_fld_icon.
      wa_fld-type = c_fld_type.
      append wa_fld to c_operands.
    endif.
  endif.
endmethod.

Implemented in 3 easy steps:

  1. Save the SYST-UZEIT code snippet;
  2. Create an ABAP Class for the IF_EX_RSAR_CONNECTOR interface;
    Further Reading: Transformation Library and Formula Builder.
  3. Create a Business Add-In (BAdI) to call the new class interface.
    Further Reading: BAdI for Customer-Defined Functions in the Formula Builder.