cancel
Showing results for 
Search instead for 
Did you mean: 

date data conversion from MM/DD/YYYY to YYYYMMDD

Former Member
0 Kudos

HAI

I have date data(ZDATE) in the form of MM/DD/YYYY format in oracle source system ...

I want this date data(ZDATE) in the form of YYYYMMDD format in BW.

SO hw can change this format. I think , it can be done by writing the ABAP code in TS.

So pls give the ABAP code for converting the date format from MM/DD/YYYY to YYYYMMDD

rizwan

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

There are no of ways for date conversion depends on requirement some are listed below

1. You can use WRITE FORMATING.

    Here the sample code:

   DATA: BEGDA       TYPE TEXT10,      

              ENDDA       TYPE SY-DATUM.   

WRITE SY-DATUM TO BEGDA MM/DD/YYYY.  

WRITE SY-DATUM TO ENDDA MM/DD/YYYY.

And of course you can use other format, like:

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

2. you can use concatenate statement:

concatenate SY-DATUM+4(2) SY-DATUM+6(2) SY-DATUM(4) INTO BEGDA separated by '/'.

Or

3. use FM CONVERT_DATE_TO_EXTERNAL

Former Member
0 Kudos

hi

to do it simpy you can extract the year , month and day into different variabales and then concatenate according to the format you want.

dest_year = sourc_date + 7(4)

dest_mm  = sourc_date + 4(2)

dest_day = sourc_date + 1(2).

then concatenate all into the format you require

Concatenate dest_year dest_mm dest_day  dest_day into new_date separated by /

with reaards

Suneesh

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Its a 7 year old thread ..I think no point in responding to it.

Regards,

AL

Former Member
0 Kudos

Hi,

You can use std. FM 'CONVERSION_EXIT_PDATE_INPUT', this is for DD/MM/YYYY to YYYYMMDD. you can enhance this as per your requirement.

regards,

Rajesh

Former Member
0 Kudos

Hi,

***********************888

DATA : year type char 4,

month type char 2,

day type char 2,

zdate type char 8.

year = TRANSFER_STRUCTURE-/bic/ZDATE(4).

month = TRANSFER_STRUCTURE-/bic/ZDATE+4(2).

day = TRANSFER_STRUCTURE-/bic/ZDATE+6(2).

CONCATENATE year month day into zdate.

result = zdate.

*****************************

Regards,

San!

Former Member
0 Kudos

hai Dinesh

Is that conversion routine converts source data from MM/DD/YYYY to YYYYMMDD format in Bw.

pls tell me confidently .

rizwan

Former Member
0 Kudos

Hi Rizwan,

You can also do this in the transfer rules using a conversion routine. Goto transfer rules -> Transfer str/Data structure -> for the date field -> select the conversion "PDATE" and then try the load.

Bye

Dinesh