Time zone in SAP
Some Time Requirement to Change time zone one place to another place so we can have some function module we can change according to your need well this scenario used by most to change time zone
FUNCTION ZTIMEZONES_ZONE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IM_TIME) TYPE SY-TIMLO
*" REFERENCE(IM_DATE) TYPE SY-DATLO
*" REFERENCE(IM_TZONE) TYPE TZONREF-TZONE
*" EXPORTING
*" REFERENCE(EX_TIME) TYPE SY-TIMLO
*" REFERENCE(EX_DATE) TYPE SY-DATUM
*"----------------------------------------------------------------------
DATA :
timestamp LIKE tzonref-tstamps.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = im_date
i_timlo = im_time
i_tzone = 'INDIA'
IMPORTING
e_timestamp = timestamp.
* The following function module is used to convert the
* above obtained timestamp to PST time zone date and time.
CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
EXPORTING
i_timestamp = timestamp
i_tzone = IM_TZONE
IMPORTING
e_datlo = ex_date
e_timlo = ex_time.
ENDFUNCTION.
FUNCTION ZTIMEZONES_ZONE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IM_TIME) TYPE SY-TIMLO
*" REFERENCE(IM_DATE) TYPE SY-DATLO
*" REFERENCE(IM_TZONE) TYPE TZONREF-TZONE
*" EXPORTING
*" REFERENCE(EX_TIME) TYPE SY-TIMLO
*" REFERENCE(EX_DATE) TYPE SY-DATUM
*"----------------------------------------------------------------------
DATA :
timestamp LIKE tzonref-tstamps.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = im_date
i_timlo = im_time
i_tzone = 'INDIA'
IMPORTING
e_timestamp = timestamp.
* The following function module is used to convert the
* above obtained timestamp to PST time zone date and time.
CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
EXPORTING
i_timestamp = timestamp
i_tzone = IM_TZONE
IMPORTING
e_datlo = ex_date
e_timlo = ex_time.
ENDFUNCTION.
Comments
Post a Comment