Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Convert COEP-TIMESTMP to date and time

Former Member
0 Kudos

Hi,

i would like to convert this field into date and time. I have tried several FM's, but no result.

The entries in COEP-TIMESTMP are f. example: 5.111.976.730.000 or 5111976730000

Has anyone an idea?

Thanks,

regards, Dieter

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

> TIMESTMP = ( COEP-TIMESTMP DIV 10000 ) + SY-TZONE.

> IF NOT SY-DAYST IS INITIAL.

> TIMESTMP = TIMESTMP + 86400.

> ENDIF.

> TIME = TIMESTMP MOD 86400.

> DATE = '19900101' + TIMESTMP DIV 86400.

Regards

9 REPLIES 9

Former Member
0 Kudos

Hi Dieter,

Does this work for you?

CONVERT TIME STAMP time_stamp TIME ZONE tz

INTO DATE dat TIME tim

DAYLIGHT SAVING TIME dst.

Regards,

Jr.

Lakshmant1
Active Contributor
0 Kudos

Hi Dieter,

Check FM CIF_GEN_CONVERT_TIMESTAMP

Thanks

Lakshman

former_member387317
Active Contributor
0 Kudos

Hi Dieter,

Please Go through below blog.

/people/horst.keller/blog/2004/11/29/abap-geek-8-150-summertime-blues-133

Tryout below FMs...

RKE_TIMESTAMP_CONVERT_INPUT (Convert local time/date to GMT)

Please try this FM RKE_TIMESTAMP_CONVERT_OUTPUT (Convert GMT to local time/date).


...

move COEP-TIMESTMP to timestmp.

CALL FUNCTION 'RKE_TIMESTAMP_CONVERT_OUTPUT'
EXPORTING i_dayst = sy-dayst
i_tzone = sy-tzone
i_timestmp = timestmp
IMPORTING e_date = wa_date
e_time = wa_time.

write: / wa_date, wa_time.

Hope it will solve your problem..

Reward points if useful...

Thanks & Regards

ilesh 24x7

raymond_giuseppi
Active Contributor
0 Kudos

> TIMESTMP = ( COEP-TIMESTMP DIV 10000 ) + SY-TZONE.

> IF NOT SY-DAYST IS INITIAL.

> TIMESTMP = TIMESTMP + 86400.

> ENDIF.

> TIME = TIMESTMP MOD 86400.

> DATE = '19900101' + TIMESTMP DIV 86400.

Regards

0 Kudos

Hi Raymond,

thanks for your answer. i do it in this way:

TABLES: COEP.

*

DATA: UZEIT LIKE SY-UZEIT.

DATA: DATUM LIKE SY-DATUM.

DATA: TIMESTMP LIKE COEP-TIMESTMP.

  • DATA: TIMESTMP TYPE TIMESTAMP.

*

SELECT * FROM COEP WHERE KOKRS = '0065'

AND BELNR = '0900038638'.

*

WRITE: / COEP-TIMESTMP.

*

TIMESTMP = ( COEP-TIMESTMP DIV 10000 ) + SY-TZONE.

*

IF NOT SY-DAYST IS INITIAL.

TIMESTMP = TIMESTMP + 86400.

ENDIF.

UZEIT = TIMESTMP MOD 86400.

DATUM = '19900101' + TIMESTMP DIV 86400.

*

WRITE: DATUM, UZEIT.

*

*

ENDSELECT.

but for DATUM i get only 00.00.0000. UZEIT is correct. any idea?

Regards, Dieter

0 Kudos

OK.. try like this

Hi Raymond,

thanks for your answer. i do it in this way:

TABLES: COEP.

*

DATA: UZEIT LIKE SY-UZEIT.

DATA: DATUM LIKE SY-DATUM.

DATA: TIMESTMP LIKE COEP-TIMESTMP.


DATA : date TYPE sy-datum VALUE '19900101'.
  • DATA: TIMESTMP TYPE TIMESTAMP.

*

SELECT * FROM COEP WHERE KOKRS = '0065'

AND BELNR = '0900038638'.

*

WRITE: / COEP-TIMESTMP.

*

TIMESTMP = ( COEP-TIMESTMP DIV 10000 ) + SY-TZONE.

*

IF NOT SY-DAYST IS INITIAL.

TIMESTMP = TIMESTMP + 86400.

ENDIF.

UZEIT = TIMESTMP MOD 86400.


   DATUM = date + TIMESTMP DIV 86400.

*

WRITE: DATUM, UZEIT.

*

*

ENDSELECT.

but for DATUM i get only 00.00.0000. UZEIT is correct. any idea?

Regards, Dieter

0 Kudos

Hi Perez,

that's it.

Thanks.

Regards, Dieter

Former Member
0 Kudos

Hi,

thanks for anwers, but i don't get the right result. I have looked a little bit more

and i find that the field COEP-TIMESTMP doesn't have the strukture YYYYMMDDHHMMSS.

It contains the seconds from 01.01.1900.

COEP-TIMESTMP is domain: RKE_TSTMP (Sekunden seit 1.1.1990,0:00 Uhr Greenwich Meantime * 10000).

Therefore i think i have to calculate it in an other way.

Thanks

Regards, Dieter

matt
Active Contributor
0 Kudos

In case anyone else finds this, the real correct answer is use FM RKE_TIMESTAMP_CONVERT_OUTPUT