Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

FM for Date format.

Former Member
0 Likes
577

Hi All,

I need a FM in which i can pass date i.e DATS and i want the output with month in char format.

eg.

input - 29/01/08 or any format

output should be 29-JAN-08.

plz help..

Thanks,

Riya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
538

Hi,

parameters: p_date type sy-datum obligatory.

data: month_names LIKE t247 OCCURS 0 WITH HEADER LINE.

data: v_month like t247-ktx, v_result(20).

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

language = sy-langu

TABLES

month_names = month_names

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2.

read table month_names with key mnr = p_date+4(2).

if sy-subrc = 0.

v_month = month_names-ktx.

endif.

concatenate p_date6(2) v_month p_date2(2) into v_result separated by '-'.

write:/ v_result.

4 REPLIES 4
Read only

Former Member
0 Likes
538

YOu can use the FM:

CONVERSION_EXIT_SDATE_OUTPUT

Read only

Former Member
0 Likes
538

get month names from table : T247 or use FM

MONTH_NAMES_GET to get month names ..

Get the required month name passing month ...

Read only

vinod_vemuru2
Active Contributor
0 Likes
538

Hi Riya,

First u have to convert ur date from dd/mm/yy to yyyymmdd and then pass this to FM CONVERSION_EXIT_SDATE_OUTPUT.

Thanks,

Vinod.

Read only

Former Member
0 Likes
539

Hi,

parameters: p_date type sy-datum obligatory.

data: month_names LIKE t247 OCCURS 0 WITH HEADER LINE.

data: v_month like t247-ktx, v_result(20).

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

language = sy-langu

TABLES

month_names = month_names

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2.

read table month_names with key mnr = p_date+4(2).

if sy-subrc = 0.

v_month = month_names-ktx.

endif.

concatenate p_date6(2) v_month p_date2(2) into v_result separated by '-'.

write:/ v_result.