Application Development and Automation 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: 
Read only

Date format change

Former Member
0 Likes
1,073

Hi All,

In my report, i have difference between date format...

I mean i have in flat file - 15.04.2008, but another date format is 20080415...

How can i convert it, my owned defined format..ie. 15.04.2008..

Plz tell the code...

Thanks..

11 REPLIES 11
Read only

Former Member
0 Likes
1,032

Hi,

REPORT ZJE_DATE.

data: date(10) type c,

date1 like date,

date2 like date.

date = sy-datum.

write:/ date.

write:/ sy-datum.

write:/ date using edit mask '____:__:__'.

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

DATUM = date

DTYPE = date1

IMPORTING

  • ERROR =

IDATE = date2

  • MESSG =

  • MSGLN =

.

write:/ date2.

Reward if Helpful,

Jagadsih

Read only

0 Likes
1,032

Hi Dear,

It gives an syntax error:-- Unable to interpret "Date2"..

How can i remove...

Read only

0 Likes
1,032

Hi Dear,

your answer is totally right..it convert into my format...but not updated in that t.code where the data going...

Plz tell..

Read only

prasanth_kasturi
Active Contributor
0 Likes
1,032

hi

data: date(10) type c,

date1 like date,

date2 like date.

date = sy-datum.

write:/ date.

write:/ sy-datum.

write:/ date using edit mask '____:__:__'.

or use the function module

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

DATUM = date

DTYPE = date1

IMPORTING

ERROR =

IDATE = date2

MESSG =

MSGLN =

.

write:/ date2.

Read only

Former Member
0 Likes
1,032

Hi Prince,

The answer to your query in in the SDN blogs at the below reference :

KCD_EXCEL_DATE_CONVERT

/people/himanshu.gupta/blog/2006/11/24/fms-to-convert-date-from-user-format-into-sap-standard

Reward if helpful,

Regards,

Esha Raj

Edited by: Esha Raj on Apr 23, 2008 6:13 AM

Read only

ak_upadhyay
Contributor
0 Likes
1,032

Hi,

Try...


DATA: GD_DATE(10), HD_DATE(10).

WA_HEADER-TYP = 'S'.
IF S1_BUDAT-LOW IS NOT INITIAL AND S1_BUDAT-HIGH IS NOT INITIAL.
WRITE S1_BUDAT-LOW TO GD_DATE YYYY/MM/DD.
WRITE S1_BUDAT-HIGH TO HD_DATE YYYY/MM/DD.
CONCATENATE 'Posting Date :' GD_DATE 'to' HD_DATE INTO WA_HEADER-INFO SEPARATED BY SPACE.
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER, GD_DATE, HD_DATE .

OR try this...


l_date1(10) type c,
l_date2(10) type c.

l_date1 = 'yyyy/mm/dd'.

concatenate l_date1+8(2) l_date1+6(2) l_date1(4) into l_date2 separated by '/'.

write: l_date2.

or u can use FM

CONVERT_DATE_TO_INTERN_FORMAT

KCD_EXCEL_DATE_CONVERT

Reward points if helpful...

Regards

AK

Read only

Former Member
0 Likes
1,032

Hi,

The date format used internally is based on the format set in our user profile.

So try changing the two variables to that of the format in the user profile.

data: v_date1(10),

v_date2(10).

write: <file_date1> to v_date1,

<file_date2> to v_date2.

Regards,

Vidya Chowdhary A.

Read only

Former Member
0 Likes
1,032

Hi,

l_date(8) TYPE D value '20080415',

l_date2(10) type c.

concatenate l_date6(2) l_date4(2) l_date+0(4) into l_date2 separated by '.' .

write: l_date2.

pls. reward if useful

Read only

0 Likes
1,032

Hi Dear,

I done same as u define...but it's not update in debugging mode and not in t.code where this data is going...

Plz tell how..

Read only

0 Likes
1,032

Hi Dear,

your answer is totally right..it convert into my format...but not updated in that t.code where the data going...

Plz tell..

Read only

Former Member
0 Likes
1,032

Hi Praveen Kumar,

You can try this function module give the input in what ever you want the formate "CONVERT_DATE_FORMAT"

Regards,

Rahul