Skip to Content
author's profile photo
Former Member

date data conversion from MM/DD/YYYY to YYYYMMDD

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • author's profile photo
    Former Member
    Posted on Aug 31, 2006 at 10:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 31, 2006 at 10:55 AM

    hai Dinesh

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

    pls tell me confidently .

    rizwan

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 31, 2006 at 10:58 AM

    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!

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 31, 2006 at 11:00 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 27, 2013 at 05:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 27, 2013 at 06:51 AM

    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

    Add comment
    10|10000 characters needed characters exceeded