SAP CY_GET_TIMEINTERVAL Function Module for Computes start date and finish date according to given period type









CY_GET_TIMEINTERVAL is a standard cy get timeinterval SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Computes start date and finish date according to given period type processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for cy get timeinterval FM, simply by entering the name CY_GET_TIMEINTERVAL into the relevant SAP transaction such as SE37 or SE38.

Function Group: CYCP
Program Name: SAPLCYCP
Main Program: SAPLCYCP
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CY_GET_TIMEINTERVAL pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'CY_GET_TIMEINTERVAL'"Computes start date and finish date according to given period type
EXPORTING
* CALENDAR_ID = ' ' "Calendar ID
* FISCAL_YEAR_VARIANT = ' ' "Fiscal year variant
PERIOD_TYPE = "Period type
SDATEFROM = "Start of interval
* SDATETO = ' ' "End of interval

IMPORTING
DATEFROM = "Start date of interval
DATEFROM_STRING = "Start date of interval as string
DATETO = "Finish date of interval
DATETO_STRING = "Finish date of interval as string

EXCEPTIONS
INTERVAL_CANNOT_BE_COMPUTED = 1
.



IMPORTING Parameters details for CY_GET_TIMEINTERVAL

CALENDAR_ID - Calendar ID

Data type: RC65A-KALID
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

FISCAL_YEAR_VARIANT - Fiscal year variant

Data type: RC65A-PERIV
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

PERIOD_TYPE - Period type

Data type: RC65A-DATE_TYPE
Optional: No
Call by Reference: No ( called with pass by value option)

SDATEFROM - Start of interval

Data type: RC65A-DBDATEFROM
Optional: No
Call by Reference: No ( called with pass by value option)

SDATETO - End of interval

Data type: RC65A-DBDATETO
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for CY_GET_TIMEINTERVAL

DATEFROM - Start date of interval

Data type: RC65A-LIDAV
Optional: No
Call by Reference: No ( called with pass by value option)

DATEFROM_STRING - Start date of interval as string

Data type: RC65A-DBDATEFROM
Optional: No
Call by Reference: No ( called with pass by value option)

DATETO - Finish date of interval

Data type: RC65A-LIDAB
Optional: No
Call by Reference: No ( called with pass by value option)

DATETO_STRING - Finish date of interval as string

Data type: RC65A-DBDATEFROM
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

INTERVAL_CANNOT_BE_COMPUTED - Dates not computed for various reasons

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for CY_GET_TIMEINTERVAL Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.

DATA:
lv_datefrom  TYPE RC65A-LIDAV, "   
lv_calendar_id  TYPE RC65A-KALID, "   SPACE
lv_interval_cannot_be_computed  TYPE RC65A, "   
lv_datefrom_string  TYPE RC65A-DBDATEFROM, "   
lv_fiscal_year_variant  TYPE RC65A-PERIV, "   SPACE
lv_dateto  TYPE RC65A-LIDAB, "   
lv_period_type  TYPE RC65A-DATE_TYPE, "   
lv_sdatefrom  TYPE RC65A-DBDATEFROM, "   
lv_dateto_string  TYPE RC65A-DBDATEFROM, "   
lv_sdateto  TYPE RC65A-DBDATETO. "   SPACE

  CALL FUNCTION 'CY_GET_TIMEINTERVAL'  "Computes start date and finish date according to given period type
    EXPORTING
         CALENDAR_ID = lv_calendar_id
         FISCAL_YEAR_VARIANT = lv_fiscal_year_variant
         PERIOD_TYPE = lv_period_type
         SDATEFROM = lv_sdatefrom
         SDATETO = lv_sdateto
    IMPORTING
         DATEFROM = lv_datefrom
         DATEFROM_STRING = lv_datefrom_string
         DATETO = lv_dateto
         DATETO_STRING = lv_dateto_string
    EXCEPTIONS
        INTERVAL_CANNOT_BE_COMPUTED = 1
. " CY_GET_TIMEINTERVAL




ABAP code using 7.40 inline data declarations to call FM CY_GET_TIMEINTERVAL

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single LIDAV FROM RC65A INTO @DATA(ld_datefrom).
 
"SELECT single KALID FROM RC65A INTO @DATA(ld_calendar_id).
DATA(ld_calendar_id) = ' '.
 
 
"SELECT single DBDATEFROM FROM RC65A INTO @DATA(ld_datefrom_string).
 
"SELECT single PERIV FROM RC65A INTO @DATA(ld_fiscal_year_variant).
DATA(ld_fiscal_year_variant) = ' '.
 
"SELECT single LIDAB FROM RC65A INTO @DATA(ld_dateto).
 
"SELECT single DATE_TYPE FROM RC65A INTO @DATA(ld_period_type).
 
"SELECT single DBDATEFROM FROM RC65A INTO @DATA(ld_sdatefrom).
 
"SELECT single DBDATEFROM FROM RC65A INTO @DATA(ld_dateto_string).
 
"SELECT single DBDATETO FROM RC65A INTO @DATA(ld_sdateto).
DATA(ld_sdateto) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!