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
585

Is there any standard function module to find the date within a week.

for example my input is 10-08-2007 and required date's day of week 3. it should return the wednesday's date 08-08-2007.

dynamically i will specify the return date by giving the day of week.

is there any function module.

Any idea.

Thanks in advance.

Maya.

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
564

Hi,

Please use FM RP_CALC_DATE_IN_INTERVAL.


data: wa_sdate  like sy-datum,
      wa_edate  like sy-datum.

move sy-datum to wa_sdate.

call function 'RP_CALC_DATE_IN_INTERVAL'
  exporting
    date      = wa_sdate
    days      = 3
    months    = 0
    signum    = '-'
    years     = 0
  importing
    calc_date = wa_edate.

write: / wa_edate.

Regards,

Ferry Lianto

4 REPLIES 4
Read only

amit_khare
Active Contributor
0 Likes
564

Why dont you directly Subtract it.

v_date = sy-datum - p_date.

this works.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
564

Hi,

Subracting the day number from the date given to you as an input will give you the date of the day of the week.

Hope it was useful.

Thanks,

Sandeep.

Read only

ferry_lianto
Active Contributor
0 Likes
565

Hi,

Please use FM RP_CALC_DATE_IN_INTERVAL.


data: wa_sdate  like sy-datum,
      wa_edate  like sy-datum.

move sy-datum to wa_sdate.

call function 'RP_CALC_DATE_IN_INTERVAL'
  exporting
    date      = wa_sdate
    days      = 3
    months    = 0
    signum    = '-'
    years     = 0
  importing
    calc_date = wa_edate.

write: / wa_edate.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
564

solved