10-07-2008 5:58 PM
Hi All,
I have a requirement in which one of the output field is date.
I am fetching it in format DD.MM.YYYY.But the client wants it
in 1 OCT 2008 format.Any FM or method to achieve so.
Thanks in Advance,
Saket
10-07-2008 6:03 PM
Hi,
I used below logic to convert this.
*Start Date
SELECT SINGLE ltx FROM t247 INTO month_name
WHERE spras = is_audit-langu
AND mnr = sy-datum+4(2).
IF sy-subrc EQ 0.
CONCATENATE sy-datum+6(2) ',' INTO gv_date.
CONCATENATE month_name gv_date sy-datum+0(4) INTO gv_date SEPARATED BY space.
ENDIF.
Thanks,
Sree.
10-07-2008 6:05 PM
Hi,
To search an FM you can always type in the search string and go ahead.
Just type * date * and search and you will get a lot of function modules which you can use to convert the date.
Regards,
Pramod
10-07-2008 6:06 PM
Check this,
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
INPUT = SY-DATUM
IMPORTING
OUTPUT = V_DATE.
,CONVERSION_EXIT_IDATE_OUTPUT ,CONVERSION_EXIT_LDATE_OUTPUT
Any of this FM will Solve
Regards,
Midhun abraham
Edited by: Midhun Abraham on Oct 7, 2008 7:07 PM
10-07-2008 6:10 PM
Hi,
The following would do the trick.
report ztest.
start-of-selection.
data: begin of ls_date,
day(2) type c,
sep1(1) type c,
month(2) type c,
sep2(1) type c,
year(4) type c,
end of ls_date.
data: ls_month type t247,
lt_months type table of t247.
write: sy-datum to ls_date.
call function 'MONTH_NAMES_GET'
tables
month_names = lt_months
exceptions
month_names_not_found = 1
others = 2.
read table lt_months into ls_month with key mnr = ls_date-month.
write: / ls_date-day, ls_month-ktx, ls_date-year.
Darren
10-07-2008 7:35 PM
Hi Saketh,
here i am giving one table name just check that table .
Table name is T247
In that you have month in the format of JAN FEB like that.
Just pass the MNR value like 01 0r 02 like that and return value for KTX field.
Exampe:
12.03.2008.
ekko-bedat = 12.03.2008
WRITE ekko-bedat+3(2) TO gv_mnth.
WRITE ekko-bedat+0(2) TO gv_date.
WRITE ekko-bedat+6(4) TO gv_year.
SELECT SINGLE ktx FROM t247 INTO gv_month
WHERE mnr = gv_mnth.
CONCATENATE gv_date gv_month gv_year INTO gv_newdate SEPARATED BY SPACE.
WRITE: gv_newdate.
If you want to pass SPRAS field also in the SELECT query Then you will get EN type language.
Try this code.
You will get exact output what you are expecting.
Thanks,
Surendra Babu Vemula
10-07-2008 8:00 PM
10-07-2008 8:51 PM
Hi,
Example Code
DATA: wa_date TYPE dats VALUE '01102008',
wa_date1(15),
wa_month(4).
CASE wa_date+2(2).
WHEN 01.
wa_month = 'Jan'.
WHEN 02.
wa_month = 'Feb'.
WHEN 03.
wa_month = 'Mar'.
WHEN 04.
wa_month = 'Apr'.
WHEN 05.
wa_month = 'May'.
WHEN 06.
wa_month = 'Jun'.
WHEN 07.
wa_month = 'Jul'.
WHEN 08.
wa_month = 'Aug'.
WHEN 09.
wa_month = 'Sep'.
WHEN 10.
wa_month = 'Oct'.
WHEN 11.
wa_month = 'Nov'.
WHEN 12.
wa_month = 'Dec'.
ENDCASE.
CONCATENATE wa_date+0(2) wa_month wa_date+4(4) INTO wa_date1 SEPARATED BY SPACE.
WRITE wa_date1.
Regards
10-13-2008 7:03 AM