‎2007 Dec 12 5:21 AM
hi guys
is there any function module to change the date format
from 08/28/2007(mm/dd/yyyy)
to August 28, 2007.
regards
vamsi
‎2007 Dec 12 5:33 AM
Hi,
Check the code as below : it works,
data : date(10),
text1(26),
num1(10),
test_day(15),
o_date(20),
idate type sy-datum.
data : Day(2), month(2), Year(4).
data : ODay(2), Omonth(2), OYear(4).
data : Ltext Type T247-LTX.
date = '08/28/2007'.
day = date+3(2).
month = date+0(2).
year = date+6(4).
concatenate year month day into idate.
CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
EXPORTING
idate = idate "use sy-datum directly here
IMPORTING
DAY = oday
MONTH = omonth
YEAR = oyear
LTEXT = ltext.
concatenate ltext oday ',' oyear into o_date.
write : O_date.
Reward points, if helpful,
Sandeep Kaushik
‎2007 Dec 12 5:23 AM
‎2007 Dec 12 5:25 AM
Hi Vamsi,
Try this function module.
CONVERSION_EXIT_SDATE_OUTPUT
or
CONVERSION_EXIT_IDATE_OUTPUT
Plz Reward if useful,
Mahi.
‎2007 Dec 12 5:28 AM
Hi vamsi,
You can get good FM's regarding Date Time form :
http://sap4.com/contentid-130.html
Regards,
Sachin Bhatnagar
‎2007 Dec 12 5:32 AM
the function module CONVERSION_EXIT_SDATE_OUTPUT will work but
the input has to be 20070828. so what you can do it take the offset and convert the date in this format.. then you can use this function module.
It will give you the result you want
Prince
‎2007 Dec 12 5:32 AM
hi vamsi.,
Use CONVERSION_EXIT_SDATE_OUTPUT to get the month name,
but it will give short form of the month name.
if you want <b>long description of the month</b>,
use this peice of code.
PARAMETERS: V_DATUM(07) TYPE C. "(example input:12-2007)
DATA: V_MON(2) TYPE C,
V_YEAR(4) TYPE C,
V_MONTHNAME(10) TYPE C,
V_FULLDATE(30) type c.
WRITE V_DATUM+0(2) TO V_MON.
SELECT SINGLE LTX FROM T247 INTO V_MONTHNAME
WHERE SPRAS = SY-LANGU
AND MNR = V_MON.
CONCATENATE V_MONTHNAME v_datum+3(4)
INTO V_FULLDATE SEPARATED BY SPACE. "(example output : December 2007)
write: v_fulldate.
<i><b>Reawrd points if useful</b></i>
Chandra
‎2007 Dec 12 5:33 AM
Hi,
Check the code as below : it works,
data : date(10),
text1(26),
num1(10),
test_day(15),
o_date(20),
idate type sy-datum.
data : Day(2), month(2), Year(4).
data : ODay(2), Omonth(2), OYear(4).
data : Ltext Type T247-LTX.
date = '08/28/2007'.
day = date+3(2).
month = date+0(2).
year = date+6(4).
concatenate year month day into idate.
CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
EXPORTING
idate = idate "use sy-datum directly here
IMPORTING
DAY = oday
MONTH = omonth
YEAR = oyear
LTEXT = ltext.
concatenate ltext oday ',' oyear into o_date.
write : O_date.
Reward points, if helpful,
Sandeep Kaushik