Last Record Values for a given Date Range
Hi, I have a unique requirement to process/report only the values of the last record found in a date range for a given set of characteristics. The order would be by FISCPER.
For example: I have some data with 3 characteristics.
STORE001 MATN001 2004001 100 PCS
STORE001 MATN001 2004005 75 PCS
STORE001 MATN001 2004006 80 PCS
STORE002 MATN002 2003008 10 PCS
STORE002 MATN002 2004001 15 PCS
STORE002 MATN002 2004004 40 PCS
A selected date range of 2003008 to 2004001 would result in the following records being processed.
STORE001 MATN001 2004001 100 PCS
STORE002 MATN002 2004001 15 PCS
A selected date range of 2004002 to 2004006 would result in the following records being processed.
STORE001 MATN001 2004006 80 PCS
STORE002 MATN002 2004004 40 PCS
How can I accomplish this at runtime? Any ideas?
Nope, it's not an inventory scenario. It could be say the last status of a gas meter within a selected date range.
Any other ideas?
I've considered using VKF, but haven't figured out how this would work yet. If I could modify the selected query data prior to query processing I might be able to number the records and then filter on that..... Anyway I'm open to any suggestions or leads!
I won't forget the points for anyone with a solution!
Thanks!
Similar Messages
-
Any FM to get count of each week day for the given date range
Hi guys,
Any FM to get count of each week day for the given date range?
eg: If i give 14/07/2008 to 14/08/2008
I need to find how many Mondays, tuesdays...sundays in this given date range.
If not single FM is available, any logic that gives above result is also appreciated.
Thanks,
Vinod.hi Vinod,
this is not a full solution, I just give you a basic idea:
DATA : lv_start TYPE sy-datum VALUE '20080714',
lv_end TYPE sy-datum VALUE '20080814'.
WHILE lv_start LE lv_end.
CALL FUNCTION 'FTR_DAY_GET_TEXT'
EXPORTING
pi_date = lv_start.
* IMPORTING
* PE_DAY_TEXT1 =
* PE_DAY_TEXT2 =
* PE_DAY =
* you have to summarize the output here somehow...
lv_start = lv_start + 1.
ENDWHILE.
hope this helps
ec -
Name of users of a particular Tcode for a given date range
Hi experts,
I am making an alv where inputs will be
1> T_code(as parameter)
2> Date Range(as Select options)
I have to display the following fields:::
1> User name
2> Frequency of use the Tcode for the given Date range.
Please give me the tables where I can get the relation of those fields.
N.B. I know the transaction AL08 and SM04.But it won't solve my purpose.
Thanx in advance,
Sourav>
SOURAV PAUL wrote:
> Hi experts,
> I am making an alv where inputs will be
> 1> T_code(as parameter)
> 2> Date Range(as Select options)
by creating the report As per your this requirement you need not to create any Bulk on your SAP.Just use STAD/STAT transaction they are availabe for this purpose.
and more you may track by security log audit by SM20 get these details.
i'm worried about tables which sre storing these details. -
Selecting last value for a given date
I've read some of the other threads on the this tope, but can't find a resolution.
My query is supposed to get the last values for the given two days (start date and end date) and I return the difference between the two values. The query as it is only works for days where there is an entry for 12:00 pm. On some days, it will therefore return nothing. But I'm not sure how to get it to choose the last value for the given day and still remain a fast query.
Here is a sample of the query with dates that return a result.
SELECT max_query.sgnl_id as sgnl, max_query.max_val - min_query.min_val result_val
FROM
(SELECT t1.sgnl_id, t2.smpl_dte, t1.pv_id,
MAX(t2.integ_since_val) AS max_val
FROM diag.blm_acct t2, diag.pv_sgnl_id_assc t1
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND t1.pv_id = t2.pv_id
AND t2.pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY t1.sgnl_id, t2.smpl_dte, t1.pv_id
) max_query ,
(SELECT pv_id,
MAX(integ_since_val) AS min_val
FROM diag.blm_acct
WHERE smpl_dte = TO_DATE ('11/10/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY pv_id
) min_query WHERE max_query.pv_id = min_query.pv_id
ORDER BY max_query.sgnl_idThe data set in the table is quite large, but the above query returns only 49 results (one for each signal in 'Series5').
I tried the following statement by itself to get the last value, but it takes quite a long time to execute (increased the overall query time from 1 sec to 400+ sec when used in the query above):
SELECT DISTINCT trunc(smpl_dte) as the_day,
first_value(integ_since_val) over (partition by trunc(smpl_dte) order by smpl_dte desc) as last_val_per_day
FROM diag.blm_acct WHERE pv_id = 3 and trunc(smpl_dte) = to_date('05/18/2008', 'MM-DD-YYYY ')Any thoughts?Well here is an example of the output I'm trying to generate:
SGNL RESULT_VAL
CCL_Diag:BLM00:Slow60PulsesTotalLoss 52.843439255
CCL_Diag:BLM101:Slow60PulsesTotalLoss 55.7883452511etc...
Here is the table structure:
describe diag.blm_acct;
Name Null Type
BLM_ACCT_ID NOT NULL NUMBER(12)
PV_ID NOT NULL NUMBER(38)
SMPL_DTE NOT NULL DATE
INTEG_OVER_VAL BINARY_DOUBLE()
INTEG_SINCE_VAL BINARY_DOUBLE()
INTEG_TYPE_ID NUMBER(3)
describe diag.PV_SGNL_ID_ASSC
Name Null Type
PV_ID NOT NULL NUMBER(38)
SGNL_ID NOT NULL VARCHAR2(75)
describe diag.SERIES_SGNL_REC_ASGN
Name Null Type
SERIES_ID NOT NULL VARCHAR2(50)
SGNL_ID NOT NULL VARCHAR2(75)
DISP_ORD_NBR NUMBER The main problem I'm having is how to replace this line of code:
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')with something that will get the last value (integ_since_val) in the diag.blm_acct table for the 11/15 date.
Edited by: Solerous on Feb 18, 2009 11:32 AM - I figured out how to output the table data -
Sql query - Selecting last recorded values for each date in specified period
Hello,
Can someone please help me with my problem.
I'm trying to get last recorded balance for each day for specific box (1 or 2) in specified period of days from ms access database using ADOTool.
I'm trying to get that information with SQL query but so far unsuccessfully...
My table looks like this:
Table name: TestTable
Date Time Location Box Balance
20.10.2014. 06:00:00 1 1 345
20.10.2014. 12:00:00 1 1 7356
20.10.2014. 18:45:00 1 1 5678
20.10.2014. 23:54:00 1 1 9845
20.10.2014. 06:00:02 1 2 35
20.10.2014. 12:00:04 1 2 756
20.10.2014. 18:45:06 1 2 578
20.10.2014. 23:54:10 1 2 845
21.10.2014. 06:00:00 1 1 34
21.10.2014. 12:05:03 1 1 5789
21.10.2014. 15:00:34 1 1 1237
21.10.2014. 06:00:00 1 2 374
21.10.2014. 12:05:03 1 2 54789
21.10.2014. 15:00:34 1 2 13237
22.10.2014. 06:00:00 1 1 8562
22.10.2014. 10:00:00 1 1 1234
22.10.2014. 17:03:45 1 1 3415
22.10.2014. 22:00:00 1 1 6742
22.10.2014. 06:00:05 1 2 562
22.10.2014. 10:00:16 1 2 123
22.10.2014. 17:03:50 1 2 415
22.10.2014. 22:00:10 1 2 642
23.10.2014. 06:00:00 1 1 9876
23.10.2014. 09:13:00 1 1 223
23.10.2014. 13:50:17 1 1 7768
23.10.2014. 19:47:40 1 1 3456
23.10.2014. 21:30:00 1 1 789
23.10.2014. 23:57:12 1 1 25
23.10.2014. 06:00:07 1 2 976
23.10.2014. 09:13:45 1 2 223
23.10.2014. 13:50:40 1 2 78
23.10.2014. 19:47:55 1 2 346
23.10.2014. 21:30:03 1 2 89
23.10.2014. 23:57:18 1 2 25
24.10.2014. 06:00:55 1 1 346
24.10.2014. 12:30:22 1 1 8329
24.10.2014. 23:50:19 1 1 2225
24.10.2014. 06:01:00 1 2 3546
24.10.2014. 12:30:26 1 2 89
24.10.2014. 23:51:10 1 2 25
Let's say the period is 21.10.2014. - 23.10.2014. and I want to get last recorded balance for box 1. for each day. The result should look like this:
Date Time Location Box Balance
21.10.2014. 15:00:34 1 1 1237
22.10.2014. 22:00:00 1 1 6742
23.10.2014. 23:57:12 1 1 25
So far I've managed to write a query that gives me balance for ONLY ONE date (date with highest time in whole table), but I need balance for EVERY date in specific period.
My incorrect code (didn't manage to implement "BETWEEN" for dates...):
SELECT TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM TestTable
WHERE Time=(SELECT MAX(Time)
FROM TestTable
WHERE Location=1 AND Box=1 );
Tnx!
Solved!
Go to Solution.For loop
following query keep day (here 24 in below query) Variable from ( 1 to 28-29/30/31 as per month)
SELECT TOP 1 TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM Test Table.
WHERE Time=(SELECT MAX(Time) FROM TestTable WHERE Location=1 AND Box=1 )
AND DATE = "2014-10-24";
PBP (CLAD)
Labview 6.1 - 2014
KUDOS ARE WELCOMED.
If your problem get solved then mark as solution. -
Price change report for a given date range in inforecords
hi,
Can any body suggest how we can get price changes in inforecords for given date range. is there any standard sap tcode or fuction module.Hi,
If you are referring to the changes in the condition record (for eg. for PR00), then you may go through the foll path:
Execute VK13 for any condition type - once inside the detail screen, from the menu path, choose Environment -> Changes -> change report. This will take you to a new selection screen where you can define the period you want to see the change record as well as the condition type for which you want to track the changes. Beware, this is a complex report for SAP and it will take definitely longer time to complete. So, it is better to specify short time periods and specific condition types and execute this in background.
Hope, this helps!
S. Siva -
Need to create a report to show values for a particular date range
I have to create a report, out of which I need two columns : << Customer Value Variance and Churn Score Variance >> to show values only for a custom date range, which will be entered via a dashboard prompt.
These generic date columns are not present and cannot be added. I have to make use of Pres variables
What I have currently done is:
1) Created a prompt with 2 different date columns and passing those values into variables vStartDate and vEndDate. (I don't actually need those 2 column which I have selelcted, but I have taken those so that I can prompt the values in calendar format and pass onto the variables)
2) Created report with necessary columns, with 2 extra columns (hidden) as vStart Date Column and vEnd Date Column which take the values from the presentation variables defined in the prompt. I have created these columns as then I can reference these in the two required columns if necessary.
I am already facing error in report after doing this and I am confused how to proceed. Any suggestions?
Thanks.Yes, but it only has one generic Date column, no start date and end date. I can't use that twice in the prompt. Although I can specify it to be 'between', but I'm not sure I can pass values to both variables like that.
Currently I have used Campaign Start Date and Campaign End Date to enter values in calender format to the variables. -
How to get XLR to show BPs with no transaction data for a given date range
Hi -
I am building an XLR report that does a comparison of net sales data across two periods for a given sales employee's BPs.
The report has the row expansion:
FACT BPA(*) SLP(SlpName = "ASalesPersonNameHere") ARDT(Code = "ARCreditMemo", "Invoice") Group by BPA.CardName
and column expansions:
FIG(SO_TaxDate = @StartDate:@EndDate)
and
FIG(SO_TaxDate = @StartDate2:@EndDate2)
where @StartDate, @EndDate, @StartDate2, @EndDate2 are parameters that define the two ranges of dates.
The column formulas are, from left to right:
=ixDimGet("BPA", "CardName")
=ixGet("SO_DocTotal") <-- filtered by column expansion for first date range
=ixGet("SO_DocTotal") <-- filtered by column expansion for second date range
The report works fine except for one problem, I would like it to include BPs for which no transaction occurred in either date range as well.
Any help is greatly appreciated!
Thanks,
Lang RileyReally appreciate your feedback! Those are good suggestions. I should have mentioned that I had already tried both those suggestions.
Removing FACT on BPA in this case ends up returning all the BPs and not respecting the SLP(SlpName = "aName") part of the query.
Using **, i.e., * or #NULL, makes no change in the resulting data in this case. I had thought that ** would be the solution, but it didn't change the outcome. I still have BPs for which when their sales employee is used as the filter and they have no transactions for either date range, and yet they still do not appear.
I should further mention that the IXL query, as it now stands, does return BPs for which one of the periods has no data, just not both, and I have verified that applicable BPs with no transaction data for both periods do exist in my data set. It seems that perhaps the IXL query needs to be restructured? Please keep the suggestions coming including how this query might be restructured if necessary. -
How to Search BPM Processes for a Given Date Range through a VC Report
Hi All,
We have a VC component build to view the BPM process information. Here we are supposed to provide a Date range option for searching the processes. But the Range search is not working.
I tried in below ways.
1. On Action Submit, I set the Occurance_D value as "=DSTR(@DATE_FROM,"M/D/YY")&" - "&DSTR(DADD(@DATE_TO,1,"D"),"M/D/YY")" it is working only if there are processes existing either on DATE_FROM or on DATE_TO, otherwise its not working.
Like, I have 5 processes triggered on Sep-5-2011, then if i give the Date Range as 9/5/11 - 9/11/11 or 9/1/11 - 9/5/11 it is working. But if I give 9/1/11 - 9/11/11 it is not working.
I tried this way as well.
=DSTR(@DATE_FROM,"M/D/YY")&" : "&DSTR(DADD(@DATE_TO,1,"D"),"M/D/YY") . Even this is not working.
Can some one please help.
Regards,
SrinivaSDear SrinivaS,
The main things you need to consider are:
- store your date value from the UI in a store
- the store gets used to submit a filter string in format (MM/DD/YY) to
BI_START_TIME_D.
If you follow http://help.sap.com/saphelp_nw72/helpdata/en/81/541300d147
41b39057c8ab3be61f7a/frameset.htm
you find that the process data source can be filtered in format "9/9/11
- 9/12/11" for field BI_START_TIME_D and BI_END_TIME_D.
The trick is now at submission time to concatenate the strings
accordingly and submit to BI_START_TIME_D. Use the following dynamic
expression
=DSTR(store@START_DATE_FROM,"MM/DD/YY")&" - "
&DSTR(store@START_DATE_TO,"MM/DD/YY")
to format the string during submission. I was able to verify this on my
machine. I hope that also your locale settings work with this
implementation.
Find attached a link to a small sample application [(test_date.zip) |please find attached a small sample application (test_date.zip) which]which shows you the proper usage of a date picker in conjunction with the
process data source. Please import the zip file into VC and deploy it.
Best regards,
Ralf. -
Accounts without opportunities for a given date range
Greetings report gurus,
I am trying to develop a report that shows distinct account names that do not have any opportunities for a given period of interest. For example, I have one report that queries opportunities that closed during a given period of interest for a specific class of accounts. I would also like to be able to report on accounts associated with that specific class that did not have any opportunities on the board for a given time frame.
Many thanks for your ideas,
DanDan,
You'd need to look at negative reporting for this, you can find it in the Knowledge Base. You need to write 1 report with the Accounts within your range minus Accounts with optys within your range.
cheers
Alex -
How to store beyond the range value for a given data type!!!
Hi all,
I want to know.Is it possible to create a new data type like int,float in java. which can store any number without any range restrictions.As you know the range of byte data type is -128 - + 127.I don't want any range restrictions.The data type should be able to grow dynamically.
Regards!!
Tameshwar SahuThe only solution I can think of is to use java objects, Im not sure youll be able to create a new primitive for java !!
Youd have to put together Integers, posibly in a vector depending on how HUGE a number youd like to create.
If you reached the max of one, add another to the vector. and then continue with the next.. The problem with this of course is the fact that math operations, will be a bit of a challenge to code. also actuall representation of the value would be a bit tricky as well !! There are however ways to go about this, you just have to think about it a little. -
Get Months for the given date ranges on the Selection Screen
Hello All,
If I give Begin Date (Begda) and End Date (Endda) on the Selection Screen, I need to get all the months given in the selection screen ranges.
Could any one please suggest me how to proceed further on this.
Thanks in Advance
Regards
YathishHI,
Check this FM
HR_99S_INTERVAL_BETWEEN_DATES ---> this can help you it will return the month in this table MONTH_TAB
HR_99S_MONTHS_BETWEEN_DATES -
Fetching Employee List For A WBS For A Given Date Range
Hello Friends,
I need to fetch list of employees assigned for the WBS for a particular month . The Transaction code is PPSM . Is there any standard report available. Otherwise any other way.
Regards,
Rohini.K.The standard report behind the t-code PPSM is RHSTRPF0.
You may like to copy this report into a custom Z program using t-code SE38 and modify it according to your requirements with the help of an ABAP'er. -
How to calculate a week & Month in given date range (not for sele-options)
Hi ,
I have defined 2 date parameters in sel-screen (Plz remember that date variable are not a SELECT-OPTIONS). Now i want ot display week nos & monts in output.
Ex: date1: 20080101 & date2: 20080229. then
weeks : 1, 2, 3,---9.
months: jan-08, feb-08.
Plz help me with block of code or any FM.
Regards,Hi Srikanth,
The FM HR_99S_INTERVAL_BETWEEN_DATES is doesn't existing, but there is a fm HR_MX_INTERVAL_BETWEEN_DATES but it returns no of Years & Days.
But i found some FM which r returns no of months for given date range. but my requirement is, want to display the month no bw 1 to 12. (ex: dat1=15-03-2008 & dat2= 01-06-2008 then in month fields 03,04,05 & 06. ).
Plz help me on this.
-Regards. -
Get table partition name dynamically for given date range
Dear All,
Could you please tell me how to get the partition name dynamicaly for given date range ?
Thank you.SQL> select table_name,
partition_name,
to_date (
trim (
'''' from regexp_substr (
extractvalue (
dbms_xmlgen.
getxmltype (
'select high_value from all_tab_partitions where table_name='''
|| table_name
|| ''' and table_owner = '''
|| table_owner
|| ''' and partition_name = '''
|| partition_name
|| ''''),
'//text()'),
'syyyy-mm-dd hh24:mi:ss')
high_value_in_date_format
from all_tab_partitions
where table_name = 'SALES' and table_owner = 'SH'
TABLE_NAME PARTITION_NAME HIGH_VALUE_IN_DATE_FORMAT
SALES SALES_1995 01-JAN-96
SALES SALES_1996 01-JAN-97
SALES SALES_H1_1997 01-JUL-97
SALES SALES_H2_1997 01-JAN-98
SALES SALES_Q1_1998 01-APR-98
SALES SALES_Q2_1998 01-JUL-98
SALES SALES_Q3_1998 01-OKT-98
SALES SALES_Q4_1998 01-JAN-99
SALES SALES_Q1_1999 01-APR-99
SALES SALES_Q2_1999 01-JUL-99
SALES SALES_Q3_1999 01-OKT-99
SALES SALES_Q4_1999 01-JAN-00
SALES SALES_Q1_2000 01-APR-00
SALES SALES_Q2_2000 01-JUL-00
SALES SALES_Q3_2000 01-OKT-00
SALES SALES_Q4_2000 01-JAN-01
SALES SALES_Q1_2001 01-APR-01
SALES SALES_Q2_2001 01-JUL-01
SALES SALES_Q3_2001 01-OKT-01
SALES SALES_Q4_2001 01-JAN-02
SALES SALES_Q1_2002 01-APR-02
SALES SALES_Q2_2002 01-JUL-02
SALES SALES_Q3_2002 01-OKT-02
SALES SALES_Q4_2002 01-JAN-03
SALES SALES_Q1_2003 01-APR-03
SALES SALES_Q2_2003 01-JUL-03
SALES SALES_Q3_2003 01-OKT-03
SALES SALES_Q4_2003 01-JAN-04
28 rows selected.
Maybe you are looking for
-
What do I have to do in creating a Keynote presentation on my MAC so that when I send it to my iPad, I don't have to re-do the presentation all over again as the fonts have changed, sizing has changed and everything is basically a mess? I have downlo
-
Loans Mgt: per maturity different GL account needed
Hello What is the technical solution (customizing) for the following requirement? For loans with a term / maturity < 1 year (field in the master data of the CML loan) the GL account for the asset/liability (depending on loan given/taken) is 1111 "Sho
-
is there a way to slow down scrolling credits in imovie 09 to make them easier to read? I have only had experience adjusting the speed of video clips...
-
ODBC drivers ver 7.33 or greater
Where can I find ODBC drivers ver7.33 or greater and corresponding SQL*Net libraries to download. Thank you, John.
-
Aperture and/or RAW files on a iPad?
I use Aperture as my primary photo editng program, and do the editing on my MacPro. While traveling, as a backup to my memory cards, I have been importing the RAW files from my Nikon DSLR into Aperture on my laptop (MacBook). When I get home I then