‎2009 Mar 05 12:18 PM
Hi,
Is there any standard FM to convert data format:
Sample input/output is:
Input: 02-Feb-2009
Output: 20090202
Thanks,
Neelima.
‎2009 Mar 05 12:45 PM
Hi,
Please use this Function Module
CONVERSION_EXIT_SDATE_INPUT
for ex:
Give input = 01.FEB.2007
then the output wil be = 20070201
Thanks
Murugan.B
‎2009 Mar 05 12:36 PM
Hi,
You can try the following FMs
DATE_CONV_EXT_TO_INT - Conversion of dates to SAP's internal format
CONVERT_DATE_TO_INTERNAL - Formats date from display to internal format
But better you write code...that is with corresponding numbers such as (Jan = 01, Feb = 02, and so on...) and then concatenate into the system date.
Simply SPLIT the <input date> at "-" into <day> , <month> and <year>.
Then convert the <month> to numbers accordingly..
Then CONCATENATE them in the order you want.
Regards.
Edited by: rajan roy on Mar 5, 2009 1:38 PM
‎2009 Mar 05 12:45 PM
Hi,
Please use this Function Module
CONVERSION_EXIT_SDATE_INPUT
for ex:
Give input = 01.FEB.2007
then the output wil be = 20070201
Thanks
Murugan.B
‎2009 Mar 06 9:25 AM
Hi,
Thanks, but by replacing '-' with '.' this is working
input : 20-feb-2009 is not working only 20.feb.2009 is working.
Thanks,
Neelima
‎2009 Mar 06 9:33 AM
Check the user setting as I have mentioned in earlier post. You need to change the default for date n re-login.
‎2009 Mar 05 12:50 PM
hi,
DATA : wa_date(12) VALUE '02-Feb-2009', "dd-mmm-yyyy
wa_day(2),
wa_mth(3),
wa_yer(4),
wa_date1(8), "yyyymmdd
wa_mnr(2).
SPLIT wa_date AT '-' INTO wa_day
wa_mth
wa_yer.
TRANSLATE wa_mth TO UPPER CASE.
SELECT SINGLE mnr FROM t247 INTO wa_mnr WHERE ktx = wa_mth
AND spras = sy-langu.
CONCATENATE wa_yer wa_mnr wa_day INTO wa_date1.
"output : 20090202
‎2009 Mar 05 12:56 PM
Hi Neelima,
For your requirement,
First you need to use the function module
CONVERSION_EXIT_SDATE_INPUT
Internally
Input = 01.FEB.2007
Output wil be = 20070201
All you need to do is move this output date to a variable.
Data : v_dat type sy-datum.
v_dat = 20070201.
After that you need to use another function module calle
CONVERT_DATE_TO_INTERNAL
IMport parameter
You need to pass this variable into Import parameter -> v_dat
So that you will get the output of the date format as you wantRegards,
Kittu
‎2009 Mar 05 12:58 PM
Hi,
Try the FM : CONVERSION_EXIT_SDATE_INPUT (or)
Check with the below code:
DATA : wa_date(40) VALUE 'February 02, 2009',
wa_date1(10),
var1(15),
var2(3),
var3(4),
month(2).
SPLIT wa_date AT space INTO var1 var2 var3.
SELECT SINGLE mnr FROM t247 INTO month WHERE spras = sy-langu AND ltx
= var1.
CONCATENATE month var2+0(2) var3 INTO wa_date1 SEPARATED BY '/'.
WRITE wa_date1.
Regards,
Shalini
Edited by: shalini reddy on Mar 5, 2009 2:44 PM
‎2009 Mar 05 1:37 PM
Hi,
Before using fm CONVERSION_EXIT_SDATE_INPUT for date conversion you need to first check the default date format for your user profile in SAP. It needs to be MM-DD-YYYY to cater for your requirement. To do this follow these steps :
1 ) Navigate to System->User Profile -> Own Data
2 ) Click on Defaults tab
3 ) Change the date format to DD-MM-YYYY and save.
4 ) Log Off and Re-Login to the SAP system.
Now you can use fm CONVERSION_EXIT_SDATE_INPUT to change the date format.
Input : 02-FEB-2009
Output : 20090202
Hope it helps.
Reg
Ashwani
‎2009 Mar 05 5:19 PM
Neelima,
[ABAP Function Modules for Date Conversions|https://wiki.sdn.sap.com/wiki/display/ABAP/ABAPFunctionModules]
Search for the correct one.,
Thanks,
Naveen Inuganti.
‎2009 Mar 06 9:32 AM
Hi,
check this fm
CONVERSION_EXIT_INVDT_OUTPUT
Thanks and regrds
Durga.K
‎2009 Mar 06 10:19 AM
I have provided the FM as well as the code in the your previous thred with different subject line yesterday.
Pooja