10-16-2007 6:23 AM
Hi experts,
I need to create a function module to convert time based on country.
i.e if user asked to display the US time it should come and if he wants uk it should come rather than Indian time.
Is there any table where I can get times of all countries?
10-16-2007 6:25 AM
Hi,
check this code
TYPE-POOLS: tstr.
DATA :
timestamp LIKE tzonref-tstamps,
time LIKE sy-uzeit,
date LIKE sy-datum.
DATA: timezone TYPE tstr_tzone.
PARAMETERS: p_land1 TYPE land1.
* Get Timezone for the country.
CALL FUNCTION 'BORRS_LOCATION_TIMEZONE'
EXPORTING
if_country = p_land1
IMPORTING
ef_timezone = timezone
EXCEPTIONS
no_timezone_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Get the timestamp.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = sy-datum
i_timlo = sy-uzeit
i_tzone = sy-zonlo
IMPORTING
e_timestamp = timestamp.
* Convert timestamp.
CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
EXPORTING
i_timestamp = timestamp
i_tzone = timezone
IMPORTING
e_datlo = date
e_timlo = time.
WRITE 😕 'Date and Time zone for time zone', timezone, ' is ',
date, time.
Thanks
Naren
10-16-2007 6:25 AM
Hi,
check this code
TYPE-POOLS: tstr.
DATA :
timestamp LIKE tzonref-tstamps,
time LIKE sy-uzeit,
date LIKE sy-datum.
DATA: timezone TYPE tstr_tzone.
PARAMETERS: p_land1 TYPE land1.
* Get Timezone for the country.
CALL FUNCTION 'BORRS_LOCATION_TIMEZONE'
EXPORTING
if_country = p_land1
IMPORTING
ef_timezone = timezone
EXCEPTIONS
no_timezone_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Get the timestamp.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = sy-datum
i_timlo = sy-uzeit
i_tzone = sy-zonlo
IMPORTING
e_timestamp = timestamp.
* Convert timestamp.
CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
EXPORTING
i_timestamp = timestamp
i_tzone = timezone
IMPORTING
e_datlo = date
e_timlo = time.
WRITE 😕 'Date and Time zone for time zone', timezone, ' is ',
date, time.
Thanks
Naren
10-16-2007 6:29 AM
hi,
I can't use convert function module,
I need to crearte a function module for this requriement