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

Date, Week, Month Function Module ??

Former Member
0 Likes
546

Hi all,

I need a FM , where i can give input as Date and in outupt it should give me two things.

1) Month of the Date

2) all Weeks of the month (starting date and Ending Date)

Thanks in advance.

Message was edited by: Vipin Nagpal

4 REPLIES 4
Read only

Former Member
0 Likes
496

WEEK_GET_FIRST_DAY - returns first day of week

You can calculate the month using.

DATA month(2) TYPE c.

month0(2) = mydate4(2).

Read only

Former Member
0 Likes
496

Hi Vipin,

1. MONTH_NAMES_GET

This is the FM

2. try this code ( just copy paste)

REPORT abc.

DATA : mname(10) TYPE c.

PARAMETER : d TYPE sy-datum.

PERFORM getmonth USING d mname.

WRITE 😕 mname.

&----


*& Form getmonth

&----


  • text

----


  • -->M text

  • -->MNAME text

----


FORM getmonth USING d mname.

DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.

DATA : m(2) TYPE c.

m = d+4(2).

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

month_names = month_names

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2

.

READ TABLE month_names INDEX m.

IF sy-subrc = 0.

mname = month_names-ltx.

ENDIF.

ENDFORM. "getmonth

regards

amit m.

Read only

0 Likes
496

GET_WEEK_INFO_BASED_ON_DATE will give the week info.

and FM month_names_get will give the month name.

regards

vijay

Read only

Former Member
0 Likes
496

Hi again,

1. GET_WEEK_INFO_BASED_ON_DATE

This will give the startdate and enddate

of the week (for a particular date)

2. This will not fully solve your problem,

but just a hint !

regards,

amit m.