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: 

to get working day

Former Member
0 Kudos

Hi Gurus,

my requirement is to get a working day.

I know how many days my work will take to finish i.e no of days, let us say 10 days

I need to add these number of working days to the system date excluding the weekend days.i.e I need to add 10 working days to the system date.

Any help is appreciated...........

Thanks,

Sudhaaaaaaaa........

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

Do like this:


DATA: it_psp TYPE STANDARD TABLE OF ptpsp WITH HEADER LINE,
      wrk_days type i.

CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'  "get EE working days
    EXPORTING
      pernr = "EE number here
      begda = "start date in your case sy-datum
      endda = "end date in your case sy-datum+10
    TABLES
      perws = it_psp.  "now you will get work schedule within this period but more general

  "you have to take only days you are interested in
  wrk_days = 0.
  LOOP AT it_psp WHERE datum BETWEEN sy-datum AND sy-datum+10
                 AND tagty = 0      "work/paid
                 AND stdaz <> 0.   "working hours
    ADD 1 TO wrk_days.  "here you have how many days are really working ones between sy-datum and 10 days later
  ENDLOOP.

1 REPLY 1

MarcinPciak
Active Contributor
0 Kudos

Do like this:


DATA: it_psp TYPE STANDARD TABLE OF ptpsp WITH HEADER LINE,
      wrk_days type i.

CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'  "get EE working days
    EXPORTING
      pernr = "EE number here
      begda = "start date in your case sy-datum
      endda = "end date in your case sy-datum+10
    TABLES
      perws = it_psp.  "now you will get work schedule within this period but more general

  "you have to take only days you are interested in
  wrk_days = 0.
  LOOP AT it_psp WHERE datum BETWEEN sy-datum AND sy-datum+10
                 AND tagty = 0      "work/paid
                 AND stdaz <> 0.   "working hours
    ADD 1 TO wrk_days.  "here you have how many days are really working ones between sy-datum and 10 days later
  ENDLOOP.