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

Convert Date

Former Member
0 Likes
677

Hi,

How can i convert the 05-Oct-07 into 20071005??

Regards,

Kit

6 REPLIES 6
Read only

Former Member
0 Likes
654

Hi

Convert the date to MMMDDYYYY and then pass it to FM CONVERSION_EXIT_SDATE_INPUT

Import parameters Value

INPUT NOV012007

Export parameters Value

OUTPUT 20071101

Regards

Shiva

Read only

Former Member
0 Likes
654

Hi Kit,

When you select date from any data base table you will get it in the same format as ypu require it; YYYYMMDD.

So you dont need to change it.

Regards,

Pankaj Sharma

Read only

former_member194152
Contributor
0 Likes
654

hi,

data always store in the YYYYMMDD format so u do not need any function module for retriving this format just store database date in a variable of 8 character.

data : date(8) type c.

date = sy-datum.

write : / date.

this will solve your problem.

Rewards if helpful.

Regards

Gagan

Read only

Former Member
0 Likes
654

Hi ,

Try this..

IF MM = "JAN" THEN

LET MONTH = "01"

ELSEIF MM = "FEB" THEN

LET MONTH = "02"

...

ELSEIF MM = "OCT" THEN

LET MONTH = "10"

....

ELSEIF MM = "DEC" THEN

LET MONTH = "12"

END IF

L_DATE = 05-Oct-07.

L_YEAR = L_DATE+7(2).

L_DAY = L_DATE+0(2).

CONCATENATE "20" L_YEAR MONTH L_DAY.

Read only

Former Member
0 Likes
654

Hi,

Check this


DATA : sapdate like sy-datum.
DATA : date type string value '05-Oct-07'.

DATA : mm type char2.
if date+3(3) eq 'Jan'.
mm = '01'.
Elseif date+3(3) eq 'Feb'.
mm = '02'.
Elseif date+3(3) eq 'Mar'.
mm = '03'.
Elseif date+3(3) eq 'Apr'.
mm = '04'.
Elseif date+3(3) eq 'May'.
mm = '05'.
Elseif date+3(3) eq 'Jun'.
mm = '06'.
Elseif date+3(3) eq 'Jul'.
mm = '07'.
Elseif date+3(3) eq 'Aug'.
mm = '08'.
Elseif date+3(3) eq 'Sep'.
mm = '09'.
Elseif date+3(3) eq 'Oct'.
mm = '10'.
Elseif date+3(3) eq 'Nov'.
mm = '11'.
Elseif date+3(3) eq 'Dec'.
mm = '12'.
Endif.
concatenate '20' date+7(2) mm date+0(2) into sapdate. 

Read only

Former Member
0 Likes
654

Hi,

use function module : CONVERSION_EXIT_SDATE_INPUT

Regards,

Sandeep kaushik