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: 

casting char to DATS

Former Member
0 Kudos

Hi All!

How can I convert currDate -> SYSTDATLO or DATS

e.g.

data currDate(10) type c value '01.09.2007'.

Bye

sas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I am not sure whether there is a FM which converts date from dd.mm.yyyy to yyyymmdd. Otherwise you have to manually convert dd.mm.yyyy to yyyymmdd format to do the comparison.

Split date1(which has dd.mm.yyyy) into date month year at '.'.

Then

Concatenate year month date into date2.

Now date2 has the format yyyymmdd. It can be compared witht he other date.

Hope this helps.

Thanks,

Naren

4 REPLIES 4

Former Member
0 Kudos

I am not sure whether there is a FM which converts date from dd.mm.yyyy to yyyymmdd. Otherwise you have to manually convert dd.mm.yyyy to yyyymmdd format to do the comparison.

Split date1(which has dd.mm.yyyy) into date month year at '.'.

Then

Concatenate year month date into date2.

Now date2 has the format yyyymmdd. It can be compared witht he other date.

Hope this helps.

Thanks,

Naren

Former Member
0 Kudos

Hi there,,

Try the following code,, this will resolve your issue.

data currDate(10) type c value '01.09.2007'. " mm.dd.yyyy

data : v_date like sy-datum.

concatenate currDate6(4) currdate3(2) currdate+0(2) into v_date.

write:/ v_date.

Former Member
0 Kudos

hi,

you can use this FM as follows:

data currDate(10) type c value '01.09.2007'.

data v TYPE DATS.

START-OF-SELECTION.

WRITE CURRDATE TO V.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

DATE_EXTERNAL = currdate

  • ACCEPT_INITIAL_DATE =

IMPORTING

DATE_INTERNAL = v

  • EXCEPTIONS

  • DATE_EXTERNAL_IS_INVALID = 1

  • OTHERS = 2

.

it will give what you want .

Former Member
0 Kudos

Rahul thanks but this is not working. It is dumping

thx

sas

data tmstmp type TZNTSTMPS.

data currDate(10) type c value '01.09.2007'.

data : v_date type dats.

concatenate currDate6(4) currdate3(2) currdate+0(2) into v_date.

CALL FUNCTION 'ABI_TIMESTAMP_CONVERT_INTO'

EXPORTING

iv_date = v_date

iv_time = '00:00:00'

IMPORTING

EV_TIMESTAMP = tmstmp .