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: 

Current Date to Date field

former_member205400
Active Participant
0 Kudos

I have a DSO that has a date field like:

ZDATE DATS 8 references 0date

and I have a transformation that needs to load the run_date.

So my abap looks like:

DATA: my_date(10) type C.

DATA: my_mm(2) type C,

my_dd(2) type C,

my_yy(4) type C.

WRITE sy-datum to my_date MM/DD/YYYY.

my_mm = my_date+0(2).

my_dd = my_date+3(2).

my_yy = my_date+6(4).

concatenate my_mm my_dd my_yy to zdate

but this fails to activate in my DSO because its the wrong format.

I'm not getting that. Do I somehow have to specify that my variable is like 0DATE?

1 ACCEPTED SOLUTION

former_member787646
Contributor
0 Kudos

HI,

You have to concatenate the variables as follows...

concatenate my_yy my_mm my_dd to zdate. (YYYYMMDD Format).

Hope it helps you.

Murthy

6 REPLIES 6

nikhil_chitre
Active Participant
0 Kudos

Hi,

Use FM 'CONVERT_DATE_TO_INTERN_FORMAT'

give exporting parameters as

datum = (Date you wat to convert)

dtype = 'DATS'

importing

  • ERROR =

idate = l_budat

  • MESSG =

  • MSGLN =

This should correct your error.

Regards,

Nikhil

Edited by: Nikhil A Chitre on Jul 11, 2008 11:12 AM

Edited by: Nikhil A Chitre on Jul 11, 2008 11:14 AM

former_member787646
Contributor
0 Kudos

HI,

You have to concatenate the variables as follows...

concatenate my_yy my_mm my_dd to zdate. (YYYYMMDD Format).

Hope it helps you.

Murthy

Former Member
0 Kudos

Try to use:

concatenate my_yy my_mm my_dd to zdate.

As zdate is a dats field so it stores date internally in YYYYMMDD format.

Regards,

Joy.

former_member598013
Active Contributor
0 Kudos

Hi Michael,

Use the Function Module: 'CONVERT_DATE_TO_INTERN_FORMAT'

&************Reward point if helpful**************&

0 Kudos

We didnt have the FM 'CONVERT_DATE_TO_INTERN_FORMAT'

Also, just changing the order of the fields was a quick change.

I was putting in the wrong format mmddyyyy and so using yyyymmdd solved the problem.

Thanks a bunch

Former Member
0 Kudos

Hi,

Check out with this code hope this will help u.

DATA: my_date(10) type C,

z_date(10) type c.

DATA: my_mm(2) type C,

my_dd(2) type C,

my_yy(4) type C.

WRITE sy-datum to my_date .

write my_date.

my_yy = my_date+0(4).

my_mm = my_date+5(2).

my_dd = my_date+8(2).

concatenate my_yy my_mm my_dd into z_date.

write: z_date.

Regards,

Sravanthi