Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date change

Former Member
0 Likes
1,123

In the flat file suppose the date is in format yyyy/mm/dd while uploading the value that is transferred is to be in the format dd/mm/yyyy and vice-versa.then what is the procedure

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
956

change the settings ,

goto control panel-->regional settings -->date tab and change the settings accordingly before uploading the file

6 REPLIES 6
Read only

Former Member
0 Likes
957

change the settings ,

goto control panel-->regional settings -->date tab and change the settings accordingly before uploading the file

Read only

Former Member
0 Likes
956

Hi sandeep,

1. u can use offset concept.

2. eg.

concatenate dt(4) dt5(2) dt8(2) into mydate.

regards,

amit m.

Read only

Former Member
0 Likes
956

Hi Sandeep,

You have to use FM's <b>CONVERT_DATE_TO_INTERNAL</b> and <b>CONVERT_DATE_TO_EXTERNAL</b>.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
  EXPORTING
    date_external                  = wrk_edate "EG: 20.05.2005
*   ACCEPT_INITIAL_DATE            =
 IMPORTING
   DATE_INTERNAL                  = wrK_idate
 EXCEPTIONS
   DATE_EXTERNAL_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.
 
 
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
  EXPORTING
    DATE_INTERNAL                  = SY-DATUM "eg:04.07.2008
  IMPORTING
    DATE_EXTERNAL                  = wrk_edate
  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

Aneesh.

Read only

Former Member
0 Likes
956

hi,

use FM : CONVERT_DATE_TO_INTERNAL.

and then use FM : CONVERT_DATE_TO_EXTERNAL....

and if you r aploding data in sap thru BDC.. then it will be automatically converted...no requre thif FMs....

Regards,

Shardul Shah

Read only

Former Member
0 Likes
956

you can change that in your user interface check with basis persons.

otherwise you have to use FM for convert date format.

if not use separate format for uploading template.

Rewards If Useful.

Read only

Former Member
0 Likes
956

CONVERT_DATE_TO_EXTERNAL.

CONVERT_DATE_TO_INTERNAL.

DATE_STRING_CONVERT

Function Modules related to Date and Time Calculations

CALCULATE_DATE : Calculates the future date based on the input .

DATE_TO_DAY : Returns the Day for the entered date.

DATE_COMPUTE_DAY : Returns weekday for a date

DATE_GET_WEEK : Returns week for a date

DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified

MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.

END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.

HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.

FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.

MONTH_NAMES_GET : Get the names of the month

WEEK_GET_FIRST_DAY : Get the first day of the week

HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format

SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours

L_MC_TIME_DIFFERENCE : Find the time difference between two date/time

HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months

LAST_DAY_OF_MONTHS : Returns the last day of the month

or

simple use:

WRITE date to ext_date MMDDYYYY.

date is in YYYYMMDD for mat type d

and ext_date(8) type c

or

data: l_date(10) type c.

write: sy-datum to date.

write : date.

regards,

srinivas

<b>*rewards for useful answers*</b>