Get number of hours between two dates and two hours using factory calendar
Hello all,
I have the following requirement: I need to calculate the number of hours between two dates and two hours (start date- finish date and start hour-finish hour) or timestamps using a factory calendar. I must program it on CRM environment.
Does anybody know a function module that makes it?
Thanks in advance.
Carmen
Please check function module DURATION_DETERMINE.
- April King
Similar Messages
-
How do i get number of days between 2 dates?
How do i get number of days between 2 dates?
and the result must be in int.
for example
Ex. startdate: 2006-06-01 enddate: 2006-06-30 and the result is: 30
how to do so? thxmel
Iv'e used this method. It assumes startdate,enddate and days have been defined before but you could pass them as args.
void days()
try
Date d1 = DateFormat.getDateInstance().parse(startdate);
Date d2 = DateFormat.getDateInstance().parse(enddate);
long days = (d2.getTime()-d1.getTime())/1000/60/60/24;
days = ""+days;
catch (ParseException e)
System.out.println("Invalid date format");
}It actually gets the duration in ms and divides down to days.
Regards
Chris -
How can I get number of days between 2 dates ?
How can I get number of days between 2 dates ?
Give me answer as soon as possible.....Mukesh_Prajapat wrote:
How can I get number of days between 2 dates ?
Give me answer as soon as possible.....Is google broken again?
[How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html] -
Getting number of days between 2 dates
Hello All,
I require the number of days between 2 dates.
The number of days is between low date : PR Date (not an input variable) and the high date.
I have created an customer exit variable to get sy-datum in made it as formula variable.
I have also created a formula variable for PR Date , and subtracted the 2 dates.
It is not giving the correct result.
Any suggestions.
Thanks & Regards,
VLRead through this web link. It will show you how to calculate the days between 2 dates directly in your BEX query.
No exit needed to calculate this.
http://teklink.co.uk/sap/sap-bi-bw-how-to-use-replacement-path-variables-to-perform-date-calculations-in-the-bex-analyzer/ -
How to calculate number of days between fixed date and hire date in schema
i want to calculate the number of days between a fixed date en the hire date (infotype 041)
If i read the documentation right, i should use the following command:
HRS=YDXA02
Variable 3 (the x) is the fixed data.
My question is how do i program the variable x?
Let's say the date 01.01.2008
Any help would be welcomeI assume we are talking about PCR for payroll. In this case look at documentation for operation NUM:
OOOOOO
Xnnnnn
X Table
nnnnn Table field
nn Date type 'nn' from the Date Specifications infotype (0041)
Date types are taken from table T548Y.
Your operation would look like:
NUM=Faaesb
F Fixed indicator for deadline calculation
aa Date type: Start date of period to be
calculated; if the date type is not 'nn,'
the second position is left blank.
e Unit, in which the duration is calculated:
T = days
W = week
s End date of period to be calculated:
(blank) End of current payroll period
J End of current calendar year
A Start of current calendar year
B Start of WPBP period
No other specifications are possible.
So it depends on what kind of fixed date you need.
Hope it helps,
Carlos. -
The Google calendar's information is accurately saved on our end on this sample page.
Works for me on Linux.
You can try http://kb.mozillazine.org/Time_and_time_zone_settings -
How can i get number of days between two dates represented by two dates?
how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?
tej_222 wrote:
But how do I do that conversion. from java.sql.date and java.util.date to calender?
-thanks for the quick response.You may find the following utility code samples useful:
[http://balusc.blogspot.com/2007/09/calendarutil.html]
[http://balusc.blogspot.com/2007/09/dateutil.html]
ganeshmb wrote:
(date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar. -
Substacting two dates and get result in months
Hi Friends
I have to subtract two dates and get the difference in months. Here's the sample data:
select DATE '2009-10-01' Date_value, 111 Cust_id, DATE '2009-10-22' Open_date from dual
union all
select DATE '2009-10-01', 112 , DATE '2009-10-15' from dual
union all
select DATE '2009-10-01', 113 , DATE '2009-10-5' from dual
union all
select DATE '2009-11-01', 111 , DATE '2009-10-22' from dual
union all
select DATE '2009-11-01', 112 ,DATE '2009-10-15' from dual
union all
select DATE '2009-11-01', 113 ,DATE '2009-10-22' from dualAnd here’s my query to get the difference in month:
SELECT cust_id, date_value, open_date,
ROUND (ABS (date_value - open_date) / 365 * 12) diff_in_months
FROM tBut the output is unexpected:
CUST_ID DATE_VALUE OPEN_DATE DIFF_IN_MONTHS
111 1/10/2009 22/10/2009 1
112 1/10/2009 15/10/2009 0
113 1/10/2009 5/10/2009 0
111 1/11/2009 22/10/2009 0
112 1/11/2009 15/10/2009 1
113 1/11/2009 22/10/2009 0Ideally, the output should be as per the following:
CUST_ID DATE_VALUE OPEN_DATE DIFF_IN_MONTHS
111 1/10/2009 22/10/2009 0
112 1/10/2009 15/10/2009 0
113 1/10/2009 5/10/2009 0
111 1/11/2009 22/10/2009 1
112 1/11/2009 15/10/2009 1
113 1/11/2009 22/10/2009 1What is wrong in my query?Hi Centinul
Found the resolution. When I use the following query, I get the perfect result:
SELECT cust_id, date_value, open_date,
ROUND (ABS (MONTHS_BETWEEN (open_date, date_value))) months,
ROUND (ABS (date_value - open_date) / 365 * 12) diff_in_months,
MONTHS_BETWEEN (date_value,ADD_MONTHS (LAST_DAY (open_date), -1) + 1 ) final_val
FROM tAnd here's the output of all three columns:
CUST_ID DATE_VALUE OPEN_DATE MONTHS DIFF_IN_MONTHS FINAL_VAL
111 1/10/2009 22/10/2009 1 1 0
112 1/10/2009 15/10/2009 0 0 0
113 1/10/2009 5/10/2009 0 0 0
111 1/11/2009 22/10/2009 0 0 1
112 1/11/2009 15/10/2009 1 1 1
113 1/11/2009 22/10/2009 0 0 1 -
Number of days between 2 dates
HI,
I am working on a program that needs to show number of days between 2 dates. When I scanned the function library, I only found a function to give you the number of years between dates. I can probably code this in ABAP but does anyone know if a function exists to do this.Hi Suneela
Are you concern with the normal dates or do you have any concern with the Factory dates ?
Lets take both
1) Normal dates
It seems that you are trying to get the days between two dates , That you can simply get by subtracting one from the other or else by .
Assuming that you populated the dates just after the declaration .
Sample code
Data : date1 like sy-datum,
Date2 like sy-datum ,
No_of_days type i.
No_of_days = date1 date2.
Or Else the FM
Days_between_two_dates
Sample code
Data : date1 like sy-datum,
Date2 like sy-datum ,
No_of_days type i.
Call function days_between_two_dates
Exporting
I_datum_bis = Date2 Second date
I_datum_von = date1 Start date
Importing
E_tage = No_of_days
Exceptions
Days_method_not_defined = 1
Others = 2.
2) Factory dates
If You want to find out the difference based on factory calendar
Then convert the dates to factory calendar dates first and then simply subtract those factory calendar dates to get offset days based on factory calendar.
*Sample code *
Data : date1 like sy-datum,
Date2 like sy-datum ,
No_of_days type i.
data: l_fac_date like SCAL-FACDATE , " Factory calendar: Factory
l_fac_date2 like SCAL-FACDATE,
l_fac_date1 like SCAL-FACDATE.
Perform get_factory_date using date1
Changing l_fac_date1.
Form get_factory_date using l_date
Changing l_l_fac_date.
IF NOT l_date1 IS INITIAL.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '+'
DATE = l_date
FACTORY_CALENDAR_ID = 'AU' "
IMPORTING
DATE =
FACTORYDATE = l_l_fac_date
WORKINGDAY_INDICATOR =
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Endform.
Move l_fac_date to l_fac_date1.
*Do the same for the second date also i.e .
Perform get_factory_date using date2
Changing l_fac_date2.
No_of_days = l_fac_date1 - l_fac_date2.
Hope this will help you.
Reward points if helpful -
Hi Experts,
We have a requirement to fetch the value of 'No of days' between Invoice date and due date (Two variable date fields on the template) in an Analysis.
Please let me know the procedure of how to achieve the same.
Regards,
Revit's good for ideas but implementation a bit different
Oracle Business Intelligence Publisher Report Designer's Guide
This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
<?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
where
format is the time value for which the difference is to be calculated
Example:
<?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
returns
-7 -
Pick list date must be between order date and cancellation date
Hi all
A client gets this error:
Pick list date must be between order date and cancellation date Message[173-89]
The date is between that range.
What else could be the reason for it.
ThanksHi
Since the message you received is very user friendly - date must be between....
I guess you have two situation
1.Either operation is incorrect
- Create a similar scenario in your test environment
-Are you receiving same error
-Test with only one item so far
-Check what is the result
2 . You probably need to upgrade your patch level
It might be coming from Application error
Hope this helpls
Bishal -
Number of days between to dates
Hello to all,
I would like to define a formula to calculate number of days between two dates and update the value in a key figure.
*operand: {Name of keyfigure,Fecha ini (Mes/Año),Fecha Fin (Mes/Año)}
DATA FECHAINI TYPE ZIOV_FEIN.
DATA FECHAFIN TYPE ZIOV_FFIM.
DATA INI TYPE 0CALMONTH.
DATA FIN TYPE 0CALMONTH.
DATA DIA_INI TYPE D.
DATA DIA_FIN TYPE D.
DATA DIAS TYPE F.
FOREACH FECHAINI, FECHAFIN.
INI = FECHAINI.
FIN = FECHAFIN.
*C2DATE Determine end period date
DIA_INI = C2DATE(INI, E).
DIA_FIN = C2DATE(FIN, E).
DIAS = DIA_FIN - DIA_INI.
{ZIOV_DIAS,FECHAINI,FECHAFIN} = DIAS.
ENDFOR.
Problem: UPF057 type F conflicts with type D.
Help would be much appreciated.
Regards,
PatríciaThe function is built in:
CALL METHOD CL_RSAR_FUNCTION=>DATE_DIFF(
EXPORTING I_DATE_1 = L_ARG2
I_DATE_2 = L_ARG3
IMPORTING E_RESULT = L_ARG1 ) -
Select a number of fields between one field and another
Hello,
Is there any way to make a SELECT to show a number of fields between one field and another,
without writting all the fields one by one ?
For example, I have one table with these fields:
TABLE EMPLOYEE:
ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
write in the SELECT all the fields one by one.
Is this possible?
Thank you very much.
Sorry for my english it's not very good.Swam wrote:
Hello,
Is there any way to make a SELECT to show a number of fields between one field and another,
without writting all the fields one by one ?
For example, I have one table with these fields:
TABLE EMPLOYEE:
ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
write in the SELECT all the fields one by one.
Is this possible?
Thank you very much.
Sorry for my english it's not very good.If you use the DBMS_SQL package to execute your query you can reference the columns by position rather than name.
One examples of using DBMS_SQL package:
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
3 cols DBMS_SQL.DESC_TAB;
4 ncols PLS_INTEGER;
5 v_min_col NUMBER := 2;
6 v_max_col NUMBER := 4;
7 v_val VARCHAR2(4000);
8 v_bindval VARCHAR2(4000);
9 v_ret NUMBER;
10 d NUMBER;
11 BEGIN
12 -- Parse the query.
13 DBMS_SQL.PARSE(cur, 'SELECT * FROM emp', DBMS_SQL.NATIVE);
14 -- Retrieve column information
15 DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
16 -- Display each of the column names and bind variables too
17 FOR colind IN v_min_col..v_max_col
18 LOOP
19 DBMS_OUTPUT.PUT_LINE ('Column:'||colind||' : '||cols(colind).col_name);
20 DBMS_SQL.DEFINE_COLUMN(cur,colind,v_bindval,4000);
21 END LOOP;
22 -- Display data for those columns
23 d := DBMS_SQL.EXECUTE(cur);
24 LOOP
25 v_ret := DBMS_SQL.FETCH_ROWS(cur);
26 v_val := NULL;
27 EXIT WHEN v_ret = 0;
28 FOR colind in v_min_col..v_max_col
29 LOOP
30 DBMS_SQL.COLUMN_VALUE(cur,colind,v_bindval);
31 v_val := LTRIM(v_val||','||v_bindval,',');
32 END LOOP;
33 DBMS_OUTPUT.PUT_LINE(v_val);
34 END LOOP;
35 DBMS_SQL.CLOSE_CURSOR (cur);
36* END;
SQL> /
Column:2 : ENAME
Column:3 : JOB
Column:4 : MGR
SMITH,CLERK,7902
ALLEN,SALESMAN,7698
WARD,SALESMAN,7698
JONES,MANAGER,7839
MARTIN,SALESMAN,7698
BLAKE,MANAGER,7839
CLARK,MANAGER,7839
SCOTT,ANALYST,7566
KING,PRESIDENT,
TURNER,SALESMAN,7698
ADAMS,CLERK,7788
JAMES,CLERK,7698
FORD,ANALYST,7566
MILLER,CLERK,7782
PL/SQL procedure successfully completed.
SQL>Of course, if you were going to do this properly you would bind the correct datatypes of variables based on the types of the columns (the type information is also available through the describe information) -
Difference between master data and transactional data
Hi experts i have just started learning BW can u plz let me know the difference between Master data and Transactional data in bw ? and why is master data is first loaded before the transactional data ? thanks .....
Hi
Transaction data represents any transaction occured between two parties like Customer and Vendor.
We maintain id's to maintain the Customer and Vendor.
When we look at the id we don't have a clue like who is the customer, where does he live,,....
So all this info is maintained in Master data in three categories:
1. Attributes
2. Text
3. Hierarchies.
Collection of Attribute, Texts and Hierarchies is called master Data in BI/BW.
Eg: 0MATERIAL, 0CUSTOMER,,,,,
Master data: is data that remains unchanged over a long period of time. Master data contains information that is always needed in the same way. Characteristics can bear master data in BW. With master data you are dealing with attributes, texts or hierarchies.
http://help.sap.com/erp2005_ehp_03/helpdata/EN/58/a4513ce4af0a40e10000000a114084/frameset.htm
Master Data is one form of the historical data. There is no frequent changes in the data.Every application has it's own Master Data.
In BI the master Data has been divided into
Characterstics
Texts
Hierarchies
We can load Master Data through different ways.
Pls. find the below link
http://help.sap.com/erp2005_ehp_03/helpdata/EN/58/a4513ce4af0a40e10000000a114084/frameset.htm
hope it helps u
regards
gaurav -
What is the Difference Between Sys Date and Effective Date ??
Hi Gurus,
Can any one pls let me know What is the Difference Between Sys Date and Effective Date ??
with regards
User600722EFFECTIVE DATE usually refers to a date-tracked record (although not exclusively).
Date-tracked records in Oracle HR have an EFFECTIVE START DATE and an EFFECTIVE END DATE. The record is 'EFFECTIVE' between these dates. In reports, you often use SYSDATE to compare to these two dates to find the CURRENT effective record, e.g. SYSDATE BETWEEN EFFECTIVE START DATE AND EFFECTIVE END DATE.
When you make changes to a HR record, you can choose between DATE TRACKING options, such as CORRECT or UPDATE (there are others too). CORRECT will overwrite the record and replace the data with your changes. This is normally used when you need to correct something that is wrong. UPDATE will create a new version of the record from the EFFECTIVE START DATE you choose. It will also set the EFFECTIVE END DATE of the previous record to the day before your new record's EFFECTIVE START DATE. That enables a history of records to be maintained so you can see what your data looked like at ay one point in time.
Regards
Tim
Edited by: TimW on Sep 23, 2008 2:37 PM
Maybe you are looking for
-
Business Rules in 10.1.2?
Hi Is it possible to use Business Rules with Application Server 10.1.2? If so, do I have to get the ear-files from 10.1.3? On OTN, there is a page on SOA Suite, where you can download Business Rules, but it is only a preview release. Whre can I find
-
Interactive report & htmldb_Get
I have 3 pages in my application: 1. Main 2. Report 3. Interactive report The source SQL code of Report is the same as Interactive report. The HTML header&footer of Report is the same as Interactive report. I use function load_report for calling the
-
How to unconfigure a Custom Authentication Module for Convergence
After flailing with the incomplete instructions for [Writing a Custom Authentication Module for Convergence|http://wikis.sun.com/display/CommSuite/Writing+a+Custom+Authentication+Module+for+Convergence] , I decided to try to revert back to the defaul
-
I HAD UPGRADED TO 3.6 AND ON THAT PAGE IT GIVES THE OPTION TO UPGRADE AGAIN TO FIREFOX 4? BUT I 'M NOT SURE AS TO HOW IT WORKS AS IT ASKED TO SAVE DURING THE DOWNLOAD BUT I CAN NOT FIND OR SEE WHERE IT TOOK FOR THE DOWNLOAD? DO I NEED TO DO SOMETHING
-
So I was downloading albums for my phone on the macbook pro and I tried putting in the charger for my phone but i had it in reverse and when i tried putting it in it just completely turned off. When i connected it to the charger the light on the char