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

date conversion

Hi all,

I am doing a BDC upload from CSV file.

Date format they supply me is 1/2/2007 (2nd January 2007).

How do I dadd zero infront of 1 and 2 so i looks like 01/02/2007?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 08:00 AM

    u r getting these 1/2/2007 from a file right!!!

    so where actually u want to convert these values into the required format..

    in the program???

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 02, 2007 at 08:01 AM

    data: v_month(2) type n,

    v_day(2) type n,

    v_year(4) type n,

    v_date(10),

    date(8) value '1/2/2007'.

    split date at '/' into v_month1(1) v_day1(1) v_year.

    concatenate v_month v_day v_year into v_date separated by '/'.

    write:/ v_date.

    REgards,

    Ravi

    Message was edited by:

    Ravi Kanth Talagana

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 08:02 AM

    if it is BDC, then you can reformat the date to form YYYYMMDD and standard SAP Date fields will do the required.. or else u have to

    split the date at `/` and then check the length of the date and month and if it is 1 then concatenate with 0.... and then concatenate back the string to the format u want...

    reward points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 08:04 AM

    hi Fschu,

    Check if there are any conversion routines are available for that dataelement ... if so use them for converting them to the required format ..

    Regards,

    santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 08:13 AM

    hi

    good

    follow this process,

    store each value of the format into different variable

    pass those variable in to CONVERSION_EXIT_ALPHA_INPUT

    this ll add 0 in front of all the value and than again use CONCATENATE statement to concatenate them and display it using a variable.

    Thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 08:19 AM

    data:g_dat(10) type c.

    concatenate '0' date0(2) '0' date2(4) date+4(8) into g_dat.

    write:/ g_dat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 10:16 AM

    refer below code,

    data: v_month(2) type c,
    v_day(2) type c,
    v_year(4) type c,
    v_date(12),
    date(10) value '11/2/2007'.
    
    split date at '/' into v_month v_day v_year.
    
    if v_day+1 is initial. 
    v_day+1 = v_day.
    v_day+0(1) = 0.
    endif.
    
    if v_month+1 is initial. 
    v_month+1 = v_month.
    v_month+0(1) = 0.
    endif.
    
    concatenate v_month v_day v_year into v_date separated by '/'.
    write:/ v_date.
    
    

    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.