A counter of periods between dates
Hi all,
i got a query, that the user input a fiscper for example: 005.2009,
now i have to make a counter of periods from 000 to the selected, in this case = 5 periods,
then, y got a KF with an amount for example = 1000, this amount i have to divide between the counter, in this case
1000 / 5 = 200, this 200 is the number what i need to do, but this i can do it with the counter of periods, thats what i m looking for, how to do this counter of periods, help guys
Hi John,
Please use exception aggregation to create a count restricted on Fiscal Period ( Count of all values ) . Now you can use this in your formula.
-Vikram
Similar Messages
-
How to count the days between Date Range using OO ABAP?
hi experts,
i want to count the days between Date Range using OO ABAP for that which class and method can i use?.
Thanks,
Mahesh.Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
REPORT zz_date_diff.
CLASS date_diff DEFINITION.
PUBLIC SECTION.
METHODS diff IMPORTING i_date_fm TYPE d
i_date_to TYPE d
EXPORTING e_days TYPE i.
ENDCLASS."
CLASS date_diff IMPLEMENTATION.
METHOD diff.
e_days = i_date_to - i_date_fm.
ENDMETHOD."
ENDCLASS."
DATA: g_ref TYPE REF TO date_diff,
g_days TYPE i,
g_date_fm TYPE d VALUE '20080101',
g_date_to TYPE d VALUE '20090101'.
START-OF-SELECTION.
CREATE OBJECT g_ref.
CALL METHOD g_ref->diff
EXPORTING
i_date_fm = g_date_fm
i_date_to = g_date_to
IMPORTING
e_days = g_days.
WRITE g_days. -
How to calculate period between date/time?
All,
I have not been able to find any function module that does this.
I have a create date/time from a table (VBAK).
I need to calculate the difference in days/hours/minutes (seconds not needed) between the date in this table and the current date/time.
Then based on the result - e.g. difference is say 2 days 3 hours and 50 minutes - I will compare to a comfigured period users input to determine record selection.
I can get date difference - SAP handles that - but the hours and minutes are a different story.
Thanks.
ScottNo Matters if problem solved by own. Surely Posting a solution would help others needed person in future .
-
Count, Group by between dates
I am trying to count the number of IDs dropped and enrolled in each unit for each of the 4 terms between their perspective dates.
There are 4 Terms and an ID can participate in a unit in any of these terms:
TERM
START_DATE
END_DATE
1
25-Feb-13
18-Mar-13
2
27-May-13
17-Jun-13
3
26-Aug-13
16-Sep-13
4
25-Nov-13
16-Dec-13
I am trying to count how many IDs enrolled in a unit between those dates and how many doped before the end date
The ENROL_DATE for each ID in a unit has to be between the given Term Dates to count.
Unit KIS has 1 ENROL and one DROP in TERM 1
UNIT POL occurs in TERM 2 and 4 and both DROP
UNIT LIN and 1 ENROL and 1 DROP in 2 different TERMS
My problem is how do i specify count ENROL and count drop between the Term dates and then group by TERM and UNIT.
Please see below table for given data and expected result. It should make sense.
Thanks,
{code}
CREATE TABLE DAN_GR4
(ID NUMBER(12),
STATUS VARCHAR2(12),
TERM NUMBER(12),
ENROL_DTE DATE,
TERM_START_DTE DATE,
TERM_END_DATE DATE,
UNIT VARCHAR2 (12));
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('1', 'ENROL' ,'1', '15-Mar-13' ,'25-Feb-13' ,'18-Mar-13', 'KIS');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('1', 'DROP' ,'2', '27-MAY-13' ,'27-MAY-13' ,'17-JUN-13', 'POL');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('1', 'DROP' ,'2', '27-JUN-13' ,'27-MAY-13' ,'17-JUN-13', 'LIN');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('1', 'DROP' ,'3', '27-JUN-13' ,'27-MAY-13' ,'17-JUN-13', 'PUI');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('2', 'DROP' ,'3', '26-SEP-13' ,'26-AUG-13' ,'16-SEP-13', 'POL');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('2', 'ENROL' ,'4', '26-NOV-13' ,'25-NOV-13' ,'16-DEC-13', 'LIN');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('3', 'DROP' ,'4', '15-DEC-13' ,'25-NOV-13' ,'16-DEC-13', 'LIN');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('3', 'DROP' ,'4', '15-DEC-13' ,'25-NOV-13' ,'16-DEC-13', 'POL');
INSERT INTO DAN_GR4 (ID,STATUS,TERM,ENROL_DTE,TERM_START_DTE,TERM_END_DATE,UNIT) VALUES ('3', 'DROP' ,'1', '15-DEC-13' ,'25-FEB-13' ,'18-MAR-13', 'KIS');
{code}
GIVES:
ID
STATUS
TERM
ENROL_DTE
TERM_START_DTE
TERM_END_DATE
UNIT
1
ENROL
1
15-Mar-13
25-Feb-13
18-Mar-13
KIS
1
DROP
2
27-May-13
27-May-13
17-Jun-13
POL
1
DROP
2
27-Jun-13
27-May-13
17-Jun-13
LIN
1
DROP
3
27-Jun-13
27-May-13
17-Jun-13
PUI
2
DROP
3
26-Sep-13
26-Aug-13
16-Sep-13
POL
2
ENROL
4
26-Nov-13
25-Nov-13
16-Dec-13
LIN
3
DROP
4
15-Dec-13
25-Nov-13
16-Dec-13
LIN
3
DROP
4
15-Dec-13
25-Nov-13
16-Dec-13
POL
3
DROP
1
15-Dec-13
25-Feb-13
18-Mar-13
KIS
WANT:
UNIT
TERM_START_DTE
DROP_BEFORE_END_DATE
TERM
KIS
1
1
1
POL
1
2
POL
1
3
POL
1
4
LIN
1
1
4
LIN
1
2
PUI
1
3
USING:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64biwith
dan_gr4 as
(select '1' id,
'ENROL' status,
'1' term,
to_date('15-Mar-13','dd-MON-rr') enrol_dte,
to_date('25-Feb-13','dd-MON-rr') term_start_dte,
to_date('18-Mar-13','dd-MON-rr') term_end_dte,
'KIS' unit
from dual
union all
select '1','DROP','2',to_date('27-MAY-13','dd-MON-rr'),to_date('27-MAY-13','dd-MON-rr'),to_date('17-JUN-13','dd-MON-rr'),'POL' from dual union all
select '1','DROP','2',to_date('27-JUN-13','dd-MON-rr'),to_date('27-MAY-13','dd-MON-rr'),to_date('17-JUN-13','dd-MON-rr'),'LIN' from dual union all
select '1','DROP','3',to_date('27-JUN-13','dd-MON-rr'),to_date('27-MAY-13','dd-MON-rr'),to_date('17-JUN-13','dd-MON-rr'),'PUI' from dual union all
select '2','DROP','3',to_date('26-SEP-13','dd-MON-rr'),to_date('26-AUG-13','dd-MON-rr'),to_date('16-SEP-13','dd-MON-rr'),'POL' from dual union all
select '2','ENROL','4',to_date('26-NOV-13','dd-MON-rr'),to_date('25-NOV-13','dd-MON-rr'),to_date('16-DEC-13','dd-MON-rr'),'LIN' from dual union all
select '3','DROP','4',to_date('15-DEC-13','dd-MON-rr'),to_date('25-NOV-13','dd-MON-rr'),to_date('16-DEC-13','dd-MON-rr'),'LIN' from dual union all
select '3','DROP','4',to_date('15-DEC-13','dd-MON-rr'),to_date('25-NOV-13','dd-MON-rr'),to_date('16-DEC-13','dd-MON-rr'),'POL' from dual union all
select '3','DROP','1',to_date('15-DEC-13','dd-MON-rr'),to_date('25-FEB-13','dd-MON-rr'),to_date('18-MAR-13','dd-MON-rr'),'KIS' from dual
select unit,term,max(decode(enrolled,'within','Late')) late_enrolment,max(dropped) when_dropped
from (select unit,term,
case when status = 'ENROL'
then case when enrol_dte between term_start_dte and term_end_dte
then 'within'
else 'outside'
end
end enrolled,
case when status = 'DROP'
then case when enrol_dte < term_start_dte
then 'before start'
when enrol_dte < term_end_dte
then 'before end'
else 'after end'
end
end dropped
from dan_gr4
group by unit,term
order by unit,term
UNIT
TERM
LATE_ENROLMENT
WHEN_DROPPED
KIS
1
Late
after end
LIN
2
after end
LIN
4
Late
before end
POL
2
before end
POL
3
after end
POL
4
before end
PUI
3
after end
Regards
Etbin -
Periods between two dates .
Hi,
can anyone tell me any function module dat returns the no of periods between two dates .like
if i enter 02.02.2007
05.05.2007
then it shud return periods .
011
012
001
002
003
thnx ,
point will b assigned.Hi Nishu,
I think what you are looking for in the example below is periods 02, 03,04,05 when you enter dates 02.02.2007 to 05.05.2007.
you have to write a customer exit on posting period.
check the paper below on how to write customer exit and how to derive a variable from another variable.
https://websmp210.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf
Jaya -
Hi,
I need to create a counter kf which should populate 1 and 0 to this counter field. Please let me know is there any difference between data type
NUMBER (DEC) and INTEGER (INT4).
Please suggest.
Thanks & Regards,
Pavan kumarHi Pavan,
The basic difference between Number(DEC) and INT4 is its internal storage in system.
For Number (DEC) - Value internally stored as packed number with 3 decimal places whereas INT 4 as 4 byte integer without decimal places.
For counter KF, you can go for INT 4.
Hope this helps.
Thanks -
Difference between data selection period and personal seletion period
Hi
Experts ,
ples Expline ,
Difference between data selection period and personal seletion period. to Data screening .Data selection period means
For example if u given any period,
here we are checking whether data is valid in this period.
Personal selection period means
we are checking whether person is valid in a given period.
Example is:
For example if the employee resigned in a company on 15th of month.
He can get the salary only at the end of month it means his data is avilable upto end of month.
But when you consider his status from 16th to end of month
the person is not available.
So when u given date(16th to end of month) in data selection period is showing that person data is avilable.
But when mention that date in person selection period it is showing no person is avilable.
if useful
reward with points............ -
Making Period Start Date read-only on Appraisal page
Hi,
I have a requirement to default Appraisal Period Start Date and Period End Date and make these fields non-editable. I am able to default the values for these fields by extending CO. When I make these fields read-only and performs any operation on page, getting error
+'You must enter a value for Period Start Date as criteria for the List Of Values.'+
Please suggest a solution to resolve this error.
Thanks.
Edited by: user12037955 on May 12, 2011 9:26 PMpublic void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
java.util.Date dateValue1 = null;
java.util.Date dateValue2 = null;
java.util.Date date = null;
OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
OAMessageDateFieldBean bean1=(OAMessageDateFieldBean)webBean.findIndexedChildRecursive("StartDate");
OAMessageDateFieldBean bean2=(OAMessageDateFieldBean)webBean.findIndexedChildRecursive("EndDate");
String startDate=bean1.getText(pageContext);
String endDate=bean2.getText(pageContext);
String strDate1=null;
String strDate2=null;
if((startDate==null||startDate.equals(""))&& (endDate==null||endDate.equals("")))
date=pageContext.getCurrentDBDate();
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
String dateValue=simpledateformat.format(date);
String year=dateValue.substring(0,4);
try
String sqlStatement = "";
CallableStatement cs = null;
// OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
OADBTransactionImpl txn = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
cs = txn.createCallableStatement(" ",1);
sqlStatement = "SELECT to_char(to_date(ffv.attribute1,'RRRR/MM/DD HH24:MI:SS'),'DD-MON-YYYY') attribute1, " +
" to_char(to_date(ffv.attribute2,'RRRR/MM/DD HH24:MI:SS'),'DD-MON-YYYY') attribute2 " +
" FROM apps.fnd_flex_value_sets ffvs,apps.fnd_flex_values ffv " +
" WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id " +
" AND ffvs.flex_value_set_name = 'XXX_PMP_Fiscal_Date_VS' " +
" AND (SYSDATE BETWEEN NVL(ffv.start_date_active,SYSDATE) AND NVL(ffv.end_date_active,SYSDATE)) " +
" AND flex_value= " + year +
" AND ffv.enabled_flag = 'Y' ";
ResultSet rset = cs.executeQuery(sqlStatement);
if (rset.next())
strDate1 = rset.getString(1);
strDate2= rset.getString(2);
catch(Exception e)
throw new OAException("Error:" + e.toString(), OAException.ERROR ) ;
SimpleDateFormat convertFormat = new SimpleDateFormat("dd-MMM-yyyy");
if(strDate1!= null || strDate2!=null)
try
dateValue1 = convertFormat.parse(strDate1.toString());
dateValue2 = convertFormat.parse(strDate2.toString());
catch(Exception exception)
bean1.setValue(pageContext,dateValue1);
bean2.setValue(pageContext,dateValue2);
bean1.setReadOnly(true);
bean2.setReadOnly(true);
} -
Passing between date paramters to a different page in the application
Hi,
I'm woking on a drill down report in Apex 4.0.
Page1: (standard Report)
select transactiondate, storenumber, count(amount) as Count from transactions (transactiondate data type is DATE).
Created two items :P1_From_Date and :P1_To_Date
When i run the Page1 with the from_date and to_date given, reports populate the data for the particular date,(eg: 15-NOV-2011).
Until this point everything is fine.
In Page 2, I need to show the detail of every transactions for a particular store.
Created a hidden item in page 2 as :P2_storenumber
created a link on the Count column in Page1, select :P2-storenumber corresponding to the #COUNT#
Query on page 2 is : select transactiondate, storenumber,amount from transactions
here i want to get the transaction for a day (between 15-NOV-2011 00:00 and 15-NOV-2011 23:59 ).
How can I accomplish this requirement, by passing the date parameters from the Page1 for any date in Page2.
Please help.
thanks in advance.Hi user13561710,
Assuming the items on page 1 are populated with date values, you can simply reference them in the query on page 2:
select transactiondate, storenumber,amount from transactions where storenumber = :P2_storenumber and transaction_date between :P1_from_date and :P1_to_date
If need be, you could always explicitly convert the date items to a date (and not rely upon the implicit conversion), for example:
select transactiondate, storenumber,amount from transactions where storenumber = :P2_storenumber and transaction_date between to_date(:P1_from_date,'DD-MON-RRRR') and to_date(:P1_to_date,'DD-MON-RRRR')
assuming the formart of the date value on page 1 is DD-MON-RRRR.
I hope this helps.
Joel -
Hi ,
I need the data of NOV and DEC 2007. First i need to check in my table whether i have the data of NOV and DEC 2007 .
I am not able to use a proper query to find out the data .
select count(*) from optout_tbl where date between ("2007-11-07" and "2007-12-07");
I am using this please query . but its saying missing expression . I think i am wrong .
Could any one suggest to me to find the data . Moreover its a normal table not a partitioned one.
ThanksWhen i am using the below query to get the data between the selected months . I am getting error like missing expression , even i tried with double code' still have the same problem .
plz tell me that which am using queyr have any changes required.
SQL> select count(*)
from optout_tbl
where date between TO_DATE('2007-11-07', 'YYYY-MM-DD')
and TO_DATE('2007-12-07', 'YYYY-MM-DD');
where date between TO_DATE('2007-11-07', 'YYYY-MM-DD')
ERROR at line 3:
ORA-00936: missing expression
Thanks -
Hello -
I've been tearing my hair out over this problem i'm trying to solve, probably just been staring at it too long which is making it worse -
I have a series of open support tickets which are supposed to be updated on a daily basis, the problem is that they aren't always being updated daily. So, the business wants to know the number of days from when a ticket was last updated and today's
date. I have this basic calculation and it's working fine, however now the business wants to exclude weekends from the calculation. The other problem is that some reps DO go in on weekends and update their tickets, so sometimes there will be updates
made on weekend dates.
To give an example -
Today's date is 2014-02-10 (Monday). A ticket was last updated last Thursday, 2014-01-30. The difference between the two dates is 11, so it's been 11 days since the ticket was last updated. Now, if I exclude Saturdays and Sundays, then
it's actually been 7 days since the ticket was last updated. I'm not sure how to do this in T-SQL.
Now, to further complicate the problem, sometimes a ticket IS updated on a Saturday or Sunday. So, if a ticket was updated on 2014-02-02 (Sunday), then it should be counted. Again i'm not sure how to do this.
What gets me is that this is probably fairly simple and i've just been staring at it too long. In the meantime, can someone offer some guidance?
Thanks!!I've adapted this from a function on my blog. you will need to add set the YourTicketTable to where ever your tickets are stored.
CREATE
FUNCTION [dbo].[CalcWorkDaysBetween](@StartDate
As DateTime,@EndDate
AS DateTime)
RETURNS
INT AS
BEGIN
SET @EndDate
=DATEADD(DAY,1,@EndDate)
DECLARE @Count
AS Int= 0
DECLARE @Date
As Date=@StartDate
WHILE @Date
< @EndDate
BEGIN
IF (DATEPART(WEEKDAY,@Date)IN(1,7)
OR (SELECT
Count(*)
FROM YourTicketTable WHERE TicketDate=@Date)=1)
BEGIN
SELECT @Count = @Count
+ 1
END
SELECT @Date=DATEADD(Day,
1,@Date)
END
RETURN
DATEDIFF(DAY,@StartDate,@EndDate)- @Count
END
Regards, -
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
Period open date in FA_DEPRN_PERIODS
I want to know what controls period open date and close in FA_DEPRN_PERIODS
table. We have first open period (JAN-02) for year 2002 from '02/27/2002' and
now we have some depriciation transaction for this year (2002) before this
date.
So when we are running Journal Entry Reserve ledger Report for this year then
those transaction are not matching showing up because they are before
'02/27/2002'. So can I update period open date to early date or what is the
impact on system.Did you refer note 1061798.1
If this note didn't help you,
let us know the version also let us know if the GL period is ever used.
Regards,
Srini -
Not possible to determine posting period for date
Hi SAP Guru
While Creating the Shipment cost document in [VI01] transaction I am getting the error
Not possible to determine posting period for date with error Message no. SE105. There is no long text available
Please provide the solution for the same
Regards
RahulHi Friend,
Check the posting periods for the company code in OB62 and OMSY.
Check whether they are in currenct date or not.
if not maintain them in MMPV for Company code.and OB62 for the fiscal year variant.
regards,
santosh -
Error posting asset to company ''Specify payment period baseline date''
Hi All,
Please some can advise on the below error msg.
While posting the asset in to company I will get error like ''Specify payment period baseline date'' and i cant go further.
Please advise ASAP.
Many Thanks
Balaji A SDear:
This error message normally appears if In the payment terms that you are using (can be seen in OBB8) there is no any default date assigned to the payment term. If it is then assign one like Posting Date or Document Date in OBB8 against the payment term you using. I am a bot confused in your case that why are you getting this error while acquiring the asset. Would you please elaborate the process you are using for asset acquisition.
Regards
Maybe you are looking for
-
Adobe Acrobat 6.0 Professional Problem
The subject software freezes upon opening and will not get beyond the initial start-up screen. Eventually after 10 minutes a syntax error will be displayed. I have attempted to repair the program many times and have also remove the program 3 times an
-
Using 1080i50 in a 720p30 sequence... Can I do this and then print PAL?
Hi, I just shot a music video, and my camera shoots a 1080i50. My editing suite is FCE 3.5.1, which is pretty good, apart from its limited sequence settings. Since the maximum output I will need for the video is 720p, I wanted to try editing it direc
-
No Lock & Edit button in WLS 10 Console
I don't have the Lock & Edit button in the WLS 10 Console. I know that this could be turned on and off in previous versions of WebLogic in the config.xml file, but I didn't find this anywhere in the documentation anymore. Can anybody tell me how to m
-
I have been teaching myself the new Oracle Coherence HotCache technology & am playing around with it. I have a question about the JPA implementation. From what I have read, HotCache is built on TopLink & uses the JPA mappings metadat to update the ca
-
Lost or corrupted keyword tags
I'm having trouble bringing a PSE catalog fully back to life...All my pictures are all in the current catalog, but only five of about twenty-five thematic keyword tags are still there, and even those five don't bring up the full set of pictures they