Skip to Content
author's profile photo Former Member
Former Member

Date conversion from YYYYMMDD to DD.MM.YYYY

Hi,

I'm trying to load some data from a flat file into BW. I have a date column in the CSV file that has the date in YYYYMMDD format. when I load it into Bw, I want to change the format to DD.MM.YYYY .

I have written a small routine that should do this, but it doesn't seem to work.

data:v_date like sy-datum,

v_date1(10) type c.

Concatenate v_date+6(2) '.' v_date+4(2) '.' v_date+0(4) into v_date1.

RESULT = V_DATE1.

The result of this routine is YY.YYMM.DD instead of DD.MM.YYYY.

Can anyone tell me where I'm going wrong?

Thanks

Sam

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:43 AM

    Hi,

    Use Write statement using EDIT MASK .you can achieve the result.

    WRITE .... EDIT MASK .....

    ex:

    data : ldate type sy-datum,

    wdate type char10.

    ldate = sy-datum.

    write ldate TO wdate USING EDIT MASK '____.__.__'.

    WRITE : / wdate.

    Edited by: Ramesh Hirial on Jan 31, 2008 3:45 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:44 AM

    Hi,

    Use FM CONVERSION_EXIT_PDATE_OUTPUT.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:46 AM

    Hi,

    Try like this..

    data:v_date like sy-datum,
     
    v_date1(12) type c.
     
    Concatenate v_date+6(2) '.' v_date+4(2) '.' v_date+0(4) into v_date1.
     
    RESULT = V_DATE1.
    

    regards,

    Omkar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:47 AM

    use fm CONVERT_DATE_TO_EXTERNAL /CONVERT_DATE_TO_INTERNAL

    CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

    EXPORTING

    datum = lv_date1

    dtype = 'DATS'

    IMPORTING

    idate = lv_date2.

    write lv_date2.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:48 AM

    data v_date type sydatum.

    v_date = '20081225'.

    data v_date1 type string.

    concatenate v_date6(2) '.' v_date4(2) '.' v_date+0(4) into v_date1.

    write v_date1.

    Just try this...

    The coding which u have written is correct only...

    Reward if helpfull.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 31, 2008 at 07:13 AM

    data:date(10) type c.

    write sy-datum to date.

    write date.

    this will be sufficient...date holds value like 31.01.2008

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:51 AM

    Hi,

    Try this

    concatenate lv_date6(2) lv_date4(2) lv_date+0(4) into lv_date_temp separated by '.'.

    Some of the FM used are:

    CONVERT_DATE_TO_INTERN_FORMAT

    CONVERT_DATE_FORMAT

    CONVERSION_EXIT_PDATE_OUTPUT

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 07:14 AM

    Hi

    use

    convert_date_to_external or

    convert_field_to_extern_format

    in SAP date is tored as YYYYMMDD

    so use sy-datum and pass the value to it

    Reward if useful.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.