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: 

Fn mod for date

Former Member
0 Kudos

xperts,

any fn mod available for getting dates like;

if i am exec on Mon;

Sun Mon Tue Wed Thu Fri Sat

Sun Mon Tue Wed Thu Fri Sat (10 days)

if i am executing it on Wed.

Sun Mon Tue Wed Thu Fri Sat

Sun Mon Tue Wed Thu Fri Sat (8 days)

wat i need is the date.

and the passing parameter is sy-datum

eq:if sy-datum = 20081023

dates i hav to gt : 23 24 27 28 29 30 31

3 REPLIES 3

Former Member
0 Kudos

Hi

PARAMETERS: p_datum TYPE sy-datum.

data: day type sy-datum,
      last_day_of_month TYPE sy-datum.

START-OF-selection.

  CALL FUNCTION 'LAST_DAY_OF_MONTHS'
    EXPORTING
      DAY_IN            = p_datum
    IMPORTING
      LAST_DAY_OF_MONTH = last_day_of_month.

  day = p_datum.
  do.
    write: / day.
    if day = last_day_of_month.
      exit.
    endif.
    day = day + 1.
  enddo.

Max

0 Kudos

I dont think he needs last days in months, if I got him correctly what he is looking for is all the days except sat / sun upto next friday

#1 - I dont think there is a FM for that, you need to code for that finding the day for your date, then adding the days accordingly.

Former Member
0 Kudos

Developed logic for that,

lv_dat_tmp = sy-datum.

do 14 times.

call function 'RH_GET_DATE_DAYNAME'

exporting

langu = sy-langu

date = lv_dat_tmp

importing

daynr = lv_daynr.

if lv_daynr eq 6.

lv_dat_tmp = lv_dat_tmp + 2.

elseif lv_daynr eq 7.

lv_dat_tmp = lv_dat_tmp + 1.

else.

lx_date-pedtr = lv_dat_tmp.

append lx_date to lt_date.

if lv_daynr eq 5 and lv_status ne 6.

lv_status = 1.

endif.

lv_dat_tmp = lv_dat_tmp + 1.

lv_status = ( lv_status * 1 ) + 1.

endif.

if lv_status eq 7.

exit.

endif.

enddo.