Skip to Content
avatar image
Former Member

Date conversion in external format "MM/DD/YYYY"

Hi Experts,

I created a generic datasource on the top of TCURR table in SAP BW. I converted the inverted date in to normal date by using the function module 'CONVERSION_EXIT_INVDT_OUTPUT'. After conversion the date is available in characteristic object but my requirement is to save it as a date object. I need to save it in date format because the date object is a part of prompt in BEx query. The default date format in SAP is "YYYYMMDD" but my company's date format is "MM/DD/YYYY". When i tried to write transformation routine to convert it in to date format. I could not do it in correct format which is "MM/DD/YYYY".

I searched many threads in SCN for this issue and I found that SAP converts the characteristic object into date but in "YYYYMMDD" format. I could not find any function module which can convert the characteristic object in to date in external format like "MM/DD/YYYY". Can any one of you suggest the work around for this issue?

I will appreciate your time and help.

Thanks,

Shehzad

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 27, 2015 at 04:42 PM

    Thank you guys for your help and time.

    I fixed it by flipping the date into "YYYYMMDD" format and it is showing in the correct way now.

    DATA: ZDATE(8) TYPE C.

    DATA: YY(4) TYPE C,

           MM(2) TYPE C,

           DD(2) TYPE C.

    MOVE SOURCE_FIELDS-GDATU+4(4) TO YY.

    MOVE SOURCE_FIELDS-GDATU+0(2) TO MM.

    MOVE SOURCE_FIELDS-GDATU+2(2) TO DD.

    CONCATENATE YY MM DD INTO ZDATE.

          RESULT = ZDATE.


    Note: Result is a date type object


    Correct Date.JPG (12.4 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2015 at 03:27 PM

    Hi Shehzad,

    if you want to see the format (MM/DD/YYYY) in query level, then you can change it in user profile level  as stated by Karthik. but please note, this change will be applicable for all other reports of a specific user.

    And if you want to transfer it in table level, then you can write a field routine to convert the YYYYMMDD to MM/DD/YYY format .

    DATA :    A1  type string,

                   A2  type string,

                   A3  type string,

                   B  type string.

                  

       A1  = SOURCE_FIELDS-Date+4(2) . ** MM

       A2 = SOURCE_FIELDS-Date+6(2).  **DD

     

      Concatenate A1 '/' A2  into B .

      A3= SOURCE_FIELDS-Date+0(4).  ** YYYY

      

      Concatenate B '/' A3  into Result.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2015 at 03:20 PM

    Hi Shehzad

    Did you try changing your user setting in SU01.

    You will get the option as below. You could choose one which you need and this should work.

    I think you don't have to change anything in transformation level. Once you change this user settings and however your cube stores the data, you can input the data as mm/dd/yyyy in your variable input screen.

    Please update if it helps.

    Regards

    Karthik


    date.PNG (32.2 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Karthik,

      Thanks for your prompt reply. My company is using the "MM/DD/YYYY" date format and every user profile have this format. I do not need to change the date format in su01. The system is not storing the date in this format without any transformation. It stored the date in YYYYMMDD format.

      But if i stored it as a characteristic it is stored in the correct format which is "MM/DD/YYYY".

      I fixed it by flipping the date into "YYYYMMDD" format and it is showing in the correct way now.

      DATA: ZDATE(8) TYPE C.

      DATA: YY(4) TYPE C,

             MM(2) TYPE C,

             DD(2) TYPE C.

      MOVE SOURCE_FIELDS-GDATU+4(4) TO YY.

      MOVE SOURCE_FIELDS-GDATU+0(2) TO MM.

      MOVE SOURCE_FIELDS-GDATU+2(2) TO DD.

      CONCATENATE YY MM DD INTO ZDATE.

            RESULT = ZDATE.


      Note: where Result is a date type object


      Thanks for your advise and help.