Reference date of last data load in query
Is it possible to referece the date of the data load in a query via user exit / formula variable or some other way?
We have a requirement to display data in a query based on when the data was last loaded. If the data load has not occured this month, then only records from the previous month should come into the result set.
Has anyone ever done anything like this? Or can you think of a way using SY-DATUM in the update rules that would allow you to segment data on the front end?
Thanks!
Adam
Defenitely there would be a better way.
For short term you can use a date filed in cube which is filled using your update rule as sy-datum.
Later you can fiter out while running the query
try using the Infopackage load tables.
if 2004s, try using any of RSDDSTAT*
Mey
Similar Messages
-
First date and last date of current year
Hi
how can i get first and last date of current year, thanks for your helphi,
use FM......... FIRST_AND_LAST_DAY_IN_YEAR_GET
DATA: first LIKE sy-datum,
last LIKE sy-datum.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
i_gjahr = '2007'
i_periv = '24'
IMPORTING
e_first_day = first
e_last_day = last.
WRITE: / 'First Date', first, ' Last Date', last.
Regards
CNU -
Terms of Payment to determine due date as last date of the month
Hi Experts,
Does any one know how to configure a Terms of Payment to determine due date as last date of the month ?
I tried by puting fixed date as 31 in the Terms of Payment in FI but when I am creating in FI-CA it gives me an error "_Term of payment Z003 is inconsistent/not planned_"
Please advice.
Thanks & Regards
SatyajeetHi Satyajeet,
It seems the settings that you have maintained in FI are correct.
When you are assigning the payment terms in FI-CA, you need to assign a factory calendar as well to the payment terms in the following config-
IMG->Financial Accounting ->Contract Accounts Receivable and Payable->Postings and Documents->Document->Maintain Payment Terms
If you have already assigned the factory calendar and still the problem persists, can you give the message ID and the message number of the error that you are getting?
Thanks,
Amlan -
Hi
I am working on BI 7.0 IP.
We have a requirement wherein the users, after entering the data in plan mode and saving, should be able to view the data immediately through reports.
In BW 3.5, with the "last request" variable in Request id, all the requests in yellow (where the status is not ok, which is the case for BPS data till 50000 records are accumulated) are shown, including the previous green requests.
In 7.0, by choosing the same variable, I am able to get only the plan data and all the previous records are not coming up. If I do not include the same, I am not getting the latest planned data.
Does anybody come across this issue ?
Any suggestions ?
Thanks
ShyamHi Pierre
Thanks for the response. I have also got another from Peter Jones, which is through the variables...reproducing below..
just tried the same scenario with infopackage variables - Most Current Data (0S_RQMRC) and also with the variable - most current data (transactional infocube) - (0S_RQTRA) and they both are working fine. both show the lastest data and the data that is in the 'yellow' request id and the 'green' requests. will look for additional details...Pete
Cheers
Shyam -
Expression - First date and last date of current month, current year
Hi
I need to have 2 ssrs expression as I can use as default parameters in my report where I can - out from my Time dimension, get the
first date of the current, current year - and one where I get last date, current month, current year.
My data source is a SSAS cube and my timedimension is structured like this:
[Time].[Days].&[2009-01-16T00:00:00]
Any suggestions how to solve this ?Hi ,
You can use below in Default Values in ssrs ;
for first Day of current month and year
="[Time].[Days].&[" +Format(dateadd("m",0,dateserial(year(Today),month(Today),1)), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-01T00:00:00]
For last day of current month and year
="[Time].[Days].&[" +Format(DateSerial(Year(Now()), Month(Now()), "1").AddMonths(1).AddDays(-1), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-30T00:00:00]
Please correct me if I misunderstood your requirement.
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. -
How to calculate start date and last date for current week
Dear All.
i want to calculate the start of the current week as well as the last date of the current week, our week start from Saturday and ends of Friday i.e. Saturday is the first day of the week and Friday is the last day of the week.
How can i acheive this in universe Designer?.
Please help...Hi
the formulas in webi will be as follows
for startdate
=RelativeDate(LastDayOfWeek(CurrentDate());-8)
for enddate:
=RelativeDate(LastDayOfWeek(CurrentDate());-2)
Regards,
Ranganath -
i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
is it possible using MDX...Hi Shashi,
According to your description, you want to return the last day for each month except current month, right?
In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
with member [measures].[a]
as
ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
select {[measures].[a]} on 0,
[Date].[Calendar].[Month].members on 1
from
[Adventure Works]
And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
Regards,
Charlie Liao
TechNet Community Support -
Looking for a query to find first/last dates in overlapping dates...
Hi,
I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
I have a subscription table which has for each Customer start and end date for different subscriptions.
I want to know the different ranges of date where there is subscriptions active.
so if the table has this:
CustID, Start date, end date
1, 2008-01-01, 2012-06-06
1 ,2009-01-01, 2011-01-01
1, 2011-01-01, 2013-02-02
1, 2013-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
I want to produce this result:
custid, range start, range end
1, 2008-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
the first row is the range identified from the 4 rows in my subscription table.
thanks :)I think I found it...
http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
let me try this method
Hi,
m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
Please also feel free to unmark the issue, with any new findings or concerns you may have.
Thanks,
Sofiya Li
If you have any feedback on our support, please click here.
Sofiya Li
TechNet Community Support -
Variable last date of previous month/last date of current month
Hello Experts,
I am facing an issue while designing a query.
Requirement is like this.
Report will be run on monthly basis.so on execution of report, it should prompt for month/year.
now on report there are two columns for which I have to get data on date basis(last date of previous month and Last date of current month).
Can anyone tell me is there any standard variable for this? what is it?
or how to achieve this?
Regards,
NiravHi,
See if this post in this forum can help you.
Re: Last date of a month
Regards
Shalabh Jain -
How to get month last date and first date without FM's
Hi Guru's,
How can we get month's first date and last date based on the date given in selection screen without FM's?Is it possible ?
Like if i give 05-Oct-2008 in the selection screen, i should get the output as 01-Oct-2008 to 31-Oct-2008.Without FM's???
Regards
Rakesh.Hi Rakesh,
You can implement this logic as follows:
You can have two internal tables, one containing the days as numbered 31, 28, 31, and so on with the month number. This holds good if the year is a common year. Another internal table contains days as numbered 31, 29, 31 and so on with the month number. This year would be a leap year.
An year can be calculated depending on the conditions:
Say date is given as 20081008
Concatenate 20081001 + 0(4) into l_date.
Divide l_date by 4 and remainder should be equal to 0.
Divide l_date by 400 and remainder should also be equal to 0.
Then the dominical year will be a leap year.
Now, if l_date divided by 100 and the remainder is 0 then the year is a common year.
So depending on this populate the first date and last date from the respective internal table
Regards,
Sumalatha N. -
How to find last date of the current year
Hi
Please tell me is there any function module to find out the last date of the current year.Hi,
You can do that very simply like so.
code
report zrich_0001.
data: first type sy-datum.
data: last type sy-datum.
first = sy-datum.
first+4(4) = '0101'.
last = sy-datum.
last+4(4) = '1231'.
write:/ first, last.
[/code]
OR use function modules
1.use this function module HR_GB_TAX_YEAR_DATES
Pass these values
P08_TXYEAR = Year
P08_PAYROLL_AREA = '01'
2.use FM......... FIRST_AND_LAST_DAY_IN_YEAR_GET
DATA: first LIKE sy-datum,
last LIKE sy-datum.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
i_gjahr = '2007'
i_periv = '24'
IMPORTING
e_first_day = first
e_last_day = last.
WRITE: / 'First Date', first, ' Last Date', last.
Regards,
Raj. -
Data fetching comparing dates.
there are 2 fields in the table
Beginging and End date
for every employee there r two or more rows.
In my selection screen i m selecting month and year.i want to fetch only that row for a employee which comes in date range.
for example
selection screen
month 05
year 2009
beg end
04/2008 09/2008
10/2008 09/2009
so it shud select the second row.
thanks.
Edited by: aks on Aug 6, 2009 5:25 AMHi Friend ,
**************************if it is a date***********************
1. Using that month and year get the first date and last date of the month .
2. Create range field for date .
3. Populate the begi date in low value and ending date in high value.
4. In you select query
select <fields>
from <table>
into <itab>
where beg <= rang_date-low and
end >= rang_date-high.
********************************if it is a period ********************************************************
1. Concatenate the month and year .
2. select query
select <fields>
from <table>
into <itab>
where beg <= Period and
end >= period .
thanks, -
How to create a report in bex based on last data loaded in cube?
I have to create a query with predefined filter based upon "Latest SAP date" i.e. user only want to see the very latest situation from the last load. The report should only show the latest inventory stock situation from the last load. As I'm new to Bex not able to find the way how to achieve this. Is there any time characteristic which hold the last update date of a cube? Please help and suggest how to achieve the same.
Thanks in advance.Hi Rajesh.
Thnx fr ur suggestion.
My requirement is little different. I build the query based upon a multiprovider. And I want to see the latest record in the report based upon only the latest date(not sys date) when data load to the cube last. This date (when the cube last loaded with the data) is not populating from any data source. I guess I have to add "0TCT_VC11" cube to my multiprovider to fetch the date when my cube is last loaded with data. Please correct me if I'm wrong.
Thanx in advance. -
Query to find the difference between the last date and the second to the last date
Hi all,
Hope all is well.
I am working on the following problem because I am trying to improve my MS SQL skills. But I am stuck at the moment and I wonder if you could provide some assistance please. Here is the issue:
Table 1: Dividends
divId
ExDate
RecordDate
PayDate
Amount
Yield
symId
1
2013-02-19
2013-02-21
2013-03-14
0.23
0.00000
3930
2
2012-11-13
2012-11-15
2012-12-13
0.23
0.00849
3930
3
2012-08-14
2012-08-16
2012-09-13
0.20
0.00664
3930
4
2012-05-15
2012-05-17
2012-06-14
0.20
0.00662
3930
5
2012-02-14
2012-02-16
2012-03-08
0.20
0.00661
3930
6
2011-11-15
2011-11-17
2011-12-08
0.20
0.00748
3930
7
2011-08-16
2011-08-18
2011-09-08
0.16
0.00631
3930
8
2011-05-17
2011-05-19
2011-06-09
0.16
0.00653
3930
9
2011-02-15
2011-02-17
2011-03-10
0.16
0.00594
3930
10
2010-11-16
2010-11-18
2010-12-09
0.16
0.00620
3930
11
2010-08-17
2010-08-19
2010-09-09
0.13
0.00526
3930
12
2010-05-18
2010-05-20
2010-06-10
0.13
0.00455
3930
13
2010-02-16
2010-02-18
2010-03-11
0.13
0.00459
3930
Table 2: Tickers
symId
Symbol
Name
Sector
Industry
1
A
Agilent Technologies Inc.
Technology
Scientific & Technical Instruments
2
AA
Alcoa, Inc.
Basic Materials
Aluminum
3
AACC
Asset Acceptance Capital Corp.
Financial
Credit Services
4
AADR
WCM/BNY Mellon Focused Growth ADR ETF
Financial
Exchange Traded Fund
5
AAIT
iShares MSCI AC Asia Information Tech
Financial
Exchange Traded Fund
6
AAME
Atlantic American Corp.
Financial
Life Insurance
7
AAN
Aaron's, Inc.
Services
Rental & Leasing Services
8
AAON
AAON Inc.
Industrial Goods
General Building Materials
9
AAP
Advance Auto Parts Inc.
Services
Auto Parts Stores
10
AAPL
Apple Inc.
Technology
Personal Computers
11
AAT
American Assets Trust, Inc.
Financial
REIT - Office
12
AAU
Almaden Minerals Ltd.
Basic Materials
Industrial Metals & Minerals
I am trying to check the last date (i.e. max date) and also check the penultimate date (i.e. the second to the last date). And then find the difference between the two (i.e. last date minus penultimate
date).
I would like to do that for each of the companies listed in Table 2: Tickers. I am able to do it for just one company (MSFT) using the queries below:
SELECT
[First] = MIN(ExDate),
[Last] = MAX(ExDate),
[Diff] = DATEDIFF(DAY, MIN(ExDate), MAX(ExDate))
FROM (
SELECT TOP 2 Dividends.ExDate
FROM Dividends, Tickers
WHERE Dividends.symId=Tickers.symId
AND Tickers.Symbol='MSFT'
ORDER BY ExDate DESC
) AS X
Outputs the following result:
First
Last
Diff
2012-11-13
2013-02-19
98
But what I would like instead is to be able to output something like this:
Symbol
First
Last
Diff
MSFT
2012-11-13
2013-02-19
98
AAN
2012-11-13
2012-12-14
1
X
2012-11-13
2012-12-14
1
Can anyone please let me know what do I need to add on my query in order to achieve the desired output?
Any help would be greatly appreciated.
Thanks in advance.Could you try this?
create table Ticker (SymbolId int identity primary key, Symbol varchar(4))
insert into Ticker (Symbol) values ('MSFT'), ('ORCL'), ('GOOG')
create table Dividend (DividendId int identity, SymbolId int constraint FK_Dividend foreign key references Ticker(SymbolId), ExDate datetime, Amount decimal(18,4))
insert into Dividend (SymbolId, ExDate, Amount) values
(1, '2012-10-1', 10),
(1, '2012-10-3', 1),
(1, '2012-10-7', 7),
(1, '2012-10-12', 2),
(1, '2012-10-23', 8),
(1, '2012-10-30', 5),
(2, '2012-10-1', 10),
(2, '2012-10-6', 1),
(2, '2012-10-29', 7),
(3, '2012-10-1', 22),
(3, '2012-10-3', 21),
(3, '2012-10-7', 3),
(3, '2012-10-12', 9)
WITH cte
AS (SELECT t.Symbol,
d.ExDate,
d.Amount,
ROW_NUMBER()
OVER (
partition BY Symbol
ORDER BY ExDate DESC) AS rownum
FROM Ticker AS t
INNER JOIN Dividend AS d
ON t.SymbolId = d.SymbolId),
ctedate
AS (SELECT Symbol,
[1] AS maxdate,
[2] AS penultimatedate
FROM cte
PIVOT( MIN(ExDate)
FOR RowNum IN ([1],
[2]) ) AS pvtquery),
cteamount
AS (SELECT Symbol,
[1] AS maxdateamount,
[2] AS penultimatedateamount
FROM cte
PIVOT( MIN(Amount)
FOR RowNum IN ([1],
[2]) ) AS pvtquery)
SELECT d.Symbol,
MIN(MaxDate) AS maxdate,
MIN(penultimatedate) AS penultimatedate,
DATEDIFF(d, MIN(penultimatedate), MIN(MaxDate)) AS numberofdays,
MIN(MaxDateAmount) AS maxdateamount,
MIN(penultimatedateAmount) AS penultimatedateamount,
MIN(MaxDateAmount) - MIN(penultimatedateAmount) AS delta
FROM ctedate AS d
INNER JOIN cteamount AS a
ON d.Symbol = a.symbol
GROUP BY d.Symbol
ORDER BY d.Symbol
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers.
Thanks!
Aalam | Blog (http://aalamrangi.wordpress.com)
Maybe you are looking for
-
I need a phone number to speak with a human being.
Does anyone know how I can find a phone number to speak with a real live human being about a software purchase which I've paid for but can't download because they say I haven't provided proof that I'm a teacher (which I have already uploaded twice).
-
Hi All, How can I test a form created in PE51 as the test link there is inactive also is there any help available on working with HR forms apart from the sap help. Thanx in advance, Amit
-
How to put acents in pages app
How I can correct the acents in pages app for Macbook?
-
I'm having trouble removing the proxy from the patching setup. I'm using GC 10g R3. Every time I try to set it back to direct Internet connection, it gives me a Error: "Proxy Test resulted in Exception" when I click on the apply button. I need to rem
-
Printing Borderless and Multiple Pages per Sheet (PDF)
Anyway to do this? I have a thousand page pdf doc that I need to print out but want to maximize viewing area. Obviously individually cropping pages is out of the question.