2005 Sep 02 11:03 AM
Hi All,
I have a issue regarding <b>Date</b> formatting.
At present i am getting date in SAP format to my internal table field. Format is <b>[YYYYMMDD]</b> <i>ex:</i> <b>20050902</b>.
I want to make that field in following format as : <b>DD-MMM-YYYY</b> <i>ex:</i> <b>02-SEP-2005</b>.
can any body solve my issue.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.
2005 Sep 02 11:37 AM
Using Function modules
************************
data: gd_date(8).
"field to store output date
Converts date from 20010901 to 01SEP2001
gd_date = sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
input = gd_date
IMPORTING
OUTPUT = gd_date.
Refer this link
http://www.sapdevelopment.co.uk/tips/date/date_format.htm
Kindly reward points and close the thread.
Praff
Please read the SAP Documentation by pressing F1 on the key word WRITE.
(in an Unix world, the answer will be RTFM)
2005 Sep 02 11:07 AM
Please read the SAP Documentation by pressing F1 on the key word WRITE.
(in an Unix world, the answer will be RTFM)
2005 Sep 02 11:12 AM
Hi,
I had tried with that option but did not worked.
Any other solution without using any function module.
Thanks & Regards,
Rayeez.
2005 Sep 02 11:10 AM
Use the function module as given below.
data: w_date(10).
call function 'CONVERT_DATE_TO_EXTERNAL'
exporting
date_internal = <- Field in YYYYMMDD format
importing
date_external = w_date
exceptions
date_internal_is_invalid = 1
others = 2.
Message was edited by: Vinod C
2005 Sep 02 11:19 AM
Hi vinod,
I want <b>YYYYMMDD</b> format field to be displayed in <b>DD-MMM-YYYY</b> format.
Above FM what u have given is not suited for exact requirement can u give a solution where by we can directly translate <b>YYYYMMDD</b> format field into <b>DD-MMM-YYYY</b> format.
Thanks for ur time.
Thanks & Regards,
Rayeez.
2005 Sep 02 11:40 AM
Hi,
Can you try CONVERSION_EXIT_IDATE_OUTPUT?
Another way is to get the month name using 'MONTH_NAMES_GET and concatenate date and year with it.
Thanks
Vinod
2005 Sep 02 11:37 AM
Using Function modules
************************
data: gd_date(8).
"field to store output date
Converts date from 20010901 to 01SEP2001
gd_date = sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
input = gd_date
IMPORTING
OUTPUT = gd_date.
Refer this link
http://www.sapdevelopment.co.uk/tips/date/date_format.htm
Kindly reward points and close the thread.
Praff
2005 Sep 02 11:39 AM
can you hardcode it with concatenate then it can be solved.
con.....' ' '-'' '-' into .........
regards
2005 Sep 02 11:51 AM
Hi,
The FM <b>'CONVERSION_EXIT_IDATE_OUTPUT'</b> giving ouput as <b>SEP012001</b> instead of <b>01SEP2001</b> when giving input as <b>20010901</b>.
Do we need to make any changes to get it as 01SEP2001.
Thanks & Regards,
Rayeez.
2005 Sep 02 11:57 AM
Hi,
This the code
REPORT ztest2.
data: mydate type d,
mychar(11).
data C_T247 type T247 occurs 0 with header line.
mydate = sy-datum.
call function 'MONTH_NAMES_GET'
TABLES
MONTH_NAMES = C_T247
EXCEPTIONS
others = 9.
READ TABLE C_T247 WITH KEY MNR = mydate+4(2).
concatenate mydate6(2) C_T247-KTX mydate0(4) into mychar
separated by '-'.
write mychar.
Output: 02-SEP-2005
Svetlin
P.S. If you find an answer helpful, please assign reward points.
Message was edited by: Svetlin Rusev
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |