‎2006 Feb 27 11:24 AM
Hi,
I have date field which comes from a file in different formats.I would like to find the user settings from USR01 table and change the date to that format.
We have 6 such formats..is there a FM which does all the conversions or should the code be written .
DD.MM.YYYY
MM/DD/YYYY
MM-DD-YYYY
YYYY.MM.DD
YYYY/MM/DD
YYYY-MM-DD.
Regards,
Sri.
‎2006 Feb 27 11:35 AM
Hi sri kanth,
There is no need to detect anything!!!
1. Very simple.
2. CONVERT_DATE_TO_INTERN_FORMAT
use this FM.
3. pass DTYPE = 'DATS'.
4. This FM will TAKE CARE OF
THE USERS SETTINGS
AND ACCORDINGLY CONVERT INTO PROPER FORMAT
(IE NITERNAL FORMAT OF YYYYMMDD)
regards,
amit m.
‎2006 Feb 27 11:27 AM
u can change through system>userprofile>owndata.
Dynamically u can do by writing a program
Use any of the foll. FM
HRGPBS_HESA_DATE_FORMAT
Format a date valid for HESA: DD/MM/YYYY
HRGPBS_TPS_DATE_FORMAT
Format a date valid for TPS: DDMMYY
SLS_MISC_GET_USER_DATE_FORMAT
get the date format the user has defined as his/her default
========================================
REPORT ZES .
data: v_date type char10.
CALL FUNCTION 'HRGPBS_HESA_DATE_FORMAT'
EXPORTING
p_date = sy-datum
IMPORTING
DATESTRING = v_date.
replace all occurences of '/' in v_date with '.' .
write v_date.
‎2006 Feb 27 11:29 AM
Hi,
just go to
system->user profile->own data->defaults. there u can set the dates.
Thanks
Vikranth
‎2006 Feb 27 11:30 AM
hi,
If you are getting different formats from file.
suppose it is 3rd of Feb,2006.
in DD.MM.YYYY format 03.02.2006
in MM.DD.YYYY format 02.03.2006
How can we know in which date format is the date in the file sent?
If you are specific about the date format, then we can change that as per user settings.
Regards,
Sailaja.
‎2006 Feb 27 11:31 AM
HI
try this fm
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL =
ACCEPT_INITIAL_DATE =
IMPORTING
DATE_INTERNAL =
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2
regards
kishore
reward if helpful
‎2006 Feb 27 11:32 AM
Hi,
you need to USE some coding..
write data to date1 mm/dd/yyyy
dd/mm/yyyy
or you need to make use of edit mask..
Regards
vijay
‎2006 Feb 27 11:35 AM
Hi sri kanth,
There is no need to detect anything!!!
1. Very simple.
2. CONVERT_DATE_TO_INTERN_FORMAT
use this FM.
3. pass DTYPE = 'DATS'.
4. This FM will TAKE CARE OF
THE USERS SETTINGS
AND ACCORDINGLY CONVERT INTO PROPER FORMAT
(IE NITERNAL FORMAT OF YYYYMMDD)
regards,
amit m.