cancel
Showing results for 
Search instead for 
Did you mean: 

Date format DD.MM.YYYY to system date format mm/dd/yyyy

Former Member
0 Kudos

Hi,

I created Infoobjects(ZVALIDFROM,ZVALIDTO) as char with the length 10 and I'm able to load data into PSA but when I try to load into the DSO/Cube the date format is DATS with length 8(standard). Basically I am mapping custom date field to system date format like mm/dd/yyyy(valid from ,valid to fields)

I am trying to write the routine in the transformations like below but i am getting wrong format as shown in the picture.

Concatenate  SOURCE_FIELDS-/BIC/ZVALIDTO+3(2) '/'

SOURCE_FIELDS-/BIC/ZVALIDTO+0(2) '/'

SOURCE_FIELDS-/BIC/ZVALIDTO+6(4) into RESULT.

Thank you

Raghu Muvva

Accepted Solutions (1)

Accepted Solutions (1)

Loed
Active Contributor
0 Kudos

Hi,

Can you show the screen of your data in PSA and the FIELDS tab in your datasource? I think you have CONVERSION routine in your datasource..From there we can tell you how to solve this scenarion in datasource or transformation level..

Regards,

Loed

Former Member
0 Kudos

Thank you for your replies. The below screen is from PSA table and I used to load as char with length 10 into PSA. Now my target is MM/DD/YYY with the DATS with length 8. I need to write routine. Can you please help me.

Former Member
0 Kudos

Hi Ragavendra,

Please find the below code for dispaly of data format DD/MM/YYYY.

DATA: date(10) TYPE c.


CONCATENATE sy-datum+6(2) '/' sy-datum+4(2) '/' sy-datum+0(4) INTO date. WRITE:/ date.

OR

Data:date_form type CHAR10.

call function 'HRGPBS_HESA_DATE_FORMAT'

exporting

            P_DATE          =  sy-datum

       importing

           DATESTRING       =   date_form

       exceptions

            others          = 1.

write : date_form.


OR

    v_date = w_file-mod_date.

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

      EXPORTING

        date_internal            = v_date

      IMPORTING

        date_external            = w_file-mod_date

      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.

Former Member
0 Kudos

Thank you Srnini.

Answers (2)

Answers (2)

sander_vanwilligen
Active Contributor
0 Kudos

Hi Raghu,

W.r.t. date fields, you have to distinguish between internal and external format. The preferred approach is using Characteristics with reference to 0DATE (i.e. data type DATS). Internal format is always: yyyymmdd (yyyy for year, mm for month and dd for day). The external format is dependent on your user settings (t/code SU3).

I don't know which DataSource you are dealing with. Here you can also switch between internal and external format. This way you might be able to link the DataSource fields to a Date Characteristic w/o any routine.

If you cannot avoid using a routine, please be aware of the internal format yyyymmdd which you have to map to in routines.

Best regards,

Sander

karthik_vasudevan
Active Contributor
0 Kudos

Hi Raghavendra

May I know what are you trying to achieve by doing this?

My guess is when you run the report, you need to show the date in mm/dd/yyyy format. To get this done, you need to change the user settings in SU01.

When this is done, whatever the format is in your cube, your report will allow you to enter the date in the configured format.

You don't have to write any routines. Just leave it as direct mapping

If your requirement is something else, please let us know. We will help you to get the right code

Please update if it helps.

Regards

Karthik