09-25-2008 12:41 AM
We have a requirement in ABAP wherein we want to show the date from the date picker in u201C 10-Sep-2008u201D format and not in u201C10.09.2008u201D as it is appearing in the screenshot shown below.
Currently we have binded the context to u2018DATSu2019 type and date is appearing as u201C10.09.2008u201D when user selects from the date picker , can anybody tell me which data type I have to use to get the format in u201C10-Sep-2008u201D in the screen.
Is date format dependent on User Profile , if yes I checked SU01 transaction also but could not find the format u201CDD-MMM-YYYYu201D.
Could you kindly help me on this?Thank you.
Please note the middle is MMM, three digits
09-25-2008 2:08 AM
Hi There
I am not sure if SAP can give you an o/p with MMM but if you already have the date with you say 10.09.2008 then you might want to concatenate the month .
09 wil stand for Sep and so you can do the following:
l_month = 'Sep'.
l_date has lets say your date of 10.09.2008.
Concatenate l_date0(2) l_month l_date6(4) into l_new_date separated by ' - ' .
l_new_date will now be 10-Sep-2008.
Thanks
Shivika
09-25-2008 2:28 AM
Hi,
The function module
CONVERSION_EXIT_SDATE_OUTPUT
converts DD.MM.YYYY to DD-MMM-YYYY.
Regards,
R.Nagarajan.
09-25-2008 5:26 AM
Hi...
Use the function module..,
MONTH_NAMES_GET,
and then concatenate date with offsets.
Thanks,
Naveen.I
09-25-2008 5:52 AM
Hi,
Try this Below Sample Code...
TABLES : mkpf.
DATA : lv_date_low TYPE datum.
DATA : lv_date_high TYPE datum.
SELECT-OPTIONS : p_dates FOR mkpf-xblnr VISIBLE LENGTH 12.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dates-low.
CALL FUNCTION 'F4_DATE'
IMPORTING
select_date = lv_date_low.
IF lv_date_low IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = lv_date_low
IMPORTING
output = p_dates-low.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dates-high.
CALL FUNCTION 'F4_DATE'
IMPORTING
select_date = lv_date_high.
IF lv_date_high IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = lv_date_high
IMPORTING
output = p_dates-high.
ENDIF.
Regards,
Durai.V
09-25-2008 6:03 AM
Hi,
Try using the FMs below:
CONVERSION_EXIT_IDATE_INPUT
CONVERSION_EXIT_IDATE_OUTPUT
Thanks,
Sriram Ponna.
09-25-2008 6:21 AM
Hi
See below code...
PARAMETERS : DATE TYPE SY-DATUM.
DATA : TEXT2(20).
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
INPUT = DATE
IMPORTING
OUTPUT = TEXT2.
WRITE : / TEXT2.
REPLACE ALL OCCURRENCES OF '.' IN TEXT2 WITH '-' .
WRITE : / TEXT2.
If u want it to be like in that format in Selection screen then u can use the loop at screen... Endloop.. and events to get the desired result...
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
09-25-2008 6:44 AM
Check out this code:
DATA: i_t247 TYPE STANDARD TABLE OF t247 INITIAL SIZE 0,
wa_t247 TYPE t247,
v_date TYPE datum,
v_long_date TYPE c LENGTH 11.
v_date = sy-datum.
" Table T247 stores the 3 char text for months
SELECT * FROM t247 INTO TABLE i_t247
WHERE spras = sy-langu.
READ TABLE i_t247 INTO wa_t247
WITH KEY mnr = v_date+4(2).
IF sy-subrc = 0.
CONCATENATE v_date+6(2) wa_t247-ktx v_date+0(4)
INTO v_long_date SEPARATED BY '-' .
WRITE: /1 v_long_date.
ENDIF.
output will be:
25-SEP-2008
Edited by: Sourav Bhaduri on Sep 25, 2008 11:25 AM
09-25-2008 6:50 AM
Hi Hoo,
Data : w_date type dats value '20080925', "yyyymmdd
w_date1(10),
Constants : C(1) value '-'.
w_date1 = w_date.
concatenate w_date+6(2) w_date+4(2) w_date+0(4) into w_date1 separated by C.
Write : / w_date1.
Regards
09-25-2008 6:51 AM
09-25-2008 7:00 AM
Hi ,
try this...
data: ws_input type sy-datum,
ws_date type char20.
ws_input = '20080321'.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = ws_input
IMPORTING
OUTPUT = ws_date
.
Replace All Occurences of '.' IN ws_date with '-'.
write ws_date.
Regards,
Sivappriya.