Bex Query which uses Dynamic columns to display actuals
Hi Bex experts,
I have a query issue/question.
I currently have a Bex query which shows me the the planned values for each period, spanning 6 years into the future. My Key figure columns are defined as follows:
Value type = '020'
Version = mandatory variable, entered at execution.
Posting period (FISCPER3) = These columns are fixed values using periods 1 to 12 for each column.
Fiscal year (0FISCYEAR) = Each column contains SAP exit for current year, and using the offset +1, +2, +3, +4 etc, when I define the future years coulmns.
Currency = fixed 'USD'.
Fiscal year variant = fixed 'Z4'
The above works fine for plan data.
I want to now include is:
Seperate 'Dynamic columns' to show only actuals for period ranges from period one to the previous period (or current period minus 1). Each period should have it's own column for actuals.
The dynamic actuals columns should be grouped together to the left of the plan columns.
Actuals are only for current year, so I will still use the SAP EXIT for current year in the column definition.
Example: If I am currently in period 10, the query should show me actuals from period 1 to period 9 in seperate columns, then continue to show me my plan values columns that I have in place already.
How can I construct these actuals columns in to my existing query. If you have possible screens shots.
Thanks, and maximum points will be alotted.
The way I have approached this you may not like as it involves quite a bit of coding
12 CKFs
each CKF adds up 2 RKFs
So 24 RKFs
example Column 6 CKF
Adds Column 6 RKF Actual and Column 6 RKF Plan
Column 6 RKF Actual contains Actual version + key figure + Period variable column 6 Actual
Column 6 RKF Plan contains Plan version + key figure + Period Variable column 6 Plan
Period variable column 6 Actual
is a cmod variable which reads the entered date
if the period of entered date is LE 6
then return period 6 into "Period variable column 6 Actual"
else put 0 into "Period variable column 6 Actual"
Period variable column 6 Plan
is a cmod variable which reads the entered date
if the period of entered date is LE 6
then return period 0 into "Period variable column 6 Plan"
else put 6 into "Period variable column 6 Plan"
Now what happens is that if you enter period 6 in your selection screen all the Actuals of columns greater than 6 all have period 0 put into their selection so return 0 and all the columns less than or equal to 6 return the values for the fiscal period (ie column 1 gets period 1)
And in addition all the Plans columns return the value of their column ie for their period for those greater than 6 and for those less than 6 they all return 0
It's convulted - but you get the idea - and yes it works
There may be a better way to do it - and I am open to suggestions
(this does assume that NOTHING is posted to period 0 otherwise it won't work)
Similar Messages
-
Im getting an error when running a procedure that includes this code.
I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
DECLARE @retval AS DECIMAL(12,2)
DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
DECLARE @sqlcmd AS NVARCHAR(150)
DECLARE @paramdef NVARCHAR(150)
SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
--default
SET @retval = 0.0;
EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
SELECT @retval
DECLARE @return_value DECIMAL(12,2)
EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
@SpreadKey = 1,
@MonthNumber = 4
SELECT 'Return Value' = @return_value
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
the shoe size, the phone number or something else at run time of this entity.
In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point.
Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity.
Do you know that SQL is a declarative language? This family of languages does not use local variables!
Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.
Think about how silly this is:
SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental.
We need to see the DDL so we can re-write this mess. Want to fix it or not?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
BEx query based on virtual cube donu00B4t display a valid List of Value (LOV)
Hello
I have a problem with an invalid LOV. The scenario is the following; There´s a BEx query based on a virtual cube. The query has an exit variable on caracteristic that is based on 0CALMONTH.
At Universe Designer I simply create a connection, a universe based on this query and export.
At Web Intelligence (also at Live Office), when I try to execute de query, the prompt to fill my exit variable display a list of value that doesn´t match with the values of the caracteristic at the cube.
Actually, the list at the prompt starts with 01.0000 and finishes with 05.0968.
In Universe Designer, the option to edit the list of values is not available. But I think that editing the LOV is not the correct way.
I´ve tried creating a new query based on the DSO that is the source of the virtual cube. In this case, I had a valid list. Unfortunately, I can´t use this DSO.
Did anyone already have this problem?Hi James,
can you explain what you mean with "input length for that filed" ?
The field in the table is varchar2(120). I coudn't found options for the List of value.
Thanks for your response
Carsten
null -
Improving a simple select query, which uses all rows.
Hi All,
Please excuse me if the question is too silly. Below is my code
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.07
SQL> show parameter optim
NAME TYPE VALUE
object_cache_optimal_size integer 102400
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
plsql_optimize_level integer 2
SQL> explain plan for select SUM(decode(transaction_type,'D',txn_amount,0)) payments_reversals,
2 SUM(decode(transaction_type,'C',txn_amount,0)) payments,primary_card_no,statement_date
3 from credit_card_pymt_dtls group by primary_card_no,statement_date;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 2801218574
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1912K| 56M| | 21466 (3)| 00:04:18 |
| 1 | SORT GROUP BY | | 1912K| 56M| 161M| 21466 (3)| 00:04:18 |
| 2 | TABLE ACCESS FULL| CREDIT_CARD_PYMT_DTLS | 1912K| 56M| | 4863 (3)| 00:00:59 |
9 rows selected.
SQL> select index_name,index_type
2 from all_indexes
3 where table_name = 'CREDIT_CARD_PYMT_DTLS';
INDEX_NAME INDEX_TYPE
INDX_TRANTYPE BITMAP
INDX_PCARD NORMAL
INDX_PSTATEMENT_DATE NORMALThe query is using all the records in the CREDIT_CARD_PYMT_DTLS table. Transaction type will be either 'C' or 'D'.
CREDIT_CARD_PYMT_DTLS has 2 million rows and the qury will output 1.5 million rows. Table statisticas are upto date.
The query now is taking almost 5 minutes. Is thaere any way to reduce the time ?
Our DB server has 8 CPUs and 8 GB memory. Is the timing genuine ?
Thanks in Advance.
Edited by: user11115924 on Apr 29, 2009 2:43 AM
All the columns used in the query are already indexed. ( Ofcourse, not only for this query.)Hi All,
Thanks for the helps provided. Expecting it once more..
My actual query is as below
select primary_card_no,base_segment_number,atab.previous_balance,current_balance,intrest_amt_due_this_cycle,total_min_amt_due,total_credit_limit,
total_purchase_this_cycle,total_cash_trns_this_cycle,available_credit_limit,payments,utilization,payment_ratio,payments_reversals,cash_limit,
available_cash_limit, description
from
select primary_card_no,DECODE(base_segment_number,NULL,primary_card_no,base_segment_number) base_segment_number,
SUM(previous_balance) previous_balance,SUM(current_balance) current_balance ,SUM(intrest_amt_due_this_cycle) intrest_amt_due_this_cycle,
SUM(total_min_amt_due) total_min_amt_due,SUM(total_credit_limit_all) total_credit_limit,
SUM(total_purchase_this_cycle) total_purchase_this_cycle,SUM(total_cash_trns_this_cycle) total_cash_trns_this_cycle,
SUM(available_credit_limit) available_credit_limit,SUM(payments) payments,
(SUM(NVL(current_balance,0)) / SUM(total_credit_limit_all)) * 100 utilization,
(SUM(NVL(payments,0)) / DECODE(SUM(previous_balance),0,NULL,SUM(previous_balance))) * 100 payment_ratio,
SUM(payments_reversals) payments_reversals,SUM(cash_limit) cash_limit,SUM(available_cash_limit) available_cash_limit
from
( select a.*,NVL(payments_reversals,0)payments_reversals ,NVL(payments,0) payments
from
( select primary_card_no,previous_balance,current_balance,intrest_amt_due_this_cycle,total_min_amt_due,total_purchase_this_cycle,
total_cash_trns_this_cycle,statement_date,available_credit_limit,cash_limit,available_cash_limit,
(case when statement_date <= TO_DATE('301108','ddmmyy') then NULLIF(total_credit_limit,0)
else NULLIF((select credit_limit
from ccm_dbf_chtxn_v0 t1
where t1.batch_id = '011208'
and SUBSTR(t1.card_number,4) = a.primary_card_no),0)
end) total_credit_limit_all
from
( select primary_card_no,previous_balance,current_balance,INTREST_AMT_DUE_THIS_CYCLE,
TOTAL_MIN_AMT_DUE,TOTAL_PURCHASE_THIS_CYCLE,TOTAL_CASH_TRNS_THIS_CYCLE,statement_date,
AVAILABLE_CREDIT_LIMIT,cash_limit,available_cash_limit,total_credit_limit
from credit_card_master_all@FGBAPPL_LINK
) a
where statement_date between ADD_MONTHS(TRUNC(SYSDATE,'mm'),-6) and TRUNC(SYSDATE,'mm')-1
) a,
( select SUM(decode(transaction_type,'D',txn_amount,0)) payments_reversals,
SUM(decode(transaction_type,'C',txn_amount,0)) payments,primary_card_no,TO_CHAR(statement_date,'MON-RRRR') sdate
from credit_card_pymt_dtls
group by primary_card_no,TO_CHAR(statement_date,'MON-RRRR')
) b
where TO_CHAR(a.statement_date,'MON-RRRR')= b.sdate(+)
and a.primary_card_no= b.primary_card_no(+)
) a,
( select SUBSTR(a.card_number,4) card_number,base_segment_number,TO_DATE(account_creation_date,'DDMMYYYY') account_creation_date,
a.batch_id, credit_limit credit_limit_current
from
( select *
from ccm_dbf_phtxn_v0
where batch_id= (SELECT to_char(MAX(TO_DATE(SUBSTR(BATCH_ID,1,6),'DDMMRR')),'DDMMRR') FROM CCM_MST_V0)
) a,
( select *
from ccm_dbf_chtxn_v0
where batch_id=(SELECT to_char(MAX(TO_DATE(SUBSTR(BATCH_ID,1,6),'DDMMRR')),'DDMMRR') FROM CCM_MST_V0)
) b
where a.card_number=b.card_number
and TO_NUMBER(ROUND(MONTHS_BETWEEN(SYSDATE,TO_DATE(account_creation_date,'DDMMYYYY')),2)) >=6
and a.company ='BNK'
) b
where a.primary_card_no = b.card_number
group by primary_card_no,base_segment_number) atab, card_summary_param btab
where utilization between utilization_low and utilization_high
and payment_ratio between payment_ratio_low and payment_ratio_high
and SIGN(atab.previous_balance) =btab.previous_balanceWhere I have to put the PARALLEL hint for maximum performance?
Sorry for asking blindly without doing any R&D. Time is not permitting that...
Edited by: user11115924 on Apr 29, 2009 5:09 AM
Sorry for the kiddy aliases.. Query is not written by me.. -
MS SQL query slow using view column as criteria
HI,
I am experiencing a very frustrate problem. I have 2 tables, and create a view
to union these 2 tables, when do a select on this view using the column of the
view as criteria is took more 1 minutes, but the query runs fine in Qurey Analyzer.
Anybody has the same experience? is this the problem with jdbc?I searched http://e-docs.bea.com/wls/docs70/index.html, also searched the documentation
for wls6.1, wls5.1. As you pointed I searched support site, they are all the customer
case, it's not formal documentation.
Joe Weinstein <[email protected]> wrote:
>
>
jen wrote:
Thanks. but I search on the table is fine (the same column). is thereany db setting
could be tuned? so the view is the problem? No, it's a client decision/issue. If you defined your tables to have
nvarchar columns
the jdbc driver's parameter values would be fine as-is.
I searched "useVarChars" on whole
site and can't find anything.Which site? This is a property of the weblogic.jdbc.mssqlserver4.Driver.
I just went to www.bea.com/support and entered useVarChars in the Ask
BEA
question panel and got hits...
Joe
Joe Weinstein <[email protected]> wrote:
Jen wrote:
Sorry it's my bad. I am testing on wls81, but the problems is on wls70,so they
are using different drivers.
You are the magic man. It worked on wls81 now. I am sure it will curethe problem
on wls70. Is there any documentation on this? Why it is not a problemon some
databse server? ThanksSure. The issue has to do with the MS client-DBMS protocol having evolved
from
an 8-bit (7-bit really) character representation. Now it has a newer
16-bit
way, to transfer NVARCHAR data. Java characters are all 16-bit, so
by default
a JDBC driver will send Java parameters over as NVARCHAR data. This
is
crucial
for Japanese data etc. However, once simple ASCII data is transformed
to an
NVARCHAR format, the DBMS can't directly compare it to varchar data,
or use it
in index searches. The DBMS has to convert the VARCHAR data to NVARCHAR,
but it
can't guarantee that the converted data will retain the same ordering
as the index,
so the DBMS has to do a table scan!
The properties I suggested are each driver's way of allowing you
to say "I'm
a simple American ;) I am using simple varchar data so please sendmy
java
strings that way.". This allows the DBMS to use your varchar indexes
in queries.
Joe Weinstein at BEA
Joe Weinstein <[email protected]> wrote:
Jen wrote:
It doesn't cure the problem. Here is my pool
<JDBCConnectionPool DriverName="weblogic.jdbc.sqlserver.SQLServerDriver"Name="test_pool"
Password="{3DES}fKSovViFe5kHzl/vTs0LVQ==" Properties="user=user;PortNumber=1543;useVarChars=true;ServerName=194.20.2.10;DatabaseName=devDB"
Targets="admin" TestTableName="SQL SELECT COUNT(*) FROM sysobjects"URL="jdbc:bea:sqlserver://194.20.2.10:1543"/>
Strange is some database is fine.Oh, sorry. I thought it was the older weblogic driver. Change the
useVarChars=true to sendStringParametersAsUnicode=false
Let me know... Also, I suggest changing the TestTableName to "SQL
select
1".
For MS, that will be much more efficient than involving a full count
of sysobjects!
Joe
Joe Weinstein <[email protected]> wrote:
Jen wrote:
You are right. Tadaa! Am I Kreskin, or what? ;) Here's what I recommend:
In your pool definition, for this driver add a driver property:
useVarChars=true
and let me know if it's all better.
Joe
I am using weblogic jdbc driver weblogic.jdbc.mssqlserver4.Driver.
here is the code:
getData(Connection connection, String stmt, ArrayList arguments)
PreparedStatement pStatement=null;>>>>>>>> ResultSet resultSet=null;>>>>>>>> try {>>>>>>>> pStatement = connection.prepareStatement(stmt);>>>>>>>> for (int i = 1; i <= arguments.size(); i++) {>>>>>>>> pStatement.setString(i, (String) arguments.get(i-1));>>>>>>>> resultSet = pStatement.executeQuery(); //this statement takesmore than 1
min.
Joe Weinstein <[email protected]> wrote:
Jen wrote:
HI,
I am experiencing a very frustrate problem. I have 2 tables,
and
create
a view
to union these 2 tables, when do a select on this view using
the
column
of the
view as criteria is took more 1 minutes, but the query runs
fine
in
Qurey Analyzer.
Anybody has the same experience? is this the problem with jdbc?
I have suspicions... Show me the jdbc code. I'm guessing it's
a
PreparedStatement,
and you send the search criterion column value as a parameter
you
set
with a
setString().... Let me know... (also let me know which jdbc driveryou're
using).
Joe -
How to restrict keyfigures in my bex query which is built of infosets?
Hi all,
How to restrict keyfigures in the query which is built of infosets?
the query display likes
cost taxamount units
1000 100 10
i want my report to be displayed like this
cost taxamount units
100 10 1.
I have used conditions by restricting using units. like
units equal to 1. but still it display like the above one.
can anyone help me on this??
thanxs
harithaHi Haritha,
Do u want to display units 10 as 1?????
If this is the requirement then u can write a new formula by using IF condition.
Khaja -
Bex Query not passing blank columns to crystal reports
good morning ladies and gentleman,
i have created a bex query that shows all employees from the master data table and links to the cats table to show absence hours...
in bex, all employees are showing and some of the employees have hours showing for sick time. very good...
i have created a report in crystal with this bex query and it does not show rows from the master data that do not have a link to the cats table. only the rows that have a link to the cats table are showing up.
the reason i need the master data from the employee table is that the users want to divide the total hours off(sick time) per department by the total employees in that department.
i have tried to create a formula that will add 1 to the hours sick field, then all the rows should have a amount in it. but, it still does not show the employees who do not have sick time.
here is the sql query from crystal.
SELECT {[Measures].[4J8L2TQJ3P517ISQ1R4Y8UZ36], [Measures].[4J9PY3UANRIW2HW15YSOED92A], [Measures].[4J9TLIO0NDQROSA2YONCW6HB6]}
ON COLUMNS,
NON EMPTY
CROSSJOIN([0EMPLOYEE].[LEVEL01].MEMBERS, [0EMPLOYEE__0COMP_CODE].[LEVEL01].MEMBERS)
DIMENSION PROPERTIES [0EMPLOYEE].[50COMP_CODE], [0EMPLOYEE].[50MAST_CCTR] ON ROWS
FROM [ZCATS_MC1/ZZCATS_MC1_Q001C]
SAP VARIABLES [0I_DAYS] INCLUDING [0CALDAY].[20100502] : [0CALDAY].[20100903]
this is kind of an emergency and i have been working on this for two days and cannot come to a resolution.
if anyone can help, i would appreciate it.
i am guessing that there is a option somewhere that will allow blank records to show.
please help.
thanks,
erikmiss stated the issue. created new note.
-
BEX query runs using parameters entered by user in an Excel spreadsheet
I'm trying to write a macro to automate certain functions for our users.</br>
</br>
Essentially, the users would enter numbers (relating to clients) in column A and e-mail adresses in column B. A set of reports would run based on the first number entered, then the workbook would be saved and e-mailed to the first address in column B. This would be repeated for the 2nd number/address and so on... All Bex reports are in the same workbook. At this point, I'm having a lot of problems finding code that will fill in the Bex query parameters automatically based on inputs in the spreadsheet. Here is what I've worked up so far for the macro:</br>
</br>
Option Explicit</br>
</br>
'Macro step 1 u2013 run workbook for client number input and continue</br>
'EXAMPLE u2013 cell A3 = 1008, cell A4 = 1240</br>
'All BW queries should run based on the input given in column A (beginning wth A3).</br>
</br>
</br>
'Macro step 2 u2013 create directory for the new files and save the first file</br>
' This step will allow the user to save the new files in a new folder in an existing directory, or even to create a new directory:</br>
</br>
Function GetFolderPath() As String</br>
Dim oShell As Object</br>
Set oShell = CreateObject("Shell.Application"). _</br>
BrowseForFolder(0, "Please select folder", 0, "c:
")</br>
If Not oShell Is Nothing Then</br>
GetFolderPath = oShell.Items.Item.Path</br>
Else</br>
GetFolderPath = vbNullString</br>
End If</br>
Set oShell = Nothing</br>
End Function</br>
</br>
Sub Testxl()</br>
Dim FName As String</br>
Dim WbName As String</br>
Dim Search As String</br>
Dim Prompt As String</br>
Dim Title As String</br>
Dim MyDir1 As String</br>
Dim MyDir2 As String</br>
Dim Passed As Long</br>
</br>
On Error GoTo Err:</br>
</br>
FName = GetFolderPath</br>
If FName <> vbNullString Then</br>
Prompt = "Please Select a FileName"</br>
Title = "Name"</br>
Search = InputBox(Prompt, Title)</br>
If Search = "" Then Exit Sub</br>
End If</br>
FName = FName & "\" & Search</br>
MkDir FName</br>
ActiveWorkbook.SaveAs FName & "\" & Search & ".xls"</br>
</br>
'Test for existence of new folders.files</br>
Passed = 1</br>
GetAttr (FName)</br>
Passed = 2</br>
GetAttr (FName & "\" & Search & ".xls")</br>
Passed = 3</br>
GetAttr (ActiveWorkbook.Path & MyDir1)</br>
Passed = 4</br>
GetAttr (ActiveWorkbook.Path & MyDir2)</br>
</br>
End</br>
'Sheets("Sheet1").Range("B1").Value = Search **Add if you require the name to be recorded in your spreadsheet</br>
Err:</br>
Select Case Err</br>
Case 53: MsgBox "File/Folder not created. Failed at step " & Passed</br>
Case 75: MsgBox "Folder already exists"</br>
End Select</br>
End Sub</br>
</br>
'Macro step 3 u2013 save workbook</br>
ActiveWorkbook.Save</br>
</br>
'Macro step 4 u2013 e-mail workbook</br>
'EXAMPLE u2013 cell B3 = amay@email, cell B4 = bmay@email</br>
'The workbook should e-mail based on the input given in column B (beginning wth B3).</br>
wb.SendMail u201Ccell B3u201D</br>
</br>
'Macro step 5 u2013repeat until no inputs remain</br>
'EXAMPLE u2013 cell A3 = 1008, cell A4 = 1240</br>
'Steps 1-4 should repeat for cell A4, then A5 (if necessary) and so on until no more inputs remain. </br>
</br>
</br>
If anyone has any advice I'd love to try it out.</br>
</br>
Thank you for your time.</br>
Andy
Edited by: AndyMay on Jul 14, 2009 5:08 PM - I inserted html breaksOption Explicit</br>
</br>
Sub KeyClient()</br>
</br>
'Macro step 1 - filter workbook for client number input and continue</br>
'EXAMPLE - cell B3 = 1008, cell B4 = 2048</br>
'All BW queries should run based on the input given in column B (beginning wth B3).</br>
</br>
'define x and begin loop</br>
Dim i, x As Integer</br>
Dim curCell As Range</br>
For x = 3 To 22</br>
Set curCell = Worksheets("Input").Cells(x, 2)</br>
</br>
'stop BW from refreshing until we are finished</br>
Run "SAPBEX.XLA!SAPBEXPauseOn"</br>
Run "SAPBEx.XLA!SAPBEXsetFilterValue", curCell, "", Sheets("Client Contribution").Range("C9")</br>
'BW resumes refreshing</br>
Run "SAPBEX.XLA!SAPBEXPauseOff"</br> -
How to use dynamic column fields in formulas
Hi,
we changed from CR 8.5 to CR XI R2.
Many of our reports use dynamic queries with different count of columns.
These reports are designed for the maximum count of columns.
This works fine with CR 8.5 but with CR XI R2 it seems to be that if one of these columns is missing i get an error in all formulas using this missing columns.
How can i use or check this columns in formulas?
regards
MichaelCould it be because of null values? Try File -> Report Options and then check the box next to convert null values to default values and see it that helps or you can go into the formulae and choose Default Values for Nulls. Either of these options should plug a zero if the values happen to be nulls.
-
Tooltip for h:selectOneMenu which uses f:selectItems to display data
I want to display a tooltip when a user mouseovers over every element in a dropdown.
I'm using h:selectOneMenu for displaying the dropdown
<h:selectOneMenu tabindex="4" id="dataList" valueChangeListener="#{DataBean.processDataSelection}" value="#{DataBean.dataSelected}" >
<a4j:support event="onchange" reRender="dataPanel" ajaxSingle="true"/>
<f:selectItems value="#{DataBean.dataList}" />
</h:selectOneMenu>
Can anyone give any solution?There is no way with the Sun JSF Mojarra. Either implement your own Javascript solution (crawl the DOM and apply title the attribute on the options), or rise a featurerequest at the issuetracker of the Mojarra [development team|http://javaserverfaces.dev.java.net] that they should add the 'title' attribute to the f:selectItem tag and the javax.faces.model.SelectItem class.
-
Lowest value in CKF column in a query which uses structures.
Hi Experts:
I have the following user requirement.
There is a need to find the least value of the values in a calculated key figure in the columns
In rows I have structure and 6 structure elements. The structure elements are 0plant restricted with one plant each.
Plant / Period Spend / Period Volume / $/case / Best of Best
1000 / 1000 / 20 / 50 /20
2000 / 2000 / 100 /20/20
3000/ 3000/ 70 / 50 /43 /20
The column $/case is a calculated key figure and I need the best of best column to contain the lowest value of the $/Case column
This Best of Best column needs to be used in another calculated key figure.
Anyone who has solution will be awarded with SDN points.
NHello,
You can try out by creating a CKF and set the properties for that calculated keyfigure best of best with calculate single value as minimum and also result also minimum, then you can use this ckf in another ckf. if not going to be used globally you can try out by using formulas. -
Hi All,
Suppose I have table, whose structure changes frequently on daily basis.
For eg. desc my_table gives you following column name on Day 1
SQL > desc my_table;
Output
Name
Age
Phone
On Day 2, two more columns are added, viz, Address and Salary.
SQL > desc my_table;
Output
Name
Age
Phone
Address
Salary
Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
For Day 1 my XML file should be like this.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
</group>
</dataStructure>
</dataTemplate>
And my Day 1, EXCEL output from RTF template should be like this.
Name Age Phone
Swapnill 23 12345
For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
,Address
,Salary
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
<element name="Address" value="Address" />
<element name="Salary" value="Salary" />
</group>
</dataStructure>
</dataTemplate>
And my Day 2, EXCEL output from RTF template should be like this.
Name Age Phone Address Salary
Swapnill 23 12345 Madrid 100000
Now, I dont know below things.
Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
Regards,
Swapnil K.
Message was edited by: SwapnilKHi All,
I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
Please let me know if there is any oracle functionality to do this.
If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
For eg, /$APPL_TOP/ar/1.0/sql or something.
Regards,
Swapnil K. -
Fine tunning the query which uses /*+ USE_CONCAT */ table hint
Some of the queries in our application uses the /*+ USE_CONCAT */ table hint which takes huge time for the execution in Oracle database.when we fire the below query in 250Million production database it takes approx.3min for the execution.
Because of this we are facing a performance issue in the application.
Below is the sample query :
SELECT /*+ USE_CONCAT */ * FROM DI_MATCH_KEY WHERE NORM_COUNTRY_CD = 'US'
AND ((( NORM_CONAME_KEY1 ='WILM I' OR NORM_CONAME_KEY2 = 'WILM I' OR NORM_CONAME_KEY23 = 'WILM I'
OR NORM_CONAME_KEYFIRST ='WILLIAM' ) AND NORM_STATE_PROVINCE = 'CA' ) OR NORM_ADDR_KEY2 = 'CALMN 12 3 OSAI')
Regarding the indexes almost for all the columns combination for the above sql index already created in table.
Your suggestions will be appreciated
Thanks,
Regards,
Krishna kumarHi,
Thanks for our valuable inputs.
As suggested find attached explain plan and trace file details in the excel sheet.
TRACE FILE:
<pre>
TKPROF: Release 10.2.0.1.0 - Production on Thu Feb 14 11:11:59 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: implhr01_ora_26457.trc
Sort options: prsela exeela fchela
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
SELECT /*+ USE_CONCAT */ COUNT(*) FROM DI_MATCH_KEY WHERE NORM_COUNTRY_CD = 'US'
AND ((( NORM_CONAME_KEY1 ='WILM I' OR NORM_CONAME_KEY2 = 'WILM I' OR NORM_CONAME_KEY23 = 'WILM I'
OR NORM_CONAME_KEYFIRST ='WILLIAM' ) AND NORM_STATE_PROVINCE = 'CA' ) OR NORM_ADDR_KEY2 = 'CALMN 12 3 OSAI')
call count cpu elapsed disk query current rows
Parse 1 0.03 0.05 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 3.97 65.43 30633 64053 0 1
total 4 4.00 65.49 30633 64053 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 76
Rows Row Source Operation
1 SORT AGGREGATE (cr=64053 pr=30633 pw=0 time=65436584 us)
73914 CONCATENATION (cr=64053 pr=30633 pw=0 time=61623673 us)
0 TABLE ACCESS BY INDEX ROWID DI_MATCH_KEY (cr=4 pr=2 pw=0 time=32617 us)
0 INDEX RANGE SCAN MKADDR_KEY2 (cr=4 pr=2 pw=0 time=32599 us)(object id 122583)
75 TABLE ACCESS BY INDEX ROWID DI_MATCH_KEY (cr=80 pr=20 pw=0 time=1369427 us)
75 INDEX RANGE SCAN MK_CY_KEY1_ST_PROV (cr=5 pr=0 pw=0 time=2119 us)(object id 122666)
2 TABLE ACCESS BY INDEX ROWID DI_MATCH_KEY (cr=81 pr=2 pw=0 time=26723 us)
77 INDEX RANGE SCAN MK_CY_KEY2_ST_PROV (cr=4 pr=0 pw=0 time=3641 us)(object id 122667)
2 TABLE ACCESS BY INDEX ROWID DI_MATCH_KEY (cr=6 pr=0 pw=0 time=47 us)
2 INDEX RANGE SCAN MK_CY_KEY1_AGN (cr=4 pr=0 pw=0 time=28 us)(object id 122670)
73835 TABLE ACCESS BY INDEX ROWID DI_MATCH_KEY (cr=63882 pr=30609 pw=0 time=61503773 us)
73905 INDEX RANGE SCAN MK_CY_KEY2_AGN (cr=266 pr=176 pw=0 time=148198 us)(object id 122745)
alter session set sql_trace true
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 76
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.03 0.05 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 3.97 65.43 30633 64053 0 1
total 5 4.00 65.50 30633 64053 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 9 0.05 0.03 0 0 0 0
Execute 23 0.05 0.08 0 0 0 0
Fetch 98 0.01 0.01 0 137 0 76
total 130 0.11 0.13 0 137 0 76
Misses in library cache during parse: 9
Misses in library cache during execute: 9
2 user SQL statements in session.
23 internal SQL statements in session.
25 SQL statements in session.
Trace file: implhr01_ora_26457.trc
Trace file compatibility: 10.01.00
Sort options: prsela exeela fchela
1 session in tracefile.
2 user SQL statements in trace file.
23 internal SQL statements in trace file.
25 SQL statements in trace file.
11 unique SQL statements in trace file.
561 lines in trace file.
91 elapsed seconds in trace file.
</pre>
EXPLAIN PLAN:
<pre>
ID OPERATION OBJECT_NAME CARDINALITY BYTES COST CPU_COST
0 SELECT STATEMENT 1 53 1886 15753172
1 SORT 1 53
2 CONCATENATION
3 TABLE ACCESS DI_MATCH_KEY 8 424 10 78334
4 INDEX MKADDR_KEY2 8 4 30086
5 TABLE ACCESS DI_MATCH_KEY 3 159 7 53574
6 INDEX MK_CY_KEY1_ST_PROV 3 4 29286
7 TABLE ACCESS DI_MATCH_KEY 3 159 7 53740
8 INDEX MK_CY_KEY2_ST_PROV 3 4 29286
9 TABLE ACCESS DI_MATCH_KEY 5 265 7 55941
10 INDEX MK_CY_KEY1_AGN 5 4 29686
11 TABLE ACCESS DI_MATCH_KEY 2192 116176 1855 15511582
12 INDEX MK_CY_KEY2_AGN 2228 12 524136
</pre>
Kindly help us regarding this.
Thanks,
Krishna Kumar. -
BEx Query - Condition Across Row & column
Hello Experts,
For a query i'm giving a condition based on 2 characteristics which is at the row. When it is drilled across week at the column, it is not working proper. But when i have week at the row itself, it is working fine. Kindly help me out in having week at the column level and still be able to apply the condition.
Regards
SamHi Triple,
Thatz rite. I tried the fourth option. That is working fine only when i have Week also in the row along with other 2 characteristics in the row. If i pull the week to the column, that is not working fine.
Regards
Sam -
How to set aggregation rule (SUM) to a query which uses multiple tables
Hi,
I have a doubt like i have a query .i want to get the sum of few columns in that..how can i achieve it as it joins multiple tables . i am posting the query under this. please help me to resolve this. i need to get summation of column which is marked in bold . i am so sorry to post such a big query.. thanks in advance.
SELECT DISTINCT
SAS.ACCOUNT_MONTH_NO,
SAS.BILL_TO_MAJOR_SALES_CHANNEL,
SAS.BUS_AREA_ID,
SAS.CUST_NAME,
SAS.PART_NO,
SAS.PART_DESC,
SAS.PRODUCT_CLASS_CODE,
SAS.SUPER_FAMILY_CODE,
*SAS.NET_SALES_AMT_COA_CURR,*
*SAS.GROSS_SALES_AMT_COA_CURR*,
*SAS.SHIPPED_QTY*,
SAS.SRCE_SYS_ID,
GWS.SRC_LOCATION,
GWS.PART_CF_PART_NUMBER,
GWS.ANALYST_COMMENTS,
NVL(GWS.CLAIM_QUANTITY,0) AS *CLAIM_QUANTITY*,
GWS.CUSTOMER_CLAIM_SUBMISSION_DATE,
GWS.CLAIM_TYPE,
GWS.CREDIT_MEMO_NO,
NVL(GWS.CREDIT_MEMO_AMT,0) AS *CREDIT_MEMO_AMT*,
GWS.TRANS_CREATED_BY,
GWS.COMPONENT_CODE,
GWS.DATE_OF_THE_FAILURE,
GWS.DATE_PART_IN_SERVICE,
GWS.PROBLEM_CODE,
NVL(GWS.TOT_AMT_REVIEWED_BY_CA,0) AS *TOT_AMT_REVIEWED_BY_CA*,
GWS.REGION
FROM
SELECT
TO_CHAR(A.STATUS_DATE, 'YYYYMM') AS ACCOUNT_MONTH_NO,
A.LOCATION_ID SRC_LOCATION,
A.CF_PN PART_CF_PART_NUMBER,
A.ANALYST_COMMENTS,
A.CLAIM_QUANTITY,
A.CUST_CLAIM_SUBM_DATE CUSTOMER_CLAIM_SUBMISSION_DATE,
A.CLAIM_TYPE,
A.CREDIT_MEMO_NO,
A.CREDIT_MEMO_AMT,
A.CREATED_BY TRANS_CREATED_BY,
A.FAULT_CODE COMPONENT_CODE,
A.PART_FAILURE_DATE DATE_OF_THE_FAILURE,
A.PART_IN_SERVICE_DATE DATE_PART_IN_SERVICE,
A.FAULT_CODE PROBLEM_CODE,
A.TOT_AMT_REVIEWED_BY_CA,
A.PART_BUS_AREA_ID AS BUS_AREA_ID,
A.PART_SRC_SYS_ID,
C.CUST_NAME,
C.BILL_TO_MAJOR_SALES_CHANNEL,
P.PART_NO,
P.PART_DESC,
P.PRODUCT_CLASS_CODE,
L.REGION
FROM
EDWOWN.MEDW_BIS_DTL_FACT A,
EDWOWN.EDW_MV_DB_CUST_DIM C,
EDWOWN.EDW_BUSINESS_LOCATION_DIM L,
EDWOWN.EDW_V_ACTV_PART_DIM P
WHERE
A.PART_KEY = P.PART_KEY
AND A.CUSTOMER_KEY = C.CUSTOMER_KEY
AND A.LOCATION_KEY = L.LOCATION_KEY
AND A.PART_SRC_SYS_ID = 'SOMS'
AND A.PART_BUS_AREA_ID = 'USA'
AND C.BILL_TO_MAJOR_SALES_CHANNEL <> 'IN'
GWS,
SELECT
A.ACCOUNT_MONTH_NO,
A.BUS_AREA_ID,
A.NET_SALES_AMT_COA_CURR,
A.GROSS_SALES_AMT_COA_CURR,
A.SHIPPED_QTY,
B.BILL_TO_MAJOR_SALES_CHANNEL,
A.SRCE_SYS_ID,
B.CUST_NAME,
D.PART_NO,
D.PART_DESC,
D.PRODUCT_CLASS_CODE,
D.SUPER_FAMILY_CODE
FROM
SASOWN.SAS_V_CORP_SHIP_FACT A,
SASOWN.SAS_V_CORP_CUST_DIM B,
SASOWN.SAS_V_CORP_LOCN_DIM C,
SASOWN.SAS_V_CORP_PART_DIM D
WHERE
C.DIVISION_CODE = A.DIVISION_CODE
AND
B.B_HIERARCHY_KEY = A.B_HIERARCHY_KEY
AND
D.PART_NO = A.PART_NO
AND
A.SRCE_SYS_ID = 'SOMS'
AND
A.BUS_AREA_ID = 'USA'
AND
B.BILL_TO_MAJOR_SALES_CHANNEL <> 'IN'
SAS
WHERE
SAS.ACCOUNT_MONTH_NO = GWS.ACCOUNT_MONTH_NO(+)
AND SAS.BILL_TO_MAJOR_SALES_CHANNEL = GWS.BILL_TO_MAJOR_SALES_CHANNEL(+)
AND SAS.BUS_AREA_ID = GWS.BUS_AREA_ID(+)
AND SAS.PRODUCT_CLASS_CODE = GWS.PRODUCT_CLASS_CODE(+);thanks in advance
aswinYou get rid of the distinct.
You put sum() around your starred items.
You put all the remaining columns in a GROUP BY clause.
You hope that that none of the other tables has more than one row that matches the SAS table, which would cause you to count that row more than once.
Maybe you are looking for
-
Urgent help to save a waveform as jpeg to a specifi folder on my pc
Hello I'm practically very new to labview and maybe even to the forum that I might be posting this question in the wrong place (sorry about that). I need urgent help on the following issue (prob. a very easey one) here is a picture copy of on
-
How to use dynamic time series in formula
I have Time dimension with active Dynamic Time Series for Y-T-D. I'd like to use it in member formula - e.g. IF (@ISMBR("Y-T-D(Aug)")) - but this doesn't work as I get error message Unknown variable or member name. Any idea how to work with dynamic t
-
Hi, There is the table info_prog in R3 46B,but there is not it in R3 470. is there the other table replace it in r3 470? Do you know? Regards, collysun
-
How can i use passbook in romania?
How can i use passbook in romania? when i open the app and i touch app store, something is loading and aftept waiting 10 minutes is still loading... how can i use it? please help me iPhone 4s I.O.S 6
-
Hi , currently my XI in dev system in pointing to Dev ECC client 210. Now I have to point the XI to Sandbox client 210. Please let me know if I have to just change the channel parameters (RFC adapters) or do I nede t create new Business systems and c