SAP Function Modules

END_TIME_DETERMINE SAP Function module - Calendar: Determine end date and time







END_TIME_DETERMINE 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 END_TIME_DETERMINE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SCA4
Released Date: 02.07.1997
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM END_TIME_DETERMINE - END TIME DETERMINE





CALL FUNCTION 'END_TIME_DETERMINE' "Calendar: Determine end date and time
* EXPORTING
*   duration = 0                "               Duration
*   unit =                      " t006-msehi    Time unit
*   factory_calendar =          " scal-fcalid   Factory calendar
  IMPORTING
    end_date =                  " sy-datum      End date
    end_time =                  " sy-uzeit      End Time
* CHANGING
*   start_date = SY-DATUM       " sy-datum      Time unit
*   start_time = SY-UZEIT       " sy-uzeit      Time unit
  EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1  "           Factory calendar not found
    DATE_OUT_OF_CALENDAR_RANGE = 2  "           Date outside factory calendar validity
    DATE_NOT_VALID = 3          "               Date is invalid
    UNIT_CONVERSION_ERROR = 4   "               Time unit conversion error
    SI_UNIT_MISSING = 5         "               Time unit missing
    PARAMETERS_NO_VALID = 6     "               Input parameters invalid
    .  "  END_TIME_DETERMINE

ABAP code example for Function Module END_TIME_DETERMINE





The ABAP code below is a full code listing to execute function module END_TIME_DETERMINE 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_end_date  TYPE SY-DATUM ,
ld_end_time  TYPE SY-UZEIT .

DATA(ld_start_date) = '20210129'.
DATA(ld_start_time) = 'Check type of data required'.
DATA(ld_duration) = 'some text here'.

SELECT single MSEHI
FROM T006
INTO @DATA(ld_unit).


DATA(ld_factory_calendar) = some text here . CALL FUNCTION 'END_TIME_DETERMINE' * EXPORTING * duration = ld_duration * unit = ld_unit * factory_calendar = ld_factory_calendar IMPORTING end_date = ld_end_date end_time = ld_end_time * CHANGING * start_date = ld_start_date * start_time = ld_start_time EXCEPTIONS FACTORY_CALENDAR_NOT_FOUND = 1 DATE_OUT_OF_CALENDAR_RANGE = 2 DATE_NOT_VALID = 3 UNIT_CONVERSION_ERROR = 4 SI_UNIT_MISSING = 5 PARAMETERS_NO_VALID = 6 . " END_TIME_DETERMINE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "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_start_date  TYPE SY-DATUM ,
ld_end_date  TYPE SY-DATUM ,
ld_duration  TYPE STRING ,
ld_start_time  TYPE SY-UZEIT ,
ld_end_time  TYPE SY-UZEIT ,
ld_unit  TYPE T006-MSEHI ,
ld_factory_calendar  TYPE SCAL-FCALID .

ld_start_date = '20210129'.
ld_duration = 'some text here'.
ld_start_time = 'Check type of data required'.

SELECT single MSEHI
FROM T006
INTO ld_unit.


ld_factory_calendar = some text here

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 END_TIME_DETERMINE or its description.