2008 Sep 01 10:26 AM
Hi,
I want to get default date format for user.
I want to convert a text for example '01.01.2008' to default date format (YYYYMMJJ or JJMMYYYY in depend of user).
Thanks in advance.
hii
default format of date is yyyymmdd..so for that you can use FM
CONVERT_DATE_TO_INTERNAL
and for ddmmyyyy for mat you can use logic like below
data:wa_date like sy-datum,
wa_dt(10) type c.
Concatenate wa_date +6(2)wa_date +4(2) wa_date +0(4) into wa_dt.
result = wa_dt
regards
twinkal
2008 Sep 01 10:33 AM
2008 Sep 01 10:40 AM
select the DATFM from USR01 table where bname = username.
data element is XUDATFM for datfm .select the fixed value from data element and choose the date format
2008 Sep 01 10:41 AM
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
DATUM = '12.02.2001'
DTYPE = 'DATS'
IMPORTING
ERROR =
IDATE = lv_date
MESSG =
MSGLN =
2008 Sep 01 10:41 AM
Hi,
I hope this will help you,
HRGPBS_HESA_DATE_FORMAT
Regards,
Harish
2008 Sep 01 10:42 AM
2008 Sep 01 10:43 AM
hii
default format of date is yyyymmdd..so for that you can use FM
CONVERT_DATE_TO_INTERNAL
and for ddmmyyyy for mat you can use logic like below
data:wa_date like sy-datum,
wa_dt(10) type c.
Concatenate wa_date +6(2)wa_date +4(2) wa_date +0(4) into wa_dt.
result = wa_dt
regards
twinkal
2008 Sep 01 10:45 AM
2008 Sep 01 10:47 AM
Simo,
for getting default date from user:
use FM DATUMSAUFBEREITUNG.
data: idate TYPE sy-datum,
tdat8 type string.
idate = <your date>
CALL FUNCTION 'DATUMSAUFBEREITUNG'
EXPORTING
IDATE = idate
IMPORTING
TDAT8 = tdat8"user's default date formate
EXCEPTIONS
DATFM_UNGUELTIG = 1
DATUM_UNGUELTIG = 2
OTHERS = 3.Amit.
2008 Sep 01 11:12 AM
There's a problem with this functions. When i give a different date format in import parameter --> error...
That what i want to do:
I have a text for example '31.08.2008'. I want to convert it the format date of user. If 'YYYYMMJJ' ---> 20080831 and if 'JJMMYYYY' ---> 31082008 etc......
2008 Sep 01 11:28 AM
Simo,
preriquiste of this FM is that , you must change all date before passing in YYYYMMDD formate which comes in idate ,and pass it to FM.you will get user format date .dont worry about user formate , FM would take care of it.
2008 Sep 01 11:48 AM
Look Amit, please test it:
1- Change your default format date: Goto System -> user profile -> Own data and click on Defaults and change date format 'YYYY-MM-DD'
2- MF: 'DATUMSAUFBEREITUNG' with IDATE = '31082008'.
2008 Sep 01 12:21 PM
2008 Sep 01 12:27 PM
The goal is to use MF 'SD_DATETIME_DIFFERENCE' because in import parameter (date1 and date2) we must use a default format date
2008 Sep 01 12:35 PM
Simo,
look this piece of code.
data: idate TYPE sy-datum,
tdat8 type string.
LOOP AT it_excel.
idate = p_budat.
CALL FUNCTION 'DATUMSAUFBEREITUNG'
EXPORTING
* FLAGM = ' '
* FLAGW = ' '
IDATE = idate
* IMONT = ' '
* IWEEK = ' '
IMPORTING
* MDAT4 =
* MDAT6 =
* TDAT4 =
* TDAT6 =
TDAT8 = tdat8
* WDAT4 =
* WDAT6 =
* EXCEPTIONS
* DATFM_UNGUELTIG = 1
* DATUM_UNGUELTIG = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
it_excel-budat_004 = tdat8.
MODIFY it_excel.
CLEAR it_excel.
ENDLOOP.where p_budat is parameter with type budat.
it werk fine for me in BDC.where i suppose to put a posting date according to user format only.
Amit.
2008 Sep 01 1:01 PM
My first value is char(10) not date not parameter.
data: v_data(10).
v_data = '31.08.2008' for example
My question is how can i do for converting this value on default date format for user?
2008 Sep 01 11:06 AM
hi,
data: wa type string.
data: w_date type string.
wa = '01.11.2008'.
data:wa_year type char4.
data: wa_month type char2.
data: wa_date type char2.
replace all occurrences of '.' in wa with space.
wa_year = wa+4(4).
wa_month = wa+2(2).
wa_date = wa+0(2).
concatenate wa_year wa_month wa_date into w_date.
Write:/ w_date.
This will exaclty print your desired output.
2008 Sep 01 12:36 PM
Hi,
for this you can directly move the value of type sy-datum to type d and pass the value.
DATA:
w_date TYPE d.
w_date = sy-datum. " move value
write: w_date.Regards
Adil
2011 Feb 08 8:18 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |