Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How Many Fridays in a Month

Hi ABAP Experts,

is there any FM or code which can determine how many i.e. fridays are in a month?

thanks,

YNS

Tags:
Former Member
Former Member replied

Hello

parameters: p_mon like marv-lfmon.
parameters: p_gja like marv-lfgja.
data: date like sy-datum,
day type p,
counter type i.

concatenate p_gja p_mon '01' into date.
do.
  day =date mod 7.
  if day > 1.
     day = day - 1.
  else.
     day = day + 6.
  endif.
  if day = 5.
    counter = counter + 1.
  endif.
  date = date + 1.
  if date+4(2) > p_mon.
    exit.
  endif.
enddo.

write: 'there is', counter, 'fridays'.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question