You can do this by following line of code:
DATA(l_day) = m_date - CONV d(m_date(4) && '0101' ) + 1.
Where m date is the date that needs to be input as type d. Note the format of type d is YYYYMMDD.
If the above function is not present in your system, you can use the below code using simple date subtraction.
DATA: l_date TYPE d, l_jan_01 TYPE d, l_day TYPE i. l_date = “your input date in YYYYMMDD format” l_jan_01 = l_date. l_jan_01+4 = '0101'. ( sets the date to first day of year) l_day = l_date - l_jan_01 + 1.