‎2006 Nov 27 9:59 AM
Hi,
I have requirement In which I have to print the date in YYYY.MMMM.DD
EX:
Date: 27.11.2006
To be printed as: 2006 November 27
Can any one please tell me how do I convert it and print the format I required.
Thanks & regards,
satya
‎2006 Nov 27 10:03 AM
hi,
chk this,
<b>200061127 -> 2006.NOVEMBER.27</b>
DATA: DATE_CHAR(20).
DATA: DATE TYPE SY-DATUM.
DATA: MONTH_NAME LIKE T247-LTX.
DATE = SY-DATUM.
SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).
CONCATENATE SY-DATUM(4) MONTH_NAME SY-DATUM+6(2)
INTO DATE_CHAR SEPARATED BY '.'.
WRITE: / DATE_CHAR.<i>now u will get exact solution</i>
rgds
Anver
<i>if solved pls mark points</i>
‎2006 Nov 27 10:03 AM
hi,
chk this,
<b>200061127 -> 2006.NOVEMBER.27</b>
DATA: DATE_CHAR(20).
DATA: DATE TYPE SY-DATUM.
DATA: MONTH_NAME LIKE T247-LTX.
DATE = SY-DATUM.
SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).
CONCATENATE SY-DATUM(4) MONTH_NAME SY-DATUM+6(2)
INTO DATE_CHAR SEPARATED BY '.'.
WRITE: / DATE_CHAR.<i>now u will get exact solution</i>
rgds
Anver
<i>if solved pls mark points</i>
‎2006 Nov 27 10:07 AM
‎2006 Nov 27 10:15 AM
hi,
the FM have the same function to convert the month
CONVERSION_EXIT_LDATE_OUTPUT
regards
wannaqian
‎2006 Nov 27 10:11 AM
Hi,
Use the Function module CONVERSION_EXIT_SDATE_OUTPUT
Input the date as - 20061020
The output will be - 20.oct.2006
Regards,
Ram
‎2006 Nov 27 10:17 AM
hi
good
follow this proces
1- concatenate all the value and store in different variables.
2- take a internal table where you store all the eleven months
3-concatenate year and month from the internal table and the appropriate date and display them.
thanks
mrutyun^
‎2006 Nov 27 10:28 AM
HI,
Check this..
data : wf_month type char10.
data : wf_output type char20.
<b> CALL FUNCTION 'ISP_GET_MONTH_NAME'
EXPORTING
DATE = '00000000'
LANGUAGE = SY-LANGU
MONTH_NUMBER = sy-datum+4(2)
IMPORTING
LANGU_BACK =
LONGTEXT = WF_MONTH
SHORTTEXT =
EXCEPTIONS
CALENDAR_ID = 1
DATE_ERROR = 2
NOT_FOUND = 3
WRONG_INPUT = 4
OTHERS = 5
.
concatenate sy-datum0(4) wf_month sy-datum6(2) into wf_output seperated by space.</b>
wf_output will have the output you need,,,
reward if helpful..
Rgds,
Ajith
‎2006 Nov 27 10:28 AM
Copy and paste the below codes to an executable program and run.
Input Date: 27.11.2006
Output Date: 2006 November 27
DATA: GC_DATE_ORIGINAL(10) TYPE C VALUE '27.11.2006'.
DATA: GC_DATE_RESULT(20).
DATA: GTBL_MONTH_NAMES TYPE TABLE OF T247 WITH HEADER LINE.
DATA: GC_RETURN_CODE TYPE SY-SUBRC.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE = GC_RETURN_CODE
TABLES
MONTH_NAMES = GTBL_MONTH_NAMES
EXCEPTIONS
MONTH_NAMES_NOT_FOUND = 1
OTHERS = 2.
IF GC_RETURN_CODE <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
no error
READ TABLE GTBL_MONTH_NAMES WITH KEY MNR = GC_DATE_ORIGINAL+3(2).
IF SY-SUBRC = 0.
CONCATENATE GC_DATE_ORIGINAL6(4) GTBL_MONTH_NAMES-LTX GC_DATE_ORIGINAL0(2)
INTO GC_DATE_RESULT
SEPARATED BY SPACE.
ENDIF.
CLEAR GTBL_MONTH_NAMES.
ENDIF.
WRITE: / GC_DATE_RESULT.
Above codes get all the months name in a internal table.
If you are converting lots of date, use FM 'MONTH_NAMES_GET' above. Run only the FM once and reuse the content for all your date convertion. Thus, increase your program performance.
Pls rewards points if solve your problem.