Application Development 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: 

regarding month and week

0 Kudos

hai all,

i have to genrate a report in which i have to display the month with three character from the date given in select-options and in other report i have to display the week form the selected date.how can i do this.

pls reply as soon as possible.

with regards

sridhar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

try this:

tables: T247.

DATA: WEEK LIKE SCAL-WEEK.

*

select single * from T247 where spras = sy-langu

and mnr = sy-datum+4(2).

*

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

DATE = sy-datum

IMPORTING

WEEK = WEEK.

*

write: / t247-mnr, t247-ktx, t247-ltx, week(4), week+4(2).

*

Regards, Dieter

8 REPLIES 8

Former Member
0 Kudos

hi ,

take any fields ref to data element SPMON.

ex.

s_spmon for MCS1-spmon.

regards

prabhu

Former Member
0 Kudos

hi,

Use the function module 'MONTH_NAMES_GET' to get the month names.

Regards,

Jaya Vani

Former Member
0 Kudos

Hi,

Chk

Data element SPMON period to analyse on month

Data elemetn SPWOC period to analyse on week.

Regards.

Former Member
0 Kudos

HI,

data: A type sy-datum value '20080630',

c(8).

c = a+4(2).

write:/ a, c.

Week i am not sure.. but you can capture month like this

match the value with table T247 field MNR... YOu will get the three digit month name,

Regards

VIjay

Edited by: Vijay on Jul 1, 2008 1:52 PM

Edited by: Vijay on Jul 1, 2008 1:54 PM

Former Member
0 Kudos

hi,

you have date in select-option.

so you will be having month no.

using MONTH_NAMES_GET function module you can get three char for that month and for week wat exactly you want to show??week no??

DATE_GET_WEEK is a function module to find the week no..

Former Member
0 Kudos

Hi,

try this:

tables: T247.

DATA: WEEK LIKE SCAL-WEEK.

*

select single * from T247 where spras = sy-langu

and mnr = sy-datum+4(2).

*

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

DATE = sy-datum

IMPORTING

WEEK = WEEK.

*

write: / t247-mnr, t247-ktx, t247-ltx, week(4), week+4(2).

*

Regards, Dieter

Subhankar
Active Contributor
0 Kudos

Hi

Ur problem is solved.

please check it.

REPORT z_interactive_alv.

data : v_date TYPE sy-datum,

l_week TYPE KWEEK,

i_month TYPE STANDARD TABLE OF T247 INITIAL SIZE 0,

wa_month TYPE T247,

l_mon TYPE FCKTX.

v_date = '20080701'.

APPEND wa_month to i_month.

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

month_names = i_month

EXCEPTIONS

MONTH_NAMES_NOT_FOUND = 1

OTHERS = 2

.

IF sy-subrc = 0.

read TABLE i_month INTO wa_month with key MNR = v_date+4(2).

IF sy-subrc = 0.

l_mon = wa_month-KTX.

ENDIF.

ENDIF.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = v_date

IMPORTING

WEEK = l_week

EXCEPTIONS

DATE_INVALID = 1

OTHERS = 2

.

WRITE : / 'Month = ', l_mon .

WRITE: / 'Week = ' , l_week+4(2).

0 Kudos

HAI,

ALL THANKS FOR RESPONDING.SOLVED MY PROBLEM.

REGARDS,

SRIDHAR