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

Regarding Function Module

Former Member
0 Likes
702

Hi,

My requirement is to get the total number of weeks from finacial year(ie APRIL) to current date.

Is there any functional module?

1 ACCEPTED SOLUTION
Read only

former_member209217
Active Contributor
0 Likes
667

Hi Janani,

Chk this FM once HR_IE_NUM_PRSI_WEEKS

Returns number of weeks between 2 periods.

Regards,

Lakshman.

6 REPLIES 6
Read only

former_member209217
Active Contributor
0 Likes
668

Hi Janani,

Chk this FM once HR_IE_NUM_PRSI_WEEKS

Returns number of weeks between 2 periods.

Regards,

Lakshman.

Read only

former_member189420
Active Participant
0 Likes
667

Hello,

Are you looking for weeks as in Monday to Sunday or consecutive 7 days?

If you want to know like 7 days ( a week ) between two date. Say for fiscal year 04.01.2008 to 03.31.2009 then check the following code.

Data: date_from type sy-datum value '04012008',
         date_to type sy-datum value '03312009',
         days_difference type i,
         weeks(4) type n.  

days_difference = date_to - date_from.

weeks = days_difference / 7.

Hope this helps.

Thanks & Regards,

Anand Patil

Read only

Former Member
0 Likes
667

Search the SCN to get the difference between the dates..there ar lot many threads which are answerd.

Read only

Former Member
0 Likes
667

Hi,

Check the following snippet



data: num like PC26W-WEEKS.
CALL FUNCTION 'HR_IE_NUM_PRSI_WEEKS'
  EXPORTING
    tax_year_begin            = '20090101'
    period_begin              = '20090401'
    period_end                = sy-datum
 IMPORTING
   NUM_WEEKS                 = num
 EXCEPTIONS
   END_LT_START              = 1
   END_LT_YEAR_START         = 2
   START_LT_YEAR_START       = 3
   OTHERS                    = 4
          .
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: num.

Read only

Former Member
0 Likes
667

Try this,it will helps...



DATA : NO_WEEKS TYPE PC26W-WEEKS,
       YR_BEGIN TYPE SY-DATUM,
       BEGIN_DT TYPE SY-DATUM,
       END_DT   TYPE SY-DATUM.

YR_BEGIN = '20090323'.
BEGIN_DT = '20090323'.
END_DT   = '20090623'.



CALL FUNCTION 'HR_IE_NUM_PRSI_WEEKS'
  EXPORTING
    tax_year_begin            = YR_BEGIN
    period_begin              = BEGIN_DT
    period_end                =  END_DT
 IMPORTING
    NUM_WEEKS                 = NO_WEEKS
.

Read only

Former Member
0 Likes
667

Hi,

You can also use function module HR_99S_INTERVAL_BETWEEN_DATES.

Regards,

Kumar Bandanadham