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 ( function module )

Former Member
0 Likes
2,147

Hi ,

Suppose I have a DATE : 03.03.2007, is thr any function module to find out whether its a Sunday, Monday, Tuesday....Saturday of the week.

Regards

Avi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,016

Use Function Module DAY_IN_WEEK... pass the date to this FM and it will return the day in number..

Then use FM DAY_NAMES_GET and pass the number to this FM to get the actual Day as u want...

reward points if helpful

10 REPLIES 10
Read only

Former Member
0 Likes
2,017

Use Function Module DAY_IN_WEEK... pass the date to this FM and it will return the day in number..

Then use FM DAY_NAMES_GET and pass the number to this FM to get the actual Day as u want...

reward points if helpful

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
2,016

Hi,

You can use function module DATE_COMPUTE_DAY or DAY_IN_WEEK to get the numeric value of the day of the week. You can use function module WEEKDAY_GET to retrieve the language specific name of the week and an abbreviation of the name.

I hope this helps.

Sample code..

DATA : DATE like SCAL-DATE,

DAY LIKE SCAL-INDICATOR.

DATE = '20050728'.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = DATE

IMPORTING

DAY = DAY.

CASE DAY.

WHEN 1.

WRITE 😕 'MONDAY'.

WHEN 2.

WRITE 😕 'TUESDAY'.

WHEN 3.

WRITE 😕 'WEDNESDAY'.

WHEN 4.

WRITE 😕 'THURSDAY'.

WHEN 5.

WRITE 😕 'FRIDAY'.

WHEN 6.

WRITE 😕 'SATURDAY'.

WHEN 7.

WRITE 😕 'SUNDAY'.

ENDCASE.

Cheers,

Simha.

Read only

Former Member
0 Likes
2,016

hi,

chk this

DATE_TO_DAY

PARAMETERS date LIKE sy-datum DEFAULT sy-datum.

DATA day LIKE dtresr-weekday.

CALL FUNCTION 'DATE_TO_DAY'

EXPORTING

date = date

IMPORTING

weekday = day.

WRITE: / date , day.

1. Monday 2. Tuesday ...

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
2,016

use fm DATE_TO_DAY

regards

shiba dutta

Read only

Former Member
0 Likes
2,016

date_compute_day FM will give u the day of that date

regards,

bharat.

Read only

anversha_s
Active Contributor
0 Likes
2,016

hi,

chk this.

DATA : day LIKE SCAL-INDICATOR.

CALL FUNCTION 'DATE_COMPUTE_DAY'
  EXPORTING
    date          = sy-datum
 IMPORTING
   DAY           = day
          .
WRITE : day.

Regards,

Anversha.S

Read only

Former Member
0 Likes
2,016

Avi,

Use the FM "DATE_TO_DAY".

Pls. reward if useful

Read only

Former Member
0 Likes
2,016

Hi,

Use the FM:

<b>RH_GET_DATE_DAYNAME</b> return the day based on the date provided

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
2,016

Hi avi,

the fm not only gives the number of the day but also the name if u pass the

language parameter and date...

RH_GET_DATE_DAYNAME

hope this helps u a bit,

all the best,

regards,

sampath

  • mark helpful answers

Read only

Former Member
0 Likes
2,016

Thx for the help.All Function modules are working for me