To get working day
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........
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.
Similar Messages
-
Get working day of month for specific date
Hi,
I need to get the working day of a month for a specific date. For example: Which working day is the 15th of september 2005...
Is there any function module, I could use?
Cheers ArneHI arne,
1. DATE_CHECK_WORKINGDAY
This is the FM.
2. Along with that u will have to use some logic.
3. Just copy paste in new program
(it will help in the logic)
<b>It will list out
all the working days
between two given dates</b>
REPORT abc.
data : num type i.
parameters : frdate type sy-datum default '20051216'.
parameters : todate type sy-datum default '20051221'.
perform getinfo using frdate todate changing num.
break-point.
*& Form getinfo
text
FORM getinfo USING fromdate todate CHANGING numofdays type i.
DATA : d TYPE sy-datum.
d = fromdate - 1.
DO.
d = d + 1.
IF d > todate.
EXIT.
endif.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = d
factory_calendar_id = '01'
message_type = 'I'
EXCEPTIONS
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
factory_calendar_not_found = 5
message_type_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
numofdays = numofdays + 1.
write :/ d.
ENDIF.
ENDDO.
ENDFORM. "getinfo
regards,
amit m. -
Get working days of actual month in time management
Hello,
a customer wants his employees to work some additional time every workday. The time is different for each employee and has to be specified on a monthly basis, but has to be shown daily in time sheet.
Days with holidays or illness do not require additional work, but count when calculation daily quota.
I would like to use P0050-ZTZUA to store the value of the hours which the employee has to work extra per month.
Now I need to divide this value through the number of workdays of the actual month, to get a value per day. Unfortunately I did not find any operation to get number of workdays.
Thanks in advanceHello again.
I did not get it!
I made a simple PCR "Z123" just to test, how to count days. It looks like this:
D VARSTCURMO
** HRS=1 ADDDB9082
I call this with ACTIO Z123 and see, that the result for timetype 9082 is 1 at every day that is evaluated in my calculation period.
In the example I do not care for workingdays, I just wanted to test, if the counting of days is functioning.
Since the timetype 9082 is cumulated, I get number of days of period at the end of the time calculation in SALDO-Table.
For example:
Day Saldo in 9082
January 1 1
January 2 2
January 3 3
January 31 31
My problem is, that I need the number of days at each day of the calculation. Already at January 1 I need to divide a given amount of time through the number of days (31 in the example).
I'm afraid, that this issue cannot be solved? -
How to get the last(latest or previous) working day
hi,
using sysdate we may be getting today's date and sysdate-1 will be fetching the yesterday's date. but if sysdate-1 turns to be sunday or a holiday then we need to get the previous date to that holiday date .THe list of holidays are in lt_list_holidays. The Holiday date shall be the holiday_date column. I need a query which displays the last (latest or previous) working day ..
Please advice
Edited by: vine on Jul 20, 2010 5:30 AM
Edited by: vine on Jul 20, 2010 5:51 AMHi,
vine wrote:
hi ,
THe queery seems to be fine but in the middle if we have any holidays and the holidays are in lt_list_holidays table . the name of the holiday date is holiday_date in lt_list_holiday.Is the name of the holiday important? I'll assume not. I'll also assume you have a column d (a DATE) that is the date of the holiday.
>
Please adviceThat's quite a different problem from what you first posted.
Instead of posting a question x, waiting for someone to answer it, and then saying that the problem is really y, don't you think it would be better to post question y in the first place?
You can do something like this:
WITH prev_days AS
SELECT TRUNC (SYSDATE) - LEVEL AS a_date
FROM dual
CONNECT BY LEVEL <= 4 -- worst case (see below)
SELECT MAX (a_date) AS previous_work_day
FROM prev_days
WHERE TO_CHAR (a_date, 'Dy', 'NLS_DATE_LANGUAGE=''ENGLISH''')
NOT IN ('Sat', 'Sun')
AND NOT EXISTS ( SELECT 1
FROM lt_list_holiday
WHERE d = prev-days.a_date
;Where I work, holidays are never consecutive, in fact, they are always at least 7 days apart, so I can be sure that a period of 4 consectuive days will always contain at least one work day. (There may be two weekend days plus one holiday; that's the worst case.) If you can have two or more holidays in a row, or holidays spaced 3 days apart (so that one might fall on a Friday, and the other on Monday), then increase the "magic number" 4 in
CONNECT BY LEVEL <= 4 -- worst caseto something appropriate. If you put it too high (say 10), no serious harm is done. -
ABAP - Function module to get the number of working days between 2 days
Hi gentlemen,
I have been asked to produce a report that gives the number of working days between 2 days, based on a calendar.
I didn't find anything...
Has any of you already written a function module to get this ?
A great thanks in advance.
Jacques LagrifHi ,
you can try this ,
when you require the number of working days between D1 and D2
Total No of Days will be
D2 - D1
No of holidays between D1 and D2 , use the FM HOLIDAY_GET
Pass the From date , to date , and the factory calendar to get the of Holidays
Total no of days - Number of Holidays will your Working days
Regards,
Sathya -
Need to get available working day
Hi All,
I'm using oracle 9i version.
i have a procedure which will take 1 in parameter and 1 out parameter.
we will pass one inputdate
now the date which i passed is sunday or holiday then we have to return the next working day that holiday list i'm getting form holiday_list table.
now the problem is suppose i passed a date which is sunday so now i have to return like the inputdate+1 so that it will be monday . but now i need to check weather that monday also holiday or not in the holiday list
if it is then i have to go for next like INputdate+2 again there also i have to check the same for this till i get a available date .
can some suggest how to handle this problem.
Thanks in advance
-RGSQL> select * from holidays;
DT
01-JUL-07
11-JUL-07
02-JUL-07
07-JUL-07
SQL> exec :your_date := '07-jul-2007';
PL/SQL procedure successfully completed.
SQL> select min(dt) dt
2 from(
3 select trunc(to_date(:your_date,'dd/mm/yyyy')) + level - 1 dt
4 from (select case when count(*) <= 8 then 9 else count(*) end cnt
5 from holidays
6 where dt >= trunc(to_date(:your_date,'dd/mm/yyyy')))
7 connect by level <= cnt
8 )
9 where to_char(dt,'fmday') != 'sunday'
10 and dt not in(select dt
11 from holidays
12 where dt >= trunc(to_date(:your_date,'dd/mm/yyyy')))
13 /
DT
09-JUL-07
Message was edited by:
jeneesh
curved path...... -
How can i get a number of working days in a month PL/SQL
How can i get a number of working days in a month(excluding Saturday and Sunday) in a query in PL/SQL ?
Please do a search before posting
sql>
select count(*)
from(
select trunc(sysdate,'month')+rownum-1 dy
from all_objects
where rownum <= last_day(sysdate) - trunc(sysdate,'month')+1)
where to_char(dy,'fmday') not in ('sunday','saturday');
COUNT(*)
23
Message was edited by:
jeneesh
Please try yourself to change the query to one that doesn't use a subquery.. -
Billing date of 2nd/4th saturday getting pushed to next working day.
whenever my client trying to create bill of service order, bills on 2nd/4th saturday, the billing date is getting pushed to next working day. I checked their calender, they have maintained 2nd/4th saturday as holiday in holiday calender. However the validity is only till 2009. But the bills are getting still getting pushed. Am not too keen on using validation, please help.
Hi,
Are they creating invoices thru back ground ( using batch job ) ? in this case in the holiday calendar 2n'd and 4'th saturday is holiday, so the system is proposing new work day. you have to check all the three calendars once again let me know.
Thanks,
Chandu. -
Pass working day to get factory calendar date
Hello Experts,
I wish to get the factory calendar date, specific to a factory calendar, based on a working day.
Basically, if i pass say 4, then i want to get the date for the 4th working day based on a specific factory calendar.
Can someone throw some light on possible function module that i can use?
ThanksI want to pass sy-datum to get factory date and then check if this factory date is the 4th busiess day for that month based on a specific calendar.
Or if i can pass in 4th bus day for a month (just pass 4) based on a specific factory calendar (just pass calendar id), then i would want the factory date, which i want to compare against sy-datum in my subsequent logic.
I am trying to trigger a data load stating if factory date for this month = 4th business day, then run load, else dont. And this in BW.
I dont have the FM that you mentioned above, in BW and is available only in R/3 -
Get Nexr working day for the given calendar id
Hello,
My requirenment is I have a date.If that date falls on friday then I have to get the next working day date i.e.Monday for the given Calender iDDATA:wk_dat TYPE scal-indicator.
PARAMETERS:pa_dat TYPE sy-datum.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = pa_dat
IMPORTING
day = wk_dat.
CHECK wk_dat = 5.
pa_dat = pa_dat + 3.
WRITE pa_dat.
here if u want to get the next working day
Use FM DATE_CHECK_WORKINGDAY after the check statement.
add the date until u find a working day. -
I can not get my battery life to last an entire work day. All I really do is check emails, calendars and facebook. Usually by 4pm, it is 3/4 of the way used up. Someone told me that I could be because of my apps and that they could be runnign all the time. Is there a way to turn them off when not using?
http://www.apple.com/batteries/iphone.html
-
How To Get Last 5 Working Days ?
It should take saturday and sunday as non-working days.
I need to take care of month changes also. The preceeding month can be of 30 , 31 or 28 days. We need to take care of year change also. The java Date class doesn't work well , even Calendar abstract class also doesn't do well if month change from
feb to jan , mar to feb , may to apr , jun to may ,aug to jul , nov to oct is required.
if input date given is 5 Feb 2001(calculate last 5 working days)
the output dates should be
5/2/2001
2/2/2001
1/2/2001
31/1/2001
30/1/2001Here's an exmple:
//last 5 working days
import java.util.*;
class LastFiveWDays{
public static void main(String [] a){
boolean done = false;
int i=0;
Date date = new Date();
Date[] lastFive = new Date[5];
GregorianCalendar cal = new GregorianCalendar();
while(!done){
if( cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY ||
cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY ){
//skip
cal.roll(Calendar.DATE, false);
else{
date = cal.getTime();
//add to array
lastFive[i] = date;
cal.roll(Calendar.DATE, false);
i++;
if (i>=5) break;
print(lastFive);
public static void print(Date[] arr){
for (int i=0;i<5;i++){
System.out.println(arr.toString()); -
Do you know any function module which will give me the previous working day only by ignoring saturdays and sundays and it should NOT consider holidays.
Example:
Monday's Date should give me previous friday's date.
Friday's Date should give me previous thrusday's dateHello Ramesh,
I assume you have your factory calendar ID with you:
DATA:
L_V_PREDT TYPE DATUM, "Next Day.
L_V_PREDT = SY-DATUM - 1.
* Get the next Working Day as per Factory Calendar
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '-' " -VE to get the previous date
DATE = L_V_PREDT
FACTORY_CALENDAR_ID = 'HY' "--> Give your factory cal. ID here
IMPORTING
DATE = V_PREWD
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
* Do Nothing
ENDIF.
If you want to use the FM: BKK_GET_PRIOR_WORKDAY, still then you have to use the operation:
L_V_PREDT = SY-DATUM - 1.
And pass L_V_PREDT to the FM. You can test with 23.03.2009 date & check )
Hope this helps.
BR,
Suhas
Edited by: Suhas Saha on Mar 19, 2009 4:56 PM -
Function module for getting teh last working day of a month.
Hi GURUS,
this is criteria,please help me
if V_T001B- FRYE1 < month entered in selection screen
Then throw the error message
Else
Find the previous period and its last working day from the function module
(i..e Assume entered date as June 2 2009 then
Period 6 -1 = 5.
Pass the month 05 to function module then
Find last working day.
Keep it in a variable (V_LAST_PRD_WRKDAY)
Proceed further.
thanks in advance,
RajeevHi Rajeev,
You can use Function Module LAST_DAY_IN_PERIOD_GET.
Ex:
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = p_gjahr
i_periv = lwa_t009b-periv
i_poper = lwa_t009b-poper
IMPORTING
e_date = s_audat-high.
Regards,
Ravi K -
FM to get number of working days in a date range for a calender
Hi all,
Can you tell me the Function Module which takes start date ,, end date and factory calender as input and gives back working days or number of working days as return.
Win full points for the resolution...
Thanks in Advance...
Chandan DubeyHi chandan,
1. DATE_CHECK_WORKINGDAY
This is one useful FM
2. Try this code (just copy paste)
IT DOES EXACTLY WHAT U REQUIRE.
REPORT abc.
data : num type i.
parameters : frdate type sy-datum default '20051216'.
parameters : todate type sy-datum default '20051221'.
perform getinfo using frdate todate changing num.
break-point.
*& Form getinfo
text
FORM getinfo USING fromdate todate CHANGING numofdays type i.
DATA : d TYPE sy-datum.
d = fromdate - 1.
DO.
d = d + 1.
IF d > todate.
EXIT.
endif.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = d
factory_calendar_id = '01'
message_type = 'I'
EXCEPTIONS
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
factory_calendar_not_found = 5
message_type_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
numofdays = numofdays + 1.
write :/ d.
ENDIF.
ENDDO.
ENDFORM. "getinfo
I hope it helps.
Regards,
Amit M.
Maybe you are looking for
-
Accounts Payable Trial Balance Report does not include a Credit Memo amount
Hello Experts, We are having an issue with Ap Trial Balance report not displaying a credit memo amount whereas Gl Balance shows that amount. The Credit Memo has a August invoice date and September pay date but it's not showing up
-
UI Defaults Import problems and best practice for using UI defaults
Hi, I'm hoping some of you experts can tell me how to Import the UI Defaults from Schema A and Workspace A to Schema B and Workspace B. My goal is to fluidly share the UI defaults with another developer as we march forward creating new versions of th
-
I just took a class for dreamweaver but it was useless, cause they didn't mention anything I needed help with. So i was wondering if anyone knew any good sites to learn on how to use css2. I need to use it very minimaly, as all I'm trying to figure o
-
Where to store my recorded videos
I'm new to Mac and currently all of my recorded videos are stored in "Movies" (not to be confused with iMovie). I noticed there is a place in iPhoto called "iPhoto videos". Where is the best place to store my recorded videos? Not sure if there is an
-
Will this tiny computer with the new iMovie 10 work for editing small ten minute films or shorts in HD AVCHD. I'll get a new and bigger MacBook Pro and Final Cut X in a few months. Thank You