‎2007 Aug 13 5:53 PM
Hi all,
I have a requirement that, i have the date in <b>YYYYMMDD</b> format. I need to change it to <b>DDMONYY</b>.For example,
<b> 20070312</b> should come as <b>12MAR07</b>.
please help me out.
‎2007 Aug 13 6:03 PM
hi,
get DD and YY from date and use following function module to get month name.
MONTH_NAMES_GET
then concatenate date
first three char of month name and
year
and the translate to upper case...
Enjoy SAP.
Pankaj Singh
‎2007 Aug 13 6:03 PM
hi,
get DD and YY from date and use following function module to get month name.
MONTH_NAMES_GET
then concatenate date
first three char of month name and
year
and the translate to upper case...
Enjoy SAP.
Pankaj Singh
‎2007 Aug 13 6:07 PM
HI,
data : lv_month(2) type c,
lv_date(7) type c.
lv_month = sy-datum+4(2).
case lv_month.
when '01'.
concatenate sy-datum6(2) 'Jan' sy-datum2(2) into lv_month.
when '02'.
concatenate sy-datum6(2) 'Feb' sy-datum2(2) into lv_month.
and so on till 12.
endcase.
Thanks
mahesh
‎2007 Aug 13 6:24 PM
Check the below code :
REPORT YEDULOCK.
data : date(8) type c.
data vdate(11) type c.
data : v_day(2),
v_year(2),
v_mon(2).
data : mon(3) type c.
start-of-selection.
date = '20070312'.
v_year = date+2(2).
v_mon = date+4(2).
v_day = date+6(2).
case v_mon.
when '01'.
mon = 'Jan'.
when '02'.
mon = 'Feb'.
when '03'.
mon = 'Mar'.
when '04'.
mon = 'Apr'.
when '05'.
mon = 'May'.
when '06'.
mon = 'Jun'.
when '07'.
mon = 'Jul'.
when '08'.
mon = 'Aug'.
when '09'.
mon = 'Sep'.
when '10'.
mon = 'Oct'.
when '11'.
mon = 'Nov'.
when '12'.
mon = 'Dec'.
endcase.
concatenate v_day mon v_year into vdate.
write:/ vdate.
Thanks
Seshu
‎2007 Aug 13 6:47 PM
Hi,
find the below code and modify it according to your system date format.
PARAMETER:S_DATE TYPE SY-DATUM DEFAULT SY-DATUM.
DATA:MONTH TYPE T247-MNR,
YEAR TYPE CHAR2,
KTX TYPE T247-KTX,
DAY TYPE CHAR2,
DAY_DATE TYPE STRING,
P_DATE TYPE SY-DATUM.
DATA: NEW_DATE TYPE STRING.
P_DATE = S_DATE.
***FOR DAY AND DATE FORMAT.
DAY = P_DATE+6(2).
MONTH = P_DATE+4(2).
YEAR = P_DATE+2(2).
SELECT SINGLE KTX FROM T247 INTO KTX WHERE MNR = MONTH
AND SPRAS = 'E'.
CONCATENATE MONTH KTX YEAR INTO NEW_DATE.
WRITE:/ NEW_DATE.
For the above code , my system date format is MMDDYYYY. Change it according to your system date format.
Reward me the points, if it is usefull for you .
Thanks
Ramesh.
‎2007 Aug 13 6:57 PM
Hi,
I hope following code will solve your problem. Just replace sy-datum by the variable you are using in your program. v_date will have date as <b>DDMONYY</b>.
DATA : x_t247 TYPE t247,
v_date TYPE string,
v_month TYPE fcktx.
SELECT SINGLE ktx
FROM t247
INTO v_month
WHERE spras = sy-langu
AND mnr = sy-datum+4(2).
CONCATENATE sy-datum+6(2) v_month sy-datum+0(4) INTO v_date.
Reward points if the answer is helpful.
Regards,
Mukul
‎2007 Aug 14 12:08 AM
There is a FM that get you all the THREE characters for the months.
<b>MONTH_NAMES_GET</b>
Try this code:
DATA: months LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA: date(7) TYPE c.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
language = sy-langu
TABLES
month_names = months.
READ TABLE months WITH KEY spras = 'EN' mnr = sy-datum+4(2).
CONCATENATE sy-datum+6(2) months-ktx sy-datum+2(2) INTO date.
WRITE: date.<i><b>Please reward points for helpful answer.</b></i>
Thanks.