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 next friday

Former Member
0 Likes
1,773

Hi,

I want FM for get the date of next friday.

Thanks.

Hi,

I want FM for get the date of next friday.

Thanks.

6 REPLIES 6
Read only

Former Member
0 Likes
1,220

Hi,

You can use the following FM /OSP/GETDATE_WEEKDAY to retrieve the date of next occuring week day so you can add up 4 days to the date will give you fridays date.

Regards,

anil

Read only

Former Member
0 Likes
1,220

Hi,

just as an addition to anil's suggestion:

DATA: NEXT_FRIDAY TYPE /OSP/DT_DATE.

CALL FUNCTION '/OSP/GETDATE_WEEKDAY'

EXPORTING

IV_DAY_OF_WEEK = 5

IV_START_DATE = SY-DATUM

IV_TIME = '235959'

IMPORTING

EV_DATE_DAY_OF_WEEK = NEXT_FRIDAY.

  • EXCEPTIONS

  • INVALID_DAY = 1

  • OTHERS = 2

.

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 NEXT_FRIDAY.

Regards

Joe

Read only

0 Likes
1,220

Thanks. I found the solution.

Read only

0 Likes
1,220

Hi,

Can you share with us?

Regards,

anil

Read only

0 Likes
1,220

Yes. Of course.

1 - Call FM: 'DATE_GET_WEEK' for get the number of week

2 - Call FM: 'WEEK_GET_FIRST_DAY' for get monday date

3 - monday date + 4

Read only

0 Likes
1,220

Y can give me the points if you want