Group by Query not giving desired results
Hi,
I've a requirement to find minimum month based on status:
The following query is giving error :
SELECT
b.app_name,
DECODE (a.status,
'C','Closed',
'O','Open',
'F','Future',
'W','Pending',
'N','Not Opened') decode_status
MIN(a.period_name)
FROM table a,
table b
WHERE a.app_id = b.app_id
AND b.app_name = 'NAME1'
AND a.book_id = &book_id
AND a.status = 'O'
GROUP BY b.app_name,
DECODE (a.status,
'C','Closed',
'O','Open',
'F','Future',
'W','Pending',
'N','Not Opened') decode_status
for ex: in the above query if I've four records with status 'O' and period_name as 'May-12', 'Jun-12','Jul-12' ,'Aug-12' then I need to pick 'May'
Thanks,
Kiran
Hi, Kiran,
user518071 wrote:
Hi,
I've a requirement to find minimum month based on status:
The following query is giving error :
SELECT
b.app_name,
DECODE (a.status,
'C','Closed',
'O','Open',
'F','Future',
'W','Pending',
'N','Not Opened') decode_status
MIN(a.period_name)
FROM table a,
table b
WHERE a.app_id = b.app_id
AND b.app_name = 'NAME1'
AND a.book_id = &book_id
AND a.status = 'O'
GROUP BY b.app_name,
DECODE (a.status,
'C','Closed',
'O','Open',
'F','Future',
'W','Pending',
'N','Not Opened') decode_status
for ex: in the above query if I've four records with status 'O' and period_name as 'May-12', 'Jun-12','Jul-12' ,'Aug-12' then I need to pick 'May'
Thanks,
KiranIt looks like you're almost there.
If period_name is a DATE, then
MIN (a.period_name)is finidng the earliest period name, such as 5 May 2012 17:03:49. If you just want to see 'May 2012', then change that to
TO_CHAR ( MIN (a.period_name)
, 'Mon YYYY'
)If a.period_name is a VARCHAR2, then change it to a DATE. The best way to do this is permanently. There is no reason to store date information in VARCHAR2 columns. Oracle supplies DATE columns; there's no extra cost for using them. DATE columns were designed for storing date information, use them to do that.
if you must keep your date information in VARCHAR2 a column, then use TO_DATE in the query. It will be slow, and you'll have run-time errors if any of the information is in the wrong format. That's what happens when you store date information in VARCHAR2 columns.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002}
Similar Messages
-
SPEL not giving desired result
Hi ALL,
SPEL
*${oa.TestPVO1.xxDisable}* on Disable Property for a button
In CO
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
am.invokeMethod("hide");
In AM
public void hide()
OAViewObject disvo = (OAViewObject)getTestPVO1();
if (!disvo.isPreparedForExecution())
disvo.executeQuery();
Row drow = disvo.createRow();//.getCurrentRow();
disvo.insertRow(drow);
drow.setAttribute("xxDisable", Boolean.FALSE);
NOT giving desired o/p to disable the button
Thanks,
Sombit.
Edited by: Sombit on Oct 1, 2009 7:33 AMTry assigning the SPEL value in the *VORowImpl.
First, in order to assign a value to SPEL, you'll need to create a custom VO. Here's a sample query I've used to create my VO to pull data pertainining to if an Attribute should be mandatory/rendered.
SELECT min(descriptive_flex_context_code) descriptive_flex_context_code, min(Enabled) Enabled, min(END_USER_COLUMN_NAME) END_USER_COLUMN_NAME, min(required_flag) required_flag, min(application_column_name) application_column_name,
min(xxx.LOV) LOV
from
(SELECT descriptive_flex_context_code,'Y' Enabled, END_USER_COLUMN_NAME, required_flag, application_column_name,
decode(ffvv.flex_value,null,'N','Y') LOV
FROM FND_DESCR_FLEX_COL_USAGE_VL fdfc,
fnd_flex_values_vl ffvv
WHERE (fdfc.APPLICATION_ID=20045)
and (fdfc.DESCRIPTIVE_FLEXFIELD_NAME LIKE 'SPL Account Map')
and fdfc.enabled_flag = 'Y'
and fdfc.display_flag = 'Y'
and fdfc.application_column_name = 'ATTRIBUTE5'
and ffvv.flex_value_set_id(+) = fdfc.flex_value_set_id
and rownum = 1) xxx
Once the VO is created, I created several transient "boolean" attributes in my VO. These attributes will be assigned a value based on code I place in my *VORowImpl since this is the file which controls attribute assignments.
But before that, in my *VOImpl, I've defined a custom method which is used to execute the VO from my AM.
public class Ref5PVOImpl extends OAViewObjectImpl
* This is the default constructor (do not remove)
public Ref5PVOImpl()
public void initRef5PVO()
// setWhereClause("descriptive_flex_context_code in (select vendor_name from spl_account_map where cont_cd = :1)");
setWhereClauseParams(null); //Always reset
// setWhereClauseParam(0, acct);
// System.out.println("value_selected customer>> "+acct);
executeQuery();
In my *VORowImpl, I've added custom code to my Attribute methods so that they return the proper values when invoked...
public String getMakeRequired()
if (getRequiredFlag()!= null)
if ("Y".equals(getRequiredFlag()))
//if(getMessageChoiceAttribute()==null)
System.out.println("Required returned yes");
return "yes";
else
System.out.println("Required returned no");
return "no";
else
return "no"; //poplist will be disabled - DFF is not configured
public Boolean getOptionRender()
if (getLov()!= null)
// In this method check if the Message Text Input is valid
if ("N".equals(getLov()))
System.out.println("OptionRender returned true "+ getLov());
return Boolean.TRUE; //text input will be enabled if no LOV exists
else
System.out.println("OptionRender returned false "+ getLov());
return Boolean.FALSE; //text input will be disabled if LOV exists
else
return Boolean.FALSE; //text input will be disabled - DFF is not configured
Then add your SPEL directive into your field's Property inpector...
${oa.Ref5PVO1.MakeRequired}
${oa.Ref5PVO1.OptionRender} -
Query not showing desired result
Hi All,
DB :-10.2.0.3
I am using following query to extarct the backuppice, which falls between the dates specified by query. I am really amazed, why it's not giving me the expected results.
select handle, to_char(start_time, 'dd-mon-yy hh24:mi:ss') "start_time" , to_char(completion_time, ' dd-mon-yy hh24:mi:ss') "end_time" from
v$backup_piece where
to_char(start_time,'dd-mon-yy hh24:mi:ss') >'27-oct-10 23:00:00'
and
to_char(completion_time,'dd-mon-yy hh24:mi:ss')<'28-oct-10 04:20:53'
Results truncated, just to fit in this window.
23:02:25
/data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0c 27-sep-10 23:02:39 27-sep-10
23:02:40
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_ctl_l1_t730854174_s32554_p1.rmn 27-sep-10 23:02:58 27-sep-10
23:02:59
/data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0d 27-sep-10 23:03:02 27-sep-10
23:03:02
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_arc_l1_t730854220_s32556_p1.rmn 27-sep-10 23:03:41 27-sep-10
23:03:44
/data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0e 27-sep-10 23:03:51 27-sep-10
23:03:51
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733532449_s33531_p1.rmn 27-oct-10 23:00:50 27-oct-10
23:36:00
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733534566_s33532_p1.rmn 27-oct-10 23:36:07 27-oct-10
23:48:38
HANDLE start_time end_time
/data/oracle/LNEVRPP1/backup/arc2adsm/LNEVRPP1_arc_l0_t733536053_s33534_p1.rmn 28-oct-10 00:00:54 28-oct-10
00:01:13
/data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-00 28-oct-10 00:01:22 28-oct-10
00:01:23
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733535322_s33533_p1.rmn 27-oct-10 23:48:43 28-oct-10
00:20:06
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733537209_s33536_p1.rmn 28-oct-10 00:20:10 28-oct-10
00:33:44
/data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-01 28-oct-10 00:33:47 28-oct-10
00:33:48
/data/oracle/LNEVRPP1/backup/database/LNEVRPP1_ctl_l0_t733538041_s33538_p1.rmn 28-oct-10 00:34:04 28-oct-10
00:34:04
/data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-02 28-oct-10 00:34:06 28-oct-10
00:34:07Hi
Try:
select handle, to_char(start_time, 'dd-mon-yy hh24:mi:ss') "start_time" , to_char(completion_time, ' dd-mon-yy hh24:mi:ss') "end_time"
from v$backup_piece
where start_time > to_date ('27-oct-10 23:00:00','dd-mon-yy hh24:mi:ss')
and completion_time < to_date ('28-oct-10 23:00:00','dd-mon-yy hh24:mi:ss')
Regards,
Tycho -
Account Query is taking longtime and not giving desired results
Hi,
I'm trying to run the following query to get code combination id for last six months with 1)no activity in gl_je_lines
2) Sum of begin balance and PTD is zero
Her's query :
select
cc.segment3 SEGMENT
from apps.gl_code_combinations cc,
apps.gl_balances bal,
apps.fnd_flex_values_vl ffvl,
apps.fnd_flex_value_sets ffvs,
(select period_name
from apps.gl_periods
where period_set_name ='abc Calendar'
and to_date(period_name,'Mon-YY') between add_months(sysdate,(6*-1)-1) and sysdate) p
where cc.CODE_COMBINATION_ID = bal.CODE_COMBINATION_ID
and ffvl.FLEX_VALUE = cc.segment3
and ffvl.FLEX_VALUE_SET_ID = ffvs.flex_value_set_id
and ffvs.flex_value_set_id = 2222222
and bal.SET_OF_BOOKS_ID =555
and cc.CHART_OF_ACCOUNTS_ID = 11111
and bal.period_name = p.period_name
and ffvl.ENABLED_FLAG = 'Y'
and ffvl.END_DATE_ACTIVE is null
and bal.TEMPLATE_ID IS NULL
and bal.actual_flag='A'
and bal.currency_code 'STAT'
and ffvl.creation_date <= add_months(sysdate,(6*-1)-1)
and cc.SEGMENT3 not in (
select
distinct gcc.SEGMENT3
from apps.gl_je_lines l
, apps.gl_code_Combinations gcc,
(select period_name
from apps.gl_periods
where period_set_name ='abc Calendar'
and end_date > add_months(last_day(sysdate),-1) and end_date <= last_day(sysdate)) lp
where l.code_combination_id = gcc.code_combination_id
and gcc.CHART_OF_ACCOUNTS_ID = 11111
and l.period_name=lp.period_name
and l.set_of_books_id = 555
and l.status='P')
group by cc.SEGMENT3
HAVING sum(abs(nvl(bal.BEGIN_BALANCE_DR,0))-abs(nvl(bal.BEGIN_BALANCE_CR,0))+abs(nvl(bal.PERIOD_NET_DR,0))-abs(nvl(bal.PERIOD_NET_CR,0))) = 0--------------------------------------------------------------------------------
Here's Explain Plan
Operation Node Cost IO Cost CPU Cost Cardinality Object Name Options Object Type Optimizer
SELECT STATEMENT 5155 5094 554583434 1 ALL_ROWS
FILTER
HASH (GROUP BY) 5155 5094 554583434 1 GROUP BY
FILTER
TABLE ACCESS (BY INDEX ROWID) 4 4 31301 1 GL_BALANCES BY INDEX ROWID TABLE ANALYZED
NESTED LOOPS 18 18 427467 1
MERGE JOIN (CARTESIAN) 14 14 396166 1 CARTESIAN
TABLE ACCESS (BY INDEX ROWID) 4 4 49409 1 GL_CODE_COMBINATIONS BY INDEX ROWID TABLE ANALYZED
NESTED LOOPS 8 8 82677 1
NESTED LOOPS 4 4 33268 1
NESTED LOOPS 4 4 31368 1
INDEX (UNIQUE SCAN) 1 1 8171 1 FND_FLEX_VALUE_SETS_U1 UNIQUE SCAN INDEX (UNIQUE) ANALYZED
TABLE ACCESS (BY INDEX ROWID) 3 3 23196 1 FND_FLEX_VALUES BY INDEX ROWID TABLE ANALYZED
INDEX (RANGE SCAN) 2 2 15293 1 FND_FLEX_VALUES_N3 RANGE SCAN INDEX ANALYZED
INDEX (UNIQUE SCAN) 0 0 1900 1 FND_FLEX_VALUES_TL_U1 UNIQUE SCAN INDEX (UNIQUE) ANALYZED
INDEX (RANGE SCAN) 2 2 33113 4 GL_CODE_COMBINATIONS_N3 RANGE SCAN INDEX ANALYZED
FILTER
TABLE ACCESS (BY INDEX ROWID) 20 20 163416 1 GL_JE_LINES BY INDEX ROWID TABLE ANALYZED
NESTED LOOPS 5136 5076 545022343 1
MERGE JOIN (CARTESIAN) 5103 5043 544739760 4 CARTESIAN
TABLE ACCESS (BY INDEX ROWID) 5 5 37587 1 GL_PERIODS BY INDEX ROWID TABLE ANALYZED
INDEX (RANGE SCAN) 2 2 15043 4 GL_PERIODS_N2 RANGE SCAN INDEX ANALYZED
BUFFER (SORT) 5098 5038 544702173 7 SORT
TABLE ACCESS (FULL) 5098 5038 544702173 7 GL_CODE_COMBINATIONS FULL TABLE ANALYZED
INDEX (RANGE SCAN) 3 3 29414 36 GL_JE_LINES_N1 RANGE SCAN INDEX ANALYZED
BUFFER (SORT) 10 10 346757 1 SORT
INDEX (FULL SCAN) 6 6 313489 1 GL_PERIODS_U1 FULL SCAN INDEX (UNIQUE) ANALYZED
INDEX (RANGE SCAN) 2 2 15493 1 GL_BALANCES_N1 RANGE SCAN INDEX ANALYZEDThis query is taking two hrs to get results :
How to tune this query to get results fasterHi,
170 posts and still do not know how to use {noformat}{noformat} tags?
Please read <a href="https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360002">How do I ask a question on the forums?</a>
If you have a performance issue have a look at <a href="https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360003">How to improve the performance of my query? / My query is running slow. </a>
Additionally when you put some code please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Also consider closing some of your questions when someone is answering. Looking at your profile:
Handle: user518071
Status Level: Newbie
Registered: Jun 30, 2006
Total Posts: 170
Total Questions: 92 (58 unresolved) it still looks that you have 58 unresolved questions. Are they really all unresolved?
Regards.
Al -
MIX sale return problem(query not giving required result)
i have written following query which is running sucessfully.the concept behind this query is to get a exact quantity of sold items after subtracting the sale return from the sale.now the problem is that when user take sale return against invoice then this query providing ok result but when user take sale return against MIX items not knowing exactly the invoice then query is not showing result means not subtracting MIX sale from sale.please help me to get required result from this query.
i m using oracle 9i with developer 6i
select s.price,s.item_code,S.DESCR,
sum(decode(d.MONno,01,NVL(S.QTY,0),0)) JAN,
sum(decode(d.MONno,02,NVL(S.QTY,0),0)) FEB,
sum(decode(d.MONno,03,NVL(S.QTY,0),0)) MAR,
sum(decode(d.MONno,04,NVL(S.QTY,0),0)) APR,
sum(decode(d.MONno,05,NVL(S.QTY,0),0)) MAY,
sum(decode(d.MONno,06,NVL(S.QTY,0),0)) JUN,
sum(decode(d.MONno,07,NVL(S.QTY,0),0)) JULY,
sum(decode(d.MONno,08,NVL(S.QTY,0),0)) AUG,
sum(decode(d.MONno,09,NVL(S.QTY,0),0)) SEP,
sum(decode(d.MONno,10,NVL(S.QTY,0),0)) OCT,
sum(decode(d.MONno,11,NVL(S.QTY,0),0)) NOV,
sum(decode(d.MONno,12,NVL(S.QTY,0),0)) DEC,
sum(S.qty) TU
FROM
(select nvl(sales_detail.qty,0)+NVL(sales_detail.bonus,0) as qty,
sales_detail.item_code AS ITEM_CODE,stock_reg.price price,
stock_reg.descr AS descr,
s_date as sale_date FROM
SALES_DETAIL,SALES_HEADER,STOCK_REG
WHERE SALES_DETAIL.S_ID = SALES_HEADER.S_ID AND
SALES_DETAIL.STOCKCODE = STOCK_REG.STOCKCODE AND
STOCK_REG.COMCODE=:COM AND
STOCK_REG.GROUPID = :GID
UNION ALL
SELECT -1*QTY,ITEM_CODE,PRICE,DESCR,SALE_DATE FROM
(select nvl(sales_detailR.qty,0)+NVL(sales_detailR.bonus,0) as qty,
sales_detailR.item_code AS ITEM_CODE,stock_reg.price as price,
stock_reg.descr AS descr,
RETURN_date as sale_date FROM
SALES_DETAILR,SALES_HEADERR,STOCK_REG
WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE AND
STOCK_REG.COMCODE=:COM AND
STOCK_REG.GROUPID = :GID
UNION ALL
select -1nvl(sales_detailR.qty,0)+NVL(sales_detailR.bonus,0) as qty,*
sales_detailR.item_code AS ITEM_CODE,stock_reg.price as price,
stock_reg.descr AS descr,
RETURN_date as sale_date FROM
SALES_DETAILR,SALES_HEADERR,STOCK_REG
WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE AND
SALES_HEADERR.S_ID = 'MIX' AND
STOCK_REG.COMCODE=:COM AND
STOCK_REG.GROUPID = :GID)) S,
(select level as MONno
from dual
connect by level <= 12) d
where d.MONno = to_char(s.sALE_date, 'MM') AND trunc(S.SALE_DATE,'MONTH') BETWEEN TO_DATE(:FDATE,'MMYY') AND TO_DATE(:TDATE,'MMYY')
GROUP BY S.ITEM_CODE,S.DESCR,S.PRICE
ORDER BY S.DESCR ASCGaurav,
Can you print all the binding variables and update the ouput here.
And I didn't get this date format 'dd-mon-rrrr', normally it will be like 'dd-mon-yyyy' right?
Thanks,
With regards,m
Kali.
OSSI. -
Am.getOADBTransaction().getOrgId() not giving desired result
Hello,
I am trying to query Operating Unit in controller of one OAF page.
Code I tried was
am.getOADBTransaction().getOrgId(), but it returns -1.
The responsibility user selects is assigned a Global Security Profile, which has been added only one Operating Unit. So
I was expecting to get id of that operating unit, but does not work.
What API should be used in EBS 12 with Multi-Org, to query one or more operating units attached with the responsibility.
Also when I run
select * from Per_Security_Profiles on that instance, for the Global security profile in question I see in the table
organization_id as NULL, though in the forms UI, I can see one operating unit added to this Global Security Profile.
regards, Yorahey,
If u want the header to get printed once in the main window make a table in that u will have header,main area and footer.
IF u dont want the header to repeat put the haeder in the header section else if u want the header to repeat then put it in the main area.
U can check the additional events such as only on first page like that to suffice your requirements. -
Query not giving desired output
Hi
I have the following values for the varchar column
USR_UDF_STAFFID
SEC/116
SEC/842
SEC/820
SEC/843
SEC/590
SEC/604
SEC/014
SEC/849
SEC/866
SEC/601
SEC/602
SEC/1796
SEC/1888
SEC/444
SEC/167
SEC/760
SEC/885
434532
24244
YC/3456
YC/234
CS/4512
CS/345
I am running below query to get the max value.
select max(usr_udf_staffid) as STAFF_ID from usr where usr_udf_staffid like 'SEC/%'
Expected Output: SEC/1888
Actual Output: SEC/885
What's wrong with this simple query?
Pls help.hi Try this it will help
SELECT *
FROM usr
ORDER BY LPAD ( SUBSTR ( usr_udf_staffid
, 1
, INSTR (usr_udf_staffid, '/')
, 5 -- Max. characters before the /
, LPAD ( SUBSTR ( usr_udf_staffid
, 1 + INSTR (usr_udf_staffid, '/')
, 10
) -- Max. characters after the /
;Regards
Hitesh
Edited by: Hitesh Nirkhey on Jan 6, 2011 4:47 PM -
SQL> set long 2000
SQL> select * from v$version;
select username from dba_users where username like '%KRO%';
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production
SQL>
USERNAME
SUPRKRON
KRONREAD
SQL>
select sum(bytes/1024/1024/1024) from dba_segments where owner='SUPRKRON'SQL> ;
SUM(BYTES/1024/1024/1024)
3.62319946
SQL> select sum(bytes/1024/1024/1024) from dba_segments where owner='KRONREAD';
SUM(BYTES/1024/1024/1024)
-------------------------user11919409 wrote:
SQL> set long 2000
SQL> select * from v$version;
select username from dba_users where username like '%KRO%';
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production
SQL>
USERNAME
SUPRKRON
KRONREAD
SQL>
select sum(bytes/1024/1024/1024) from dba_segments where owner='SUPRKRON'SQL> ;
SUM(BYTES/1024/1024/1024)
3.62319946
SQL> select sum(bytes/1024/1024/1024) from dba_segments where owner='KRONREAD';
SUM(BYTES/1024/1024/1024)
-------------------------OK, KRONREAD does not own any objects.
a READONLY schema? -
If statement is not giving desired result..
i want to connct a java program to sql database only if a condition is met..
n im using if statemnt for this..
if(condition)
try
Class.forName(driver);
but this program is connecting without meeting the condition...
what could be wrong?Rooty,
Check whether you have made any typo mistake like semicolon after IF condition. This may cause problem.
I mean,
if(condition)*;*
}This should be,
if(condition)
}Other possibility is "=" instead of "==".
should be
if(a==b)Thanks
Umesh Bongale -
Price = Sales / Volume ... FOREACH not giving desired results
This should be easy but I am tearing my hair out... I want to use an IP formula to calculate Sales Price by Gross Sales / Sales Volume.
We use an account model where CMROW = '000030' means Sales Volume (stored in key figure A0QTYVAR0), CMROW = '000050' means Gross Sales (stored in key figure 0AMOUNT). The formula is:
FOREACH PLANVER.
IF PLANVER = '#'.
FOREACH CALYEAR.
IF CALYEAR = '2008'.
FOREACH SHIPTO.
SALES_VOL = 0.
GROSS_SALES = 0.
FOREACH CMROW.
FOREACH INFOPROV.
SALES_VOL = SALES_VOL + { A0QTYVAR0, '2008', INFOPROV, SHIPTO, '000030', '#' }.
GROSS_SALES = GROSS_SALES + { 0AMOUNT, '2008', INFOPROV, SHIPTO, '000050', '#'}.
ENDFOR.
ENDFOR.
MESSAGE I000(38) WITH 'SHIPTO = ' SHIPTO.
MESSAGE I000(38) WITH 'GROSS_SALES = ' GROSS_SALES 'SALES_VOL = ' SALES_VOL.
{ 0AMOUNT, V_TARGETYEAR, 'A2APSBUP1', SHIPTO, '002000', V_PLANVER } = GROSS_SALES / SALES_VOL.
ENDFOR.
ENDIF.
ENDFOR.
ENDIF.
ENDFOR.
When I run it I get output like:
SHIPTO = 0005000053
GROSS_SALES = 2,9 SALES_VOL = 0,0
GROSS_SALES = 0,0 SALES_VOL = 1,8
SHIPTO = 0005000149
GROSS_SALES = 2,9 SALES_VOL = 0,0
GROSS_SALES = 0,0 SALES_VOL = 2,1
etc. and the price written to the planning cube is always zero, since variables GROSS_SALES and SALES_VOL are never non-zero at the same time.
What am I doing wrong?!Hi,
Please try this, and let me know your outputs...
Supose the following: FTBCH {KF, 0CALYEAR, 0CMROW, 0INFOPROV, PLANVER}
V_TARGETYEAR as input from user
V_PLANVER as inpur from user.
SALES_VOL = 0.
GROSS_SALES = 0.
FOREACH CALYEAR, CMROW, INFOPROV.
IF CALYEAR = '2008'.
SALES_VOL = SALES_VOL + { A0QTYVAR0, CALYEAR, '000030', 'ZIC_SOURCE', #}.
GROSS_SALES = GROSS_SALES + { 0AMOUNT, CALYEAR, '000050', 'ZIC_SOURCE', #}.
ENDIF.
ENDFOR.
MESSAGE I000(38) WITH 'GROSS_SALES = ' GROSS_SALES 'SALES_VOL = ' SALES_VOL.
{ 0AMOUNT, V_TARGETYEAR, 'A2APSBUP1', '002000', V_PLANVER } = GROSS_SALES / SALES_VOL. -
Query not giving the correct result
select Project_id, contractno
from elf_transactions
where(rtrim(contractno),rtrim(project_id)) not in
(select rtrim(contractno),rtrim(projectid)
from contract_proj
where report_month='1-May-2007' )
when I m firing this query, it is not giving correct result to me, it also select the recorts which are matches in both the table
i want to fine out those contract, with projectid which are not in contract_proj table
Please help me in this regardCREATE TABLE ELF_TRANSACTIONS
VENDOR_ORDER_REF VARCHAR2(60 BYTE),
BT_SUB_CON_REF VARCHAR2(10 BYTE),
PR_NO VARCHAR2(15 BYTE),
PO_NO VARCHAR2(15 BYTE),
PR_PO_DESCR VARCHAR2(200 BYTE),
ONE_IT_PROG VARCHAR2(50 BYTE),
BT_DEL_MANAGER_NAME VARCHAR2(40 BYTE),
DELIVERY_TYPE VARCHAR2(5 BYTE),
ACTUAL_DEP_DATE DATE,
ASSOC_ASG_BR_QUE VARCHAR2(50 BYTE),
PRE_AVG_P1_P2_INC_CNT NUMBER(3),
POST_P1_P2_INC NUMBER(3),
PERC_GROWTH_POST_REL NUMBER(3),
VENDOR_DEL_MANAGER VARCHAR2(50 BYTE),
REPORT_MONTH DATE,
COMMENTS VARCHAR2(200 BYTE),
PROJECT_ID VARCHAR2(20 BYTE),
CONTRACTNO VARCHAR2(15 BYTE),
CONTRACT_TYPE NVARCHAR2(15),
IDUNO VARCHAR2(10 BYTE),
STATUS VARCHAR2(10 BYTE),
DESCRIPTIONCODEDELIVERABLE VARCHAR2(255 BYTE),
UNIQUEID VARCHAR2(255 BYTE),
LOCK_RECORD CHAR(1 BYTE),
VERIFIED CHAR(1 BYTE),
VERIFIED_BY VARCHAR2(40 BYTE),
BT_VERIFIED CHAR(1 BYTE),
BT_VERIFIED_BY VARCHAR2(40 BYTE)
CREATE TABLE CONTRACT_PROJ
CONTRACTNO VARCHAR2(10 BYTE),
PROJECTID VARCHAR2(20 BYTE),
IDUNO VARCHAR2(10 BYTE),
CH_EMPID VARCHAR2(8 BYTE),
CHNAME VARCHAR2(40 BYTE),
GH_EMPID VARCHAR2(8 BYTE),
GHNAME VARCHAR2(40 BYTE),
PM_EMPID VARCHAR2(8 BYTE),
PMNAME VARCHAR2(40 BYTE),
SPM_EMPID VARCHAR2(8 BYTE),
SPMNAME VARCHAR2(40 BYTE),
PRJ_MONTH DATE,
BT_CONTRACT CHAR(1 BYTE)
REPORT_MONTH COMMENTS PROJECT_ID CONTRACTNO CONTRACT_TYPE IDUNO STATUS DESCRIPTIONCODEDELIVERABLE UNIQUEID
06/01/2007 00:00:00 1287 TML007452 OPEN Delivery of CRs DM CD and NSI N/A
06/01/2007 00:00:00 1280 TML007452 OPEN Delivery of CRs H&W OOR and WLTO N/A
06/01/2007 00:00:00 1231 TML007452 OPEN Delivery of CRs H&W OOR WLTO
06/01/2007 00:00:00 1097 TML007679 OPEN High Level Roadmap for Global Services and Wholesale with Feasibility study into BTR access to Switc N/A
06/01/2007 00:00:00 405 TML007942 OPEN RTRCC DEVELOPMENT -Q107
06/01/2007 00:00:00 405 TML007919 OPEN WLR3 DEVELOPMENT-Q107
06/01/2007 00:00:00 1170 TML008439 OPEN R-510
CONTRACTNO PROJECTID IDUNO CH_EMPID CHNAME GH_EMPID GHNAME PM_EMPID PMNAME SPM_EMPID SPMNAME PRJ_MONTH BT_CONTRACT
MBT003060 176 BT06 8694 Soman Sameer Surendra 1054 Bhadti Shripad Shivram 1054 Bhadti Shripad Shivram 1420 Rao Darbhamulla Kameswara 05/01/2007 00:00:00 N
MBT003842 1156 BT12 19992 Kalle Ajit Ashutosh 1539 Padgaonkar Shailesh Vishwanath 13948 Khunte Milind Vasant 16426 Kulkarni Vinay 05/01/2007 00:00:00 Y
MBT004677 458 BT09 20275 Mundassery George 5044 Kamalapurkar Leena Shrinivas 12849 Dave Ajay Yogeshchandra 2017 KIRKIRE SONAL MADHUKAR 05/01/2007 00:00:00 N
MBT004695 362 BT13 20276 Ghosh Sankar 2624 Avachat Jagdish Vasantrao 13592 Pal Sudipta 2624 Avachat Jagdish Vasantrao 05/01/2007 00:00:00 N
MBT004826 VITRIA BT09 20275 Mundassery George 26099 Saha Debendra Kumar 28134 Hinge Anand Sharad 12777 Karandikar Sumedh Vidyadhar 05/01/2007 00:00:00 Y
MBT004924 1027 BT03 1451 Tillu Ashirwad 15693 Devaraj Daniel G 6867 Jadhav Satyajit Ramesh 15693 Devaraj Daniel G 05/01/2007 00:00:00 N
MBT004927 1025 BT05 4436 Kelkar Subhash Manohar 20379 Gore Sujeet Narayan 13704 Vignesh Chandrasekaran 4347 BIJNORI REHANA GULAMWARIS 05/01/2007 00:00:00 N
MBT004927 1092 BT05 4436 Kelkar Subhash Manohar 15094 Jain Jitendra 13350 Bokil Shripad Raghunath 9511 Markande Balchandra Narayan 05/01/2007 00:00:00 N
MBT004927 1213 BT09 20275 Mundassery George 19996 Vege Sridhar 16401 Sibgathulla Mohammed 19996 Vege Sridhar 05/01/2007 00:00:00 N -
Goto link query is not giving exact results
Hi Folks
I am having issue with GOTO query.
My main query gives details of Employee seperation in particular year.
For this query i have goto query.
When i am checking the details of goto query ,it is giving incorrect results.
Your help is appreciated.
Thanks & Regards,
Hari ReddyHi Hari,
Check in RSBBS, whether you specified the receiver query correctly...
Check the link:
[http://help.sap.com/saphelp_nw04/helpdata/en/99/08629bd3e41d418530c6849df303c9/content.htm]
Hope this helps you.
Regards,
Yokesh. -
The dashboard propmt not showing desired results
Hi,
I have propmt created using this condition.But it is not showing me the desired results.The code seems to be correct.any help plz...
case when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 0 and 30 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 0 and 30 then '30 days'
when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 31 and 60 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 31 and 60 then ' last 60 days'
when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 then 'last 90 days'
else '> 90 and max 100 Days' endHi,
Create a dummy column for the below code
case when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 0 and 30 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 0 and 30 then '30 days'
when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 31 and 60 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 31 and 60 then ' last 60 days'
when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 then 'last 90 days'
else '> 90 and max 100 Days' endfilter it as is prompted for that column after giving filter as is prompted you can hide that column or remove it.
Save the report
Assign points and close thread, if your question is answered....
Cheers,
Aravind -
% Change is not giving correct results.
Hi,
I am using Ago Function to calculate Current month cx count , previous month cx count, present month acct count, previous month acct count and in the report parameter selecting Reporting Month as DEC 09. The results are coming perfectly fine... but when I create % Change Previous Month Cx count and % change Previous month Account count, It is not showing the correct results and getting only 0% listed even if the Difference is huge and should be around 10% ...
The code written to calculate % change is :
CASE WHEN ("EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" IS NULL OR "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" = 0) AND NOT "EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" IS NULL AND "EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" <> 0 THEN 100.0 WHEN ("EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" IS NULL OR "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" = 0) AND ("EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" IS NULL OR "EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" = 0) THEN 0.0 WHEN "EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" IS NULL AND NOT "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" IS NULL AND "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" <> 0 THEN -(100.0) ELSE 100.0 * ("EIP BDW Analytics"."EIP Reporting FACT"."Current Month Account Count" - "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count") / "EIP BDW Analytics"."EIP Reporting FACT"."Previous Month Account Count" END
Can some one tell me what I need to do in order to get the desired results.
I am using a time dimension with the following hierarchy ( Year - Month - Period_ID) joined with the Reporting Table Fact which has count of cx and Count of Accts.We have two assets one acquired on 01/04/2014 and another on 26/04/2014. Everything else is same for both assets like asset class , keys etc.
Now here are two calculations.
System is giving calculation ok , what should we do so that for both assets we are left with same scrap value (1047) (and not 1119.68 as in last line )
Can anyone help how to get value in last field of screen shot given below asset vale date or it is always blank.
wanted to add something in our case DEP to the DAY is also ticked in dep key.
regards
Sanjeev Mehndiratta -
Delivery Query not giving data
Folks,
I am working on a query to show Pick Release Data using a query. I am using the following one but not getting the desired results.
SELECT --decode(gv_extract_type, 'FULL', 'CONVERSION', 'INTERFACE') src,
oos.name,--type,
wnd.delivery_id,
ood.organization_id,
--shipping_charges,
wnd.ultimate_dropoff_location_id,
wnd.problem_contact_reference,
wc.freight_code,
wnd.ship_method_code,
wnd.service_level,
hp.party_number,
hp.party_name,
hl.address_line_1,
hl.address_line_2,
hl.address_line_3,
hl.town_or_city,
hl.country,
hl.postal_code,
hl.region_1,
hl.telephone_number_1,
wdd.delivery_detail_id,
msib.segment1,
msib.description,
wdd.requested_quantity
FROM wsh_new_deliveries wnd,
wsh_delivery_details wdd,
wsh_delivery_assignments wda,
hr_locations hl,
hr_locations hl1,
hr_locations hl2,
wsh_carriers wc,
org_organization_definitions ood,
hz_parties hp,
mtl_system_items_b msib,
oe_order_headers_all ooha,
oe_order_sources oos
WHERE wda.delivery_detail_id = wdd.delivery_detail_id
AND wnd.delivery_id = wda.delivery_id
AND ood.organization_id = wdd.organization_id
AND wc.carrier_id = wnd.carrier_id
AND wnd.party_id = hp.party_id
AND wnd.source_header_id = ooha.header_id
AND ooha.order_source_id = oos.order_source_id(+)
AND wdd.source_header_id = ooha.header_id
AND msib.organization_id = ood.organization_id
AND ood.organization_code = '3PL'
AND msib.inventory_item_id = wdd.inventory_item_id
AND hl.location_id = wdd.ship_from_location_id
AND hl1.location_id = wdd.ship_to_location_id
AND hl2.location_id = wdd.deliver_to_location_id;
Could xomeone help me as to where I am going wrong?
ThanksHi,
Check with this Query , first of all you have to test with one order number one by one then only you will get Values
SELECT oos.name,--type,
wnd.delivery_id,
ood.organization_id,
--shipping_charges,
wnd.ultimate_dropoff_location_id,
wnd.problem_contact_reference,
wc.freight_code,
wnd.ship_method_code,
wnd.service_level,
hp.party_number,
hp.party_name,
hl.address_line_1,
hl.address_line_2,
hl.address_line_3,
hl.town_or_city,
hl.country,
hl.postal_code,
hl.region_1,
hl.telephone_number_1,
wdd.delivery_detail_id,
msib.segment1,
msib.description,
wdd.requested_quantity
FROM wsh_new_deliveries wnd,
wsh_delivery_details wdd,
wsh_delivery_assignments wda,
hr_locations hl,
hr_locations hl1,
hr_locations hl2,
wsh_carriers wc,
org_organization_definitions ood,
hz_parties hp,
mtl_system_items_b msib,
oe_order_headers_all ooha,
oe_order_sources oos
WHERE wda.delivery_detail_id = wdd.delivery_detail_id
AND wnd.delivery_id = wda.delivery_id
AND ood.organization_id = wdd.organization_id
AND wc.carrier_id = wnd.carrier_id
--AND wnd.party_id = hp.party_id
AND wnd.party_id = hp.party_id
--AND wnd.source_header_id = ooha.header_id
AND ooha.order_source_id = oos.order_source_id
AND wdd.source_header_id = ooha.header_id
AND msib.organization_id = ood.organization_id
AND ood.organization_code = 'ABC'
AND msib.inventory_item_id = wdd.inventory_item_id
AND hl.location_id = wdd.ship_from_location_id
AND ood.organization_id = ooha.ship_from_org_id
AND hl1.location_id = wdd.ship_from_location_id
AND hl2.location_id = wdd.ship_from_location_id
AND ooha.ship_from_org_id = hl.inventory_organization_id
AND ooha.ship_from_org_id = hl1.inventory_organization_id
AND ooha.ship_from_org_id = hl2.inventory_organization_id
AND order_number = 1234
Maybe you are looking for
-
ITunes says it can't sync calendar b/c calendar on iPod is in use.
Hi all. I'm stumped. I just got a new iPod Touch. I was able to sync my contacts (and everything else) through iTunes on my MacBook, but I got an error message about the calendar: "iTunes could not sync calendars to the iPod 'iPod Touch' because t
-
Win 8.1 Drivers x64 for deskjet 710c
Hi Mainly for the attention of Alan Morris at Microsoft. He has patched the drivers for Windows 7 x64 of which a stick post has been made in the HP Printer Driver forums. We now need a patch for Windows 8.1 x64 as the native driver supplied with wind
-
Error in Integration Directory / Test Configuration
Hi all, Please help me to solve this problem: http://img2.freeimagehosting.net/image.php?803d3b7522.png for more information: My scenario is idoc to idoc. Sender: sap0796 - client910 Receiver:sap0796 - client 800 XI: sap0810 - client810 Reg
-
Windows CE 5.0 and Compact Framework 2.0
We need some help with develop and deploy applications develop with .NET 1) Are Olite 10gR2 certified with Windows CE 5.0? PDA UNITECH PA960 Windows CE 5.0, 51856 Kb de RAM y 2 flash: Disk0nChip M_Systems de 20 Mb PCMCIA/Compact Flash Device de 488.7
-
One device has Internet access through MHS291L, the other doesn't.
I have a MacBook Pro which is connected to my MHS291L by Wi-Fi, and it works great. I also have a Windows Vista PC connected using a Wi-Fi adapter, and it does not have Internet access. I got the Wi-Fi adapter about a week ago, and it was working for