Date Selection in BW Query
Hello -
I am trying to create a query that will show me the most recent cost estimate in BW infocubes 0COPC_C08 or 0COPC_C09, without making any changes to the standard functionality or available characteristics in these cubes. One of the cubes has available Calendar Day (0CALDAY) as a time characteristic, and the other has Fiscal Year (0FISCYEAR), Fiscal Year/Period (0FISCPER), and Posting Period (0FISCPER3).
Any of these would be fine to use, if I could tell it to pull the most recent cost estimate for each material. For example, material A was costed on 1/1/08, 4/1/08, and 5/1/08. Material B was costed on 1/1/08. If I run the query today, I want it to show me the most recent cost estimate for each material u2013 5/1/08 for material A, and 1/1/08 for material B.
Does anyone know if there is a way to limit the date selection in this manner?
Regards,
Sydnie
END date=FormatDate(ToDate(Right([DateD];Pos([DateD];";")+1);"MM/dd/yyyy hh:mm:ss A");"dd/MM/yyyy")
the above formula wont work when we enter 9/12/0214 or 9/2/2014
so use this formula
Substr([DateD];Pos([DateD];";")+1;Length([DateD]))
END date=FormatDate(ToDate(Substr([DateD];Pos([DateD];";")+1;Length([DateD]));"MM/dd/yyyy hh:mm:ss A");"dd/MM/yyyy")
the above formula is work fine
Similar Messages
-
Simple question about data selection in a query
Hi everybody,
I've got the requirement to change an existing query with the query designer. It be possible to display data (i.e. sales) just for the last 3 month (actual month minus 3). What is the best approach? A colleague advised me to do with a variable customer exit?!
Is this the best approach or is there an easier way?
Thanks!
Best regards,
DanielThanks for your answers.
Im pretty new to that query stuff
Well I wrote the following ABAP Code:
CASE i_vnam.
WHEN 'name'.
IF i_step = 1.
DATA: lv_date TYPE SY-DATUM.
lv_date = SY-DATUM.
lv_date+6(2) = '01'.
lv_date+4(2) = lv_date+4(2) - 3.
CLEAR l_s_range.
CONCATENATE lv_date(4) '0' lv_date+4(2) into l_s_range-low.
l_s_range-opt = 'GE'.
l_s_range-sign = 'I'.
APPEND l_s_range to e_t_range.
ENDIF.
ENDCASE.
But with your suggestion this coding is probably not necessary? -
Selecting values between 2 dates for an SQL query report region
I have a region where im selecting between 2 dates
select hp.NAME, hp.VALUE, hp.UPDATEDATE, hp.DESCRIPTION, hp.UPDATE_COMMENT, hp.HASH, hp.IDCATEGORY
from HIST_REPORT hr, HIST_PARAM hp
where hp.dbid = hr.dbid and hr.id = :P7_ID and hp.UPDATEDATE between :P7_BDATE and :P7_EDATE
The problem is that if I have a row thats dated today (april 1) and if I set the beginning date (BDATE) to april 1 as well as the ending date (EDATE), no rows show and I would like the april 1 row to show. How can I modify my query to fix this?and hp.UPDATEDATE between :P7_BDATE
and decode(:P7_EDATE,:P7_BDATE,:P7_EDATE+1,:P7_EDATE)This assumes, though, that the time component of your items is implicitly 00:00.
Joel -
Utility to export selected data from an SQL Query?
I would like to know if there is any utility available in Oracle that I could use to export data selected on the basis of a query? Our requirement is to export the selected data to .dat file.
This should be besides imp or exp built-in utilities available in Oracle.Hello,
you can spool the results of your query to file.
eks
spool c:\....
select * from emp;
spool off;
If you have a tool called Toad, you kan click on the results and then you can save the data in different format.
Regards
Kjersti -
SELECT records larger than date specified in sub query
Dear All
Thank you for your attention.
I would like to select records larger than date specified in sub query
query should be something like the following
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN order_no AND my_date > date (SELECT order_no, date FROM MySubQueryResult)
(it is incorrect)
Sub query result:
order_no | date
A1 | 2014-12-21 09:06:00
A2 | 2014-12-20 09:07:00
A3 | 2014-12-20 08:53:00
A4 | 2014-12-20 08:57:00
MYTB:
my_order_number | my_task | my_date
A1 | T1 | 2014-12-21 09:06:00
A1 | T2 | 2014-12-22 10:01:00
A2 | T1 | 2014-12-20 09:07:00
A3 | T2 | 2014-12-20 08:53:00
A3 | T4 | 2014-12-21 09:30:00
A3 | T8 | 2014-12-23 20:32:00
A4 | T6 | 2014-12-20 08:57:00
expected result:
my_order_number | my_task | my_date
A1 | T2 | 2014-12-22 10:01:00
A3 | T4 | 2014-12-21 09:30:00
A3 | T8 | 2014-12-23 20:32:00
Any ideas? Thanks.
swivanHi,
try this
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN (SELECT order_no FROM MySubQueryResult)
AND my_date > (SELECT date FROM MySubQueryResult)
Alternatively, you can also make use of joins to achieve the same.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page
Dear Praveen Dsa
Thanks for your reply, but order_no and date are paired and related, cannot separate.
each order have its own date, so it is not working
Best Regards
swivan -
Hi All,
I am getting error while executing one query in Bex.
the error message is SYST:Date 11.00.2008 not expected(after that I was thrown out of the system)
Date selection is handled by a variable on Fiscal Year / Period called Bespoke Fiscal Period . Not really sure how that variable works - and as far as I'm aware, selects the period by referencing the system date ie: if the system date is within January it will select December as the period (so the user always sees data for the previous completed month).
Made a couple of crude tests with pretty basic queries and I found that those using that variable fail, whereas typing in 012.2007, 001.2008 at run time will work. Any thoughts on why the variable stopped working ? Conflicts with the 2008 calendar maybe ?
Thanks in advance,
SupriyaHi Supriya,
Logically thinking ur requirement is to select the previous month as per the current system date. For that they may be hard coded like taking the current month number and subtracting one from that value. I mean to say as the current month is 01 and might be hard code says 01 minus 1 which will result in 00. This might be the reason for this. Find out the code and check it . if it is so change the code.
Fine if it helps.
Thanks
k -
Date selection in query : logic needed!
Hi,
we have one calendar day depending on which the query result is displayed!
Now the requirement is such that when user enters one date the query has to generate the result for the multiple date ranges including the one which he has entered.
example: if user has entered 15/9/2007 then query should not only display the result of the date 15/9/2007 but also the results of -5 to +2 ( means 10/9,11/9,12/9,13/9 and 14/9 plus 16/9 and 17/9 )
simlarly other ranges like -8 to + 7 and so on
How to define this in query?
Thanks,
RaviHello ,
I need to make a graph conveying the information of the deliveries by comparing the goods issue date and promised date !
report also requires how many deliveries were on time, how many were late and how many were early!
for this requirement, i had thought of making a date selection field which is promised date and make furthur more date ranges selections by query it self so that late deliveries and early deliveries also covered in these date ranges.
-5 to + 2 is that one range which is on time delivery range
if the delivery is more eally than the -5 days then it is early delivery. even in ealry delivery i want to make how early it is.
and suppose the delivery has crossed the promised date 2 days more then it is late delivery.
all has to be acheived by single date selection and there after the logic which takes care of all the date ranges i had explained.
i am looking for that logic which i am not finding
Hope this is clear now
Thanks,
Ravi -
Error while trying to retrieve data from BW BEx query
The following error is coming while trying to retrieve data from BW BEx query (on ODS) when the Characters are more than 50.
In BEx report there is a limitation but is it also a limitation in Webi report.
Is there any other solution for this scenario where it is possible to retrieve more than 50 Characters?
A database error occured. The database error text is: The MDX query SELECT { [Measures].[3OD1RJNV2ZXI7XOC4CY9VXLZI], [Measures].[3P71KBWTVNGY9JTZP9FTP6RZ4], [Measures].[3OEAEUW2WTYJRE2TOD6IOFJF4] } ON COLUMNS , NON EMPTY CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( CROSSJOIN( [ZHOST_ID2].[LEVEL01].MEMBERS, [ZHOST_ID3].[LEVEL01].MEMBERS ), [ZHOST_ID1].[LEVEL01].MEMBERS ), [ZREVENDDT__0CALDAY].[LEVEL01].MEMBERS ) ........................................................ failed to execute with the error Invalid MDX command with UNSUPPORTED: > 50 CHARACT.. (WIS 10901)Hi,
That warning / error message will be coming from the MDX interface on the BW server. It does not originate from BOBJ.
This question would be better asked to support component BW-BEX-OT-MDX
Similar discussion can be found using search: Limitation of Number of Objects used in Webi with SAP BW Universe as Source
Regards,
Henry -
Trouble in data selection logic
Hi All,
I am hitting 4 tables for selecting some data using inner join. There are three user
input fields which if filled, has to take part in data selection. These three input fields are independent of each other.
so while writing select query, how can i take care of all the possiblilities(none of them filled -- every one of them filled ) in the
most efficient way..?
Thanks
-pranatiHi,
IN the select-options you can add NO-EXTENSION NO INTERVALS..Which can be used a parameter..And you have to use IN in the select statement to filter the data..
Check this example
TABLES: marc.
<b>SELECT-OPTIONS: so_matnr FOR marc-matnr NO-EXTENSION NO INTERVALS.
SELECT-OPTIONS: so_werks FOR marc-werks NO-EXTENSION NO INTERVALS.</b>
DATA: t_marc TYPE STANDARD TABLE OF marc.
START-OF-SELECTION.
Get the first 100 rows.
SELECT mandt matnr werks UP TO 100 ROWS
INTO TABLE t_marc
FROM marc
<b> WHERE matnr IN so_matnr
AND werks IN so_werks</b>.
IF sy-subrc = 0.
WRITE: / 'RECORD COUNT - ', sy-dbcnt.
ELSE.
WRITE: / 'NO RECORD FOUND'.
ENDIF.
Thanks,
Naren -
Tricky dynamic date variant in ABAP query
Hello All,
In an abap query there is a date field in the selection screen with from & to values.
I am trying to create a dynamic variant that will fill the following data into those fields:
From date: will be left blank
To date: will show today's date - 90 days
For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:
From date: <blank>
To date: 01/09/2006
I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.
Any help will be very appreciated and points would be rewarded generously !
Thank you very much,
RonenIf the "from" date is meant to be left blank (beginning of time) and the "to" date is some date plus or minus number of days from today, you use the "current +/- days" dynamic date calculation format as was mentioned earlier. Likewise if the "from" date is some date plus or minus today's date, and the "to" date is infinity -- you only need the one Dynamic Date calculation.
To do this, first don't think about this as a date range, think of your Dynamic Date calculation as if this were a single parameter and not a select-option. You are really saying "my date is anything LT/LE this date" or "my date is anything GT/GE this date" -- not a range
In the Save Variant screen, find the desired date select-option and:
1. Choose in column "Selection Variable", a "D" (Dynamic date calculation)
2. Use F4 in the "Name of Variable" column
3. Find "Current date +/- ??? days" or "Current date +/- ??? work days" in the popup, as appropriate
4. For "I/E" (include/exclude) column select as appropriate
5. For "Option" column, choose "LE", "LT", "GE", "GT", "NE" as appropriate
6. After clicking green check mark, enter your plus or minus days (and factory calendar if using work days).
7. Finish saving your variant.
8. You may not see your changes in your variant until you back all the way out of the variant and then redisplay it. You'll see a greyed out date along with the symbol matching your choice (LT, LE, etc.)
Unfortunately if you don't have infinity on either end of the date you are limited to 999 days differences as far as I am aware. If that is the case you can populate TVARVC table with parameter or selection variables, maintain them with STVARV transaction by hand, or use an ABAP program in batch to regularly calculate the values. Then you can reference the TVARVC values in your variant instead of the Dynamic Date calculation.
If someone knows a way to bypass the use of TVARVC for date ranges that are more than 999 days apart please let me know. TVARVC works well but it is extra effort whereas Dynamic Date calculation would be much easier to maintain if the date range could be made larger than 999 days. -
Populate select list when a date selected from date picker in tabular form
Hi Guys,
I have a situation where user picks a date from a date picker in tabular form.
So as soon as he picks a date say 05/31/2011 from the date picker I want to populate a select list with 2 values : Tuesday AM , Tuesday PM.
I have gone through the forums a lot and figured we can write a Dynamic Action using JQuery Selector. But I am not sure how to figure out the day from a date picker.
I appreciate if some one can give your thoughts on how to proceed. It seems to be simple but looks like a tricky one. I am not familiar with writing Java Script.
Thanks ,
RajI was thinking your date selected from CALENDAR ended in a list_item.
I don't know I thinking that
well,
:master_block.itemdate is your text_item where calendar return date selected.
and then , following Gerd's step
Create a WHEN-MOUSE-DOUBLECLICK on the date-item of CALENDAR and write :
begin
:master_block.itemdate := calendar (.........);
go_block ('master-block');
execute_query;
end;
or set a global or parameter variable date selected from calendar :parameter. xxxxxx
in a PRE-QUERY
:master_block.itemdate := :parameter. xxxxxx
and
Create a WHEN-MOUSE-DOUBLECLICK on the date-item of CALENDAR and write :
begin
:parameter. xxxxxx := calendar( ....);
go_block ('master-block');
execute_query;
end;
regards -
Display select list from query on manual tabular form
Hello,
I'm trying to display a select list from query on a manual tabular form. I'm using a collection to store the data. I can't seem to get the query to work. I can display the item as a text item. Any help would be appreciated. Thanks, Elizabeth.
SELECT
-- Notice how I'm keeping the idx value the same as the column value in the collection. This helps to keep things organized
-- I also apply an id to each entry
-- I append the error value to the empname and sal
-- The Seq_id. Usefull when hiding rows (for delete) and then submitting from
apex_item.hidden(1,x.seq_id, null, x.seq_id || '_seq_id') ||
-- The Primary Key of the column
apex_item.hidden(2, x.ceah_people_id, null, x.seq_id || '_ceah_people_id') || x.ceah_people_id ceah_people_id,
-- Employee Name
case when x.seq_id = -1
then
apex_item.select_list_from_query (3,
NULL,
'select distinct language_name d, '
|| 'language_id r from foreign_language',
'style="width:170px" ' ,
'YES',
'0',
'- Select Language -',
'x.seq_id_' || LPAD (9900 + LEVEL, 4, '0'),
NULL,
'NO'
else
apex_item.text (3,(select language_name from foreign_language where x.language_id = foreign_language.language_id),
80,
100,
'style="width:170px" readonly="readonly"',
'f32_' || LPAD (ROWNUM, 4, '0')
end
|| err.language_id language_id,
/* apex_item.text(3,x.language_id,null, null, null, x.seq_id || '_language_id') || err.language_id language_id,
-- Employee Salary
apex_item.text(4,x.proficiency, null, null, null, x.seq_id || '_proficiency') || err.proficiency ||
-- Store the sql action type as well.
apex_item.hidden(50,x.sql_action_typ, null, x.seq_id || '_sql_action_typ_id') proficiency,
-- Last but not least the row error
err.row_error
FROM (SELECT ac.c001 seq_id,
ac.c002 ceah_people_id,
ac.c003 language_id,
ac.c004 proficiency,
ac.c049 modifiable_flag,
ac.c050 sql_action_typ
FROM apex_collections ac
WHERE ac.collection_name = 'DATA_COLLECTION'
ORDER BY ac.seq_id) x,
-- Error Collection
(SELECT ac.seq_id seq_id,
ac.c002 ceah_people_id,
ac.c003 language_id,
ac.c004 proficiency,
ac.c050 row_error -- Useful when individual data is correct, however the row of data is not. Ex: start/end dates
FROM apex_collections ac
WHERE ac.collection_name = 'ERROR_COLLECTION'
ORDER BY ac.seq_id) err
WHERE x.seq_id = err.seq_id(+)I got so frustrated I started over. I'm following the how to create a manual form.
http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html#MANUAL
The problem I'm now having is even though I display items as hidden, there is a column holder on the report for them. If I go into the report attributes and toggle the show attribute off I cannot reference an items value in my logic. I used / / for the column heading but I still get the little sort arrow where the column heading should be. I tried to toggle the sort attribute off but the sort arrow still shows up. How can I use the apex_item.hidden and not get a place holder for the column on a report? Thanks, Elizabeth
Here is the code I'm using to generate the report:
select x.ceah_people_lang_id,
x.language_id,
x.proficiency,
x.ceah_people_id
from (
select apex_item.hidden(1,ceah_people_lang_id) ceah_people_lang_id,
apex_item.select_list_from_query(2,language_id,'select language_name, language_id from foreign_language') language_id,
apex_item.select_list_from_query(3,proficiency,'select name, id from proficiency') proficiency,
apex_item.hidden(4,ceah_people_id) ceah_people_id
from ceah_people_language where ceah_people_language.ceah_people_id = :P152_person_id
union all
select apex_item.hidden(1,null) ceah_people_lang_id,
apex_item.select_list_from_query(2,null,'select language_name, language_id from foreign_language') language_id,
apex_item.select_list_from_query(3,null,'select name, id from proficiency') proficiency,
apex_item.hidden(4,null) ceah_people_id
from dual) x -
Can't find 0FYTLFP OLAP Variable in InfoPackage Data Selection tab on 3.5
On BW 3.5, when generating an InfoPackage with the datasource as Purchasing Data(80PUR_C01), under Data Selection tab, for the InfoObject 0FISCPER, I selected 7 (OLAP variables)for the Type column, then click the button next to it and under the column of Details for Type to bring up a window, but when expending the OLAP Variable field list, can't find the following value in the list which shows up on BW 3.1:
0FYTLFP 0FISCPER Cumulated to Last Fiscal Year/Period (SAP Exit)
How to make the above value show up in the OLAP Variable list? I thought maybe the variable 0FYTLFP needs to be installed in Business Contents, but there is no variable object type in Business Content. It sounds like a SAP Exit, but how to make the SAP Exit value show up on BW 3.5?
Thanks for everyone's input!hey Rohit,
Besides the three variable values in the list on BW 3.5, now I find a new one in the list, called "0E_ROLE 0SR_ROLE Role (SAP Exit)", I have no idea why this one shows up now. Now all the four variables in the list are:
1. 0CML12LM 0CALMONTH Last 12 Months Excluding the Current Month
2. 0CMONTH 0CALMONTH Current Calendar Month
3. 0E_ROLE 0SR_ROLE Role (SAP Exit)
4. 0S_RQMRC 0REQUID Most Current Data
0FYTLFP is still not in the list! We can't try to create BEx query since our BW 3.5 system is just installed and we have not got to the step to ceate a query. I try the 2nd way you suggested by pressing F6 on this variable with the typed in value 0FYTLFP, get the following msg "BEx variable 0FYTLFP could not be evaluated - No error message", that means it would not work on BEx query as well, right?
What could be the reason that we can't see 0FYTLFP variable in our new installed BW 3.5? Do you think our BASIS missed installing sth?
Thanks
Message was edited by: Kevin Smith -
How to store data from a complex query and only fresh hourly or daily?
We have a report which runs quite slow (1-2 minutes) because the query is quite complicate, so we would like to run this query daily only and store in a table so for those procedures that need to use this complex query as a subquery, can just join to this table directly to get results.
However, I am not sure what kind of object I should use to store data for this complex query. Is data in global temp table only persist within transaction? I need something that can persist the data and be access by procedures.
Any suggestions are welcome,
CheersThank you for your reply. I looked at the materialized view earlier on, but have some difficulties to use it. So I have some questions here:
1.The complex query is not a sum or aggregate functions, it just need to get data from different tables based on different conditions, in this case is it still appropriate to use meterialized view?
2.If it is, I created one, but how to use it in my procedure? From the articles I read, it seems I can't just query from this view directly. So do I need to keep the complex query in my procedure and how the procedure will use the meterialized view instead?
3. I also put the complex query in a normal view, then create a materialized view for this normal view (I expect the data from the complex query will be cache here), then in the procedure I just select * from my_NormalView, but it takes the same time to run even when I set the QUERY_REWRITE_ENABLED to true in the alter session. So I am not sure what else I need to do to make sure the procedure use the materialized view instead of the normal view. Can I query from the Materialized View directly?
Below in the code I copied from one of the article to create the materialized view based on my normal view:
CREATE MATERIALIZED VIEW HK3ControlDB.MW_RIRating
PCTFREE 5 PCTUSED 60
TABLESPACE "USERS"
STORAGE (INITIAL 50K NEXT 50K)
USING INDEX STORAGE (INITIAL 25K NEXT 25K)
REFRESH START WITH ROUND(SYSDATE + 1) + 11/24
NEXT NEXT_DAY(TRUNC(SYSDATE), 'MONDAY') + 15/24
enable query rewrite
AS SELECT * FROM HK3ControlDB.VW_RIRating;
Cheers -
Problem with 0FIGL_VC1 when use constant selection in the query
Please kindly help me. I have this problem for 2 weeks already.
When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly.
My report layout
Columns : key figures (including 0FIGL_VC1_CK001)
Rows: 0GLACCEXT (financial statement item) << as hierarchy
Initially, the query is processed correctly.
However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)
Please help!If I dont use constant selection in the query, data are display correctly.
But If I use constant selection in the query, some financial statement item dont display any value
Example :
Financial statement item(Display in hier) Period1 Total Period1(Constant selection)
A 10 60
B 20 60
C 30 60
D 0 60
- Financial statement item "D" has some value.
- Financial statement item "D" is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
Please help!!
Maybe you are looking for
-
A report on Purchase Info record.
hi, Is there a way i can get to know who create a Purchase Info record???
-
Payment block configuration..
Hi Experts Can u please tell me the configuration of Payment block and how it is used in SAP in different scenarios. Thanks in advance Moderator: Please, search before posting
-
IMac G4 - Black screen (but can faintly see)
I am having problems with my iMac screen. The computer works fine, it's just that you can barely see anything on the display. You need to take a light to it to see what you are doing. I looked everywhere online for something like this, and what I kee
-
Over the past two months the reliability of my broadband service seems to have degraded. It now seems to be dropping several times a day. Yesterday it dropped out no less than 6 times in a two hour period. Nothing has changed in the house and no ne
-
Why a pause 3 seconds into song?
Whenever i play a song in itunes, 3 seconds into the song, there will be a pause usually around 5 seconds before the song resumes playing. This happens with every song in my library. Ive downloaded the latest itunes and nothing seems to help. Any sol