Skip to Content
avatar image
Former Member

Need to change the date format

Hi,

I need to load the data from MS SQL through DB Connect. the source field date format is 2010-01-20 00:00 ( this is MSSQL data type - "smalldatetime") and required query format is 06-Feb-10.

So where we can change the format. in the query level, or at the info provider level.

1. If at the info provider level Please provide me the steps.

2. If at the query level. please provide me the steps to do.

what is the best option?

thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 15, 2011 at 04:49 AM

    Hi:

    For the recommended steps, please refer to SAP Note 512739 - "BW external DB Connect for MS SQLServer"

    Regards,

    Francisco Milán.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi:

      Check with your Client to see if it is possible to modify the views that are already in place and create new ones according to the recommendation on the SAP Note mentioned before. Unfortunately in this scenario you'd need to delete the data from the PSAs and reload it again.

      Regards,

      Francisco Milán.

  • avatar image
    Former Member
    Feb 15, 2011 at 07:51 AM

    Hi,

    In the update write an field routine to convert date from the source format to destination format.

    Use the FM: CONVERSION_EXIT_SDATE_INPUT to convert the dates

    or

    use the below code.

    DATA : wa_date(12),

    wa_day(2),

    wa_mth(3),

    wa_yer(4),

    wa_date1(8), "yyyymmdd

    wa_mnr(2).

    wa_date = Source_structure-date1 // Here pass your Date field

    SPLIT wa_date AT '-' INTO wa_day

    wa_mth

    wa_yer.

    TRANSLATE wa_mth TO UPPER CASE.

    SELECT SINGLE mnr FROM t247 INTO wa_mnr WHERE ktx = wa_mth

    AND spras = sy-langu.

    CONCATENATE wa_yer wa_mnr wa_day INTO wa_date1.

    pass wa_date1 to return statment.

    or

    Use the custom FM to convert date.Find the link

    http://wiki.sdn.sap.com/wiki/display/Snippets/FUNCTIONMODULEFORCONVERTINGDATEINTOTHEGIVENFORMAT

    Regards,

    Shiva Kumar G.C

    Edited by: Shivu Kumar on Feb 15, 2011 1:28 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Just to point out that certain languages cannot specify a short month name correctly in 3 characters (Russian is one for example),  and therefore T247 cannot be used to get the short names for a Russian month name.

  • avatar image
    Former Member
    Feb 15, 2011 at 09:47 AM

    thank u very much

    Add comment
    10|10000 characters needed characters exceeded