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

DATE FORMAT CONVERSION

Hi ,

I am importing data from a file in local computer into internal table.

now the date is given in the format 9/12/2007 in the text file . How can I convert this to DATS format which is SAP readable.

thank you

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2007 at 07:59 PM

    Try out for below FM..

    <b>CONVERT_DATE_TO_INTERNAL</b>

    Thanks & Regards

    ilesh 24x7

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2007 at 08:56 PM

    Hi try this logic out !!!!

    concatenate it_input_file-doc_date6(4) it_input_file-doc_date0(2)

    it_input_file-doc_date+3(2) into it_input_file-doc_date2.

    I think this will help you out....

    Reward points if helpful.

    Thanks

    Rajeev

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 17, 2007 at 07:57 PM

    Hi,

    Please try FM RP_FORMATING_DATE or CONVERT_DATE_TO_INTERN_FORMAT with DTYPE = DATS.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2007 at 08:09 PM

    Check the simple program using offset or you can use FM too.

    REPORT Ztest_ytt.

    data : v_date(10) type c.

    data : v_date1(2) type c,

    v_mon(2) type c,

    v_year(4) type c.

    data v_final(8) type c.

    parameters p_date like v_date.

    initialization.

    p_date = '09/12/2007'.

    start-of-selection.

    v_date1 = p_date+0(2).

    v_mon = p_date+3(2).

    v_year = p_date+6(4).

    concatenate v_mon v_date1 v_year into v_final." USA Format

    write v_final.

    Thanks

    Seshu

    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.