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

about data format

In my input file i got date formats as

20071211

12112007

12-11-2007 and in differnt formats but i want to enter into database as my system format

how to solve this problem

Regards

shanmukha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 04, 2007 at 09:05 AM

    Hi,

    Use FM

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    date_internal = lv_date

    IMPORTING

    date_external = lv_date1

    EXCEPTIONS

    date_internal_is_invalid = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    REgards,

    prashant

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Prashant,

      i have used this FM

      but every time it is accepting only in the date format

      of DD.MM.YYYY ( my system defaults )

      if i enter like yyyy.mm.DD then it is giving like

      yy.yy.mmdd ( wrong )

      if i enter like DDMMYYY

      then it is giving DD.MM.YYYY ( correct )

      do you have any other function which can be useful in this regard.....

      regards,

      Venkatesh

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

    Hi,

    usually the date format in the flat file should be unique

    then it will be easy for us to update SAP

    if the user gives you the second or third format

    then use

    translate g_date using '- '.

    then the date which is 12-11-2007 will be converted to 12 11 2007

    then use condense g_date --- output 12112007

    change this date to your system date format and then update.

    if the user enters first....

    then use concatenate statements and then change it according to your

    system date format....

    <b>but be care full how they are giving it is varying every time

    you will be in trouble...</b>

    regards,

    Venkatesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 09:19 AM

    Hi Ramesh,

    Use the function module

    CONVERT_DATE_TO_INTERNAL..
    
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
    EXPORTING 
    DATE_EXTERNAL = V_DATE_EX
    IMPORTING
    DATE_INTERNAL = V_DATE.

    Regards,

    Satish

    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.