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

Calculation on Date

Former Member
0 Likes
952

Hello Experts,

How to get the name of weekdays from the date.

Means if the date is 23.10.2007 then i have to get the name of the weekday for this date. like whether it is Monday or any other.

Plz reply soon

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
923

hi,

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.

regards

siva

8 REPLIES 8
Read only

Former Member
0 Likes
924

hi,

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.

regards

siva

Read only

Former Member
0 Likes
923

FM are

DATE_TO_DAY

DATE_COMPUTE_DAY

This will solve ur query

Reward if it does

Regards

Read only

Former Member
0 Likes
923

use the function module RH_GET_DATE_DAYNAME

to get the name of the weekday

just pass the language and the date ot this FM and it will return the name of the day

Read only

Former Member
0 Likes
923
Read only

Former Member
0 Likes
923

Hi,

Use FM <b>DATE_TO_DAY</b>

regards,

paras

Read only

Former Member
0 Likes
923

Hi,

Try with this one

WEEKDAY_GET.

If u don't find a solution goto SE37

GIVE WEEK_DAY and press f4. U will get different function modules with that one.

Assign points if useful.

Read only

former_member188827
Active Contributor
0 Likes
923

data day TYPE T246-LANGT.

CALL FUNCTION 'ISP_GET_WEEKDAY_NAME'

EXPORTING

DATE = '20071023'

language = 'E'

  • WEEKDAY_NUMBER = ' '

IMPORTING

  • LANGU_BACK = 'EN'

LONGTEXT = day

  • SHORTTEXT =

  • EXCEPTIONS

  • CALENDAR_ID = 1

  • DATE_ERROR = 2

  • NOT_FOUND = 3

  • WRONG_INPUT = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

WRITE / day.

plz reward if dis helps

Read only

Former Member
0 Likes
923

Hi Rahul,

Use FM <b>RH_GET_DATE_DAYNAME</b>.

Pass the language and date field .U will get weekday.

E.g. if u pass date as 23.10.2007

and lang as en.

u will get weekday - 2 Tuesday.

Regards,

Hemant