SAP Function Modules

TIME_UNITS SAP Function module - Determine internal time units







TIME_UNITS is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name TIME_UNITS into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: C0UN
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM TIME_UNITS - TIME UNITS





CALL FUNCTION 'TIME_UNITS' "Determine internal time units
  IMPORTING
    second =                    " t006-msehi    Internal time unit for second
    minute =                    " t006-msehi    Internal time unit for minute
    hour =                      " t006-msehi    Internal time unit for hour
    day =                       " t006-msehi    Internal time unit for day
    week =                      " t006-msehi    Internal time unit for week
    month =                     " t006-msehi    Internal time unit for month
    year =                      " t006-msehi    Internal time unit for year
    decade =                    " t006-msehi    Internal time unit for decade
    ind_minute =                " t006-msehi    Internal time unit for industry minute
    ind_hour =                  " t006-msehi    Internal time unit for industry hour
    flg_hour_tmp =              "
    flg_day_tmp =               "
  EXCEPTIONS
    SI_UNIT_MISSING = 1         "               SI unit or dimension does not exist
    .  "  TIME_UNITS

ABAP code example for Function Module TIME_UNITS





The ABAP code below is a full code listing to execute function module TIME_UNITS including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_second  TYPE T006-MSEHI ,
ld_minute  TYPE T006-MSEHI ,
ld_hour  TYPE T006-MSEHI ,
ld_day  TYPE T006-MSEHI ,
ld_week  TYPE T006-MSEHI ,
ld_month  TYPE T006-MSEHI ,
ld_year  TYPE T006-MSEHI ,
ld_decade  TYPE T006-MSEHI ,
ld_ind_minute  TYPE T006-MSEHI ,
ld_ind_hour  TYPE T006-MSEHI ,
ld_flg_hour_tmp  TYPE STRING ,
ld_flg_day_tmp  TYPE STRING .
. CALL FUNCTION 'TIME_UNITS' IMPORTING second = ld_second minute = ld_minute hour = ld_hour day = ld_day week = ld_week month = ld_month year = ld_year decade = ld_decade ind_minute = ld_ind_minute ind_hour = ld_ind_hour flg_hour_tmp = ld_flg_hour_tmp flg_day_tmp = ld_flg_day_tmp EXCEPTIONS SI_UNIT_MISSING = 1 . " TIME_UNITS
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_second  TYPE T006-MSEHI ,
ld_minute  TYPE T006-MSEHI ,
ld_hour  TYPE T006-MSEHI ,
ld_day  TYPE T006-MSEHI ,
ld_week  TYPE T006-MSEHI ,
ld_month  TYPE T006-MSEHI ,
ld_year  TYPE T006-MSEHI ,
ld_decade  TYPE T006-MSEHI ,
ld_ind_minute  TYPE T006-MSEHI ,
ld_ind_hour  TYPE T006-MSEHI ,
ld_flg_hour_tmp  TYPE STRING ,
ld_flg_day_tmp  TYPE STRING .

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name TIME_UNITS or its description.