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

Former Member
0 Likes
784

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
757

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.

6 REPLIES 6
Read only

Former Member
0 Likes
757

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.

Read only

Former Member
0 Likes
757

Hi,

just go to

system->user profile->own data->defaults

. there u can set the dates.

Thanks

Vikranth

Read only

Former Member
0 Likes
757

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.

Read only

Former Member
0 Likes
757

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

Read only

Former Member
0 Likes
757

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

Read only

Former Member
0 Likes
758

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.