2008 Nov 26 12:46 PM
I am wrinting a bdc and i want to convert the date into user default date farmate ..please suggust the functiom module should i use...
2008 Nov 26 12:50 PM
Hi Kranthi,
Pls create a variable which is date type and write the statement as follows.
Write sy-datum to <variable>.
use this variable in the BDC code. It will work
2022 Jan 14 10:30 AM
Thanks, this was the simplest way possible.
I had a similar requirement and your comment got the job done. 🙂
2008 Nov 26 12:52 PM
you can use
CONCATENATE sy-datum4(2) '/' sy-datum6(2) '/' sy-datum+0(4)
INTO lv_date.
or fm
DATA: lc_date_format TYPE char10 VALUE 'MM/DD/YYYY'.
CALL FUNCTION 'SLS_MISC_CONVERT_TO_DATE'
EXPORTING
p_date = lwa_final-bstdk
p_date_format = lc_date_format
IMPORTING
p_date_string = gwa_final1-bstdk
EXCEPTIONS
error_selecting_user_defaults = 1
OTHERS
2008 Nov 26 12:57 PM
hi use one of these .
CONVERT_DATE_TO_INTERNAL
PCA_CONVERT_DATE_INTERNAL
2008 Nov 26 1:00 PM
actually by using dats or d type you can get the user specific date itself.
but if u have different dates format that need to be converted to the user specific date then you can follow below procedure
1. retrieve the user format from usr01
SELECT SINGLE datfm
INTO w_datfm
FROM usr01
WHERE bname EQ sy-uname.
pass w_datfm to the below FM (4th import parameter)
2. create Z - FM and retrieve the user secific date
FUNCTION ZFXX_USER_SPECIFIC_DATE.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(IW_DAY) TYPE CHAR2
*" VALUE(IW_MONTH) TYPE CHAR2
*" VALUE(IW_YEAR) TYPE CHAR4
*" VALUE(IW_DATFM) TYPE USR01-DATFM
*" EXPORTING
*" VALUE(EW_USER_DATE) TYPE CHAR0008
*"----
*1 DD.MM.YYYY
*2 MM/DD/YYYY
*3 MM-DD-YYYY
*4 YYYY.MM.DD
*5 YYYY/MM/DD
*6 YYYY-MM-DD
CASE iw_datfm.
when '1'.
concatenate iw_day iw_month iw_year
into ew_user_date.
when '2'.
concatenate iw_month iw_day iw_year
into ew_user_date.
when '3'.
concatenate iw_month iw_day iw_year
into ew_user_date.
when '4'.
concatenate iw_year iw_month iw_day
into ew_user_date.
when '5'.
concatenate iw_year iw_month iw_day
into ew_user_date.
when '6'.
concatenate iw_year iw_month iw_day
into ew_user_date.
when others.
clear ew_user_date.
endcase.
ENDFUNCTION.
2008 Nov 26 1:00 PM
Hi Adelly,
Use the FM CONVERT_DATE_TO_EXTERNAL.
With luck,
Pritam.
2008 Nov 26 1:09 PM
Hi,
I dont think any function module require for date conversion in bdc,
you just take variable with character type and pass it to the field of bdc using internal table in which u takes ur data.
2008 Nov 26 1:09 PM
Hi,
Use the following FM it will be helpful to you.
*To change date as per user settings
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = loc_date
IMPORTING
output = loc_date.
Or use this Fm
CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
EXPORTING
input = <fs_inrec>-to_date
IMPORTING
output = <fs_inrec>-end_date.
Regards,
Chaitanya