Select Query for Report
Hi All
I have a table called Agent. Each Agent processes requests.
So accordingly Request is another table.
Now the Agent can process the request successfully, fail or it could be
in progress.
So accordingly I have a status column in the Request table which can have the following values
New - when the request is allocated to the agent
Open- When the agent opens the request
Action- when the agent acted upon the request
Sold - when the agent was successful in processing the request
Fail - when the agent could not process the request
In the Request table there is column called requestDate which is the
date when the Request was first inserted (i.e when its New)
Now whenever the agent acts upon the request from the front end
the status change is logged in a RequestLog table.
So when the agent changes the status to Open, an entry is logged into
RequestLog table.
So when the agent open the request an entry in the RequestLog table
would go with the status as open , the reference of the requestId &
the date on which the status is changed
Similar entries will be logged for each request when the agent acts on
the respective requests like if its Sold then the status will be sold,
the date of sale & the corresponding request Id will be logged into the
RequestLog table.
In the Request table the status will be changed to "Open" or "Sold" but the
requestDate will not change & it will remain the date when it was inserted
Now I want to generate a Report which shows the list of all agents within a state
with all total number of requests they have handled, how many are in Opened status,
how many are in Sold status & how many are in Fail status. I also have to show the
average time(in days) it took for each agent to Open the request, make the sale or qualify it
as Fail. This average time I want it for an agent & not request specific.
& In the end I have to show the grand total of all the requests handled by all the agents,
grand total of opened status requests,grand total of Sold status requests,grand total of Fail status requests as well as the total average time it took to Open ,total average time it took to sale & total average time it takes to Fail
I have dabbled with simple SQL but not a complex report type like above. So I would need help from all you experts.
Here is what I plan to do
my from clause would include the Agent, Request, RequestLog table
where Request.requestdate between <fromDate> and <toDate>
group by agent.agentname,
Select would have count(agent.requestid),
Now how do i show the list of Open requests, sold requests & fail requests in different columns since all these values are in the same column.
Also I am aware of the average fnction but I need help on how to use the same in such a scenario.
Do post your thoughts on the same.
Regards
Hi All
I have made some queries to fetch the Report data. I would want you to post your comments on the same.
This is my first query which returns the total count of request per dealer, how much are in open, sent & dead state & total per status.
select AGENT.COMPANY_NAME,count(REQUEST.REQUEST_ID) TOTAL ,
sum(decode(REQUEST.status,'Open',1,0)) OPEN,
sum(decode(REQUEST.status,'Sent',1,0)) SENT,
sum(decode(REQUEST.status,'Dead',1,0)) DEAD
from AGENT, REQUEST
where
AGENT.STATE='ACT'
and REQUEST.REQUEST_TYPE='B'
and REQUEST.CONFIRMATION='Y'
and AGENT.DEALER_ID = REQUEST.DEALER_NUMBER
group by grouping sets(AGENT.COMPANY_NAME, ())
Then I have to retrieve the average number of days it takes to change the request to Open, average number of days it takes to change the request to Sent & average number of days it takes to change the request to Dead
per Agent. The base date is stored in REQUEST table (request_date column) & the subsequent change of status is stored in activity_date column
of ACTIVITY table
Here is what I do get the average number of days it takes to change the status for the Agent
select AGENT.COMPANY_NAME,
avg( decode (REQUEST.status,'Open',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_OPEN,
avg( decode (REQUEST.status,'Sent',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_SENT,
avg( decode (REQUEST.status,'Dead',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_DEAD
from REQUEST, ACTIVITY, AGENT
where
AGENT.STATE='ACT'
and REQUEST.REQUEST_TYPE='B'
and REQUEST.CONFIRMATION='Y '
and REQUEST.dealer_number = AGENT.DEALER_ID
and REQUEST.STATUS = ACTIVITY.STATUS
group by grouping sets(AGENT.COMPANY_NAME, ())
I hope this is the right way for calculating average number of days
Since most part of the queries is the same
I tried to merge both the queries into one because I need to render the report in that fashion. But the moment I merge the query its giving absurd results.
Do post your thoughts on the same
Regards
Similar Messages
-
Select Query for smart form-invoice
Hi Folks,
I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
Can anyone here please give me the select query for the same.
fields to fetched are as follows:-
1.vbrp-arktx,
2.vbrp-fkimg,
3.konv-kbetr with respect to vbrk-knumv
4.konv-kwert.
And also what all I have to give in format interface and global definitions of the smartform.
please help me in this regard.
Points will be given.
K.Kiran.Hi,
declare the variables V_arktx(40) and v_Qty like vbrp-fkimp and other varaibles for Kbetr, kwert, knumv on the global definitions.
select single arktx fkimg into (v_arktx, v_qty) from vbrp
where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
this select has to fire in the item level and in the loop.
so have to write in the correct place.
select kbetr kwert into (v_kbetr, v_kwert) from konv
where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
regards,
anji -
Can any one send select query for this?
Hi,
can any one plese send select query for the following query.please send as early as possible.
Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
I_OUTPUT-BUKRS Company code I_BSID-BUKRS
I_OUTPUT-KUNNR Customer number I_BSID-KUNNR
I_OUTPUT-NAME1 Customer Name I_KNA1-NAME1
I_OUTPUT-KNKLI Credit account I_KNKK-KNKLI
I_OUTPUT-KDGRP Customer Group I_KNKK-KDGRP
I_OUTPUT-KLIMK Credit Limit I_KNKK_KNKLI-KLIMK
I_OUTPUT-KVGR1 Business Unit I_KNVV-KVGR1
I_OUTPUT-REBZG Invoice Number I_BSID-REBZG
I_OUTPUT-BLDAT Invoice Date I_BSID-BLDAT
I_OUTPUT-WAERS Document Currency I_BSID-WAERS
I_OUTPUT-DUE_DATE Due Date Based on below
Calculation
Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above. Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days) For Credits Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.) Based on the due date.
Thanks&Regards,
praveen kumar.AHI,
To get Open Items you can use Function module:
data:i_items TYPE STANDARD TABLE OF rfpos.
CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
EXPORTING
bukrs = p_bukrs
kunnr = wa_customer-kunnr
TABLES
t_postab = i_items
EXCEPTIONS
no_open_items = 1
OTHERS = 2.
Table I_items will have all the open items for that Customer in the given company code.
Well for Clear Items: Try
GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
Hope it helps.
Manish -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D -
Select query for fetching from 3 tables.
Can we have a single Select query for fetching same fields (kappl,kschl,vkorg,vtweg,spart,kunwe,datbi,knuma,datab,knumh)
from 3 tables >> KOTE707,KOTE708 and KOTE709 into an internal table for a particular KUNNR?
Regards,
Shashank.Hi,
If you have kunnr field in all the 3 tables then it is possible. use inner join as below
PARAMETERS: p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.
DATA: BEGIN OF wa,
fldate TYPE sflight-fldate,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa.
DATA itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY fldate carrname connid.
SELECT c~carrname p~connid f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c
INNER JOIN spfli AS p ON p~carrid = c~carrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON f~carrid = p~carrid
AND f~connid = p~connid ).
LOOP AT itab INTO wa.
WRITE: / wa-fldate, wa-carrname, wa-connid.
ENDLOOP.
<b>Reward Points if this helps,</b>
Satish -
How to do outer join select query for an APEX report
Hello everyone,
I am Ann.
I have one select statement that calculate the statistics for one month(October 2012 in this example)
select ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE('Oct 2012','MON YYYY'))
THEN last_day(TO_DATE('Oct 2012','MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
from phase_membership ph
inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
inner join defendant def on ce.defendant_id = def.def_id
where def.active = 1
and ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY'))
and ph.active = 1
and UPPER(ce.court_name) LIKE '%'
group by rollup(phase_number)
Result is as below
Phase_Number AVG_DAYS
Phase One 8.6666666666666667
Phase Two 14.6
Phase Three 12
11.4615365
I have other select list mainly list the months between two date value.
select to_char(which_month, 'MON YYYY') as display_month
from (
select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
from all_objects
where
rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
order by which_month )
Query result is as below
DISPLAY_MONTH
AUG 2012
SEP 2012
OCT 2012
Is there any way that I can join these two select statement above to generate a result like:
Month Phase Number Avg days
Aug 2012 Phase One 8.666
Sep 2012 Phase One 7.66
Oct 2012 Phase One 5.66
Aug 2012 Phase Two 8.666
Sep 2012 Phase Two 7.66
Oct 2012 Phase Two 5.66
Aug 2012 Phase Three 8.666
Sep 2012 Phase Three 7.66
Oct 2012 Phase Three 5.66
Or
Month Phase Number Avg days
Aug 2012 Phase One 8.666
Aug 2012 Phase Two 7.66
Aug 2012 Phase Three 5.66
Sep 2012 Phase One 8.666
Sep 2012 Phase Two 7.66
Sep 2012 Phase Three 5.66
Oct 2012 Phase One 8.666
Oct 2012 Phase Two 7.66
Oct 2012 Phase Three 5.66
And it can be order by either Phase Number or Month.
My other colleague suggest I should use an left outer join but after trying so many ways, I am still stuck.
One of the select I tried is
select a.display_month,b.* from (
select to_char(which_month, 'MON YYYY') as display_month
from (
select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
from all_objects
where
rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
order by which_month )) a left outer join
( select to_char(ph.date_finished,'MON YYYY') as join_month, ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(a.display_month,'MON YYYY'))
THEN last_day(TO_DATE(a.display_month,'MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
from phase_membership ph
inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
inner join defendant def on ce.defendant_id = def.def_id
where def.active = 1
and ph.date_started <= last_day(TO_DATE(a.display_month,'MON YYYY'))
and ph.active = 1
and UPPER(ce.court_name) LIKE '%'
group by to_char(ph.date_finished,'MON YYYY') , rollup(phase_number)) b
on a.display_month = b.join_month
but then I get an error
SQL Error: ORA-00904: "A"."DISPLAY_MONTH": invalid identifier
I need to display a report on APEX with option for people to download at least CSV format.
I already have 1 inteactive report in the page, so don’t think can add another interactive report without using the iframe trick.
If any of you have any ideas, please help.
Thanks a lot.
AnnFirst of all, a huge thanks for following this Frank.
I have just started working here, I think the Oracle version is 11g, but not sure.
To run Oracle APEX version 4, I think they must have at least 10g R2.
This report is a bit challenging for me.I has never worked with PARTITION before.
About the select query you suggested, I run , and it seems working fine, but if I try this,
it return error ORA-01843: not a valid month
DEFINE startmonth = "Aug 2012";
DEFINE endmonth = "Oct 2012";
WITH all_months AS
select add_months(to_date('&startmonth','MON YYYY'), rownum-1) AS which_month
, add_months(to_date('&startmonth','MON YYYY'), rownum ) AS next_month
from all_objects
where
rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
select TO_CHAR (am.which_month, 'Mon YYYY') AS month
, ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(am.which_month,'MON YYYY'))
THEN last_day(TO_DATE(am.which_month,'MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
FROM all_months am
LEFT OUTER JOIN phase_membership ph PARTITION BY (ph.phase_number)
ON am.which_month <= ph.date_started
AND am.next_month > ph.date_started
AND ph.date_started <= last_day(TO_DATE(am.which_month,'MON YYYY')) -- May not be needed
AND ph.active = 1
LEFT OUTER join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
and ce.court_name IS NOT NULL -- or something involving LIKE
LEFT OUTER join defendant def on ce.defendant_id = def.def_id
AND def.active = 1
group by rollup(phase_number, am.which_month)
ORDER BY am.which_month
, ph.phase_number
;Here is the shorted versions of the three tables:
A_DEFENDANT, A_ENGAGEMENT, A_PHASE_MEMBERSHIP
CREATE TABLE "A_DEFENDANT"
"DEF_ID" NUMBER NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(50 BYTE),
"SURNAME" VARCHAR2(20 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"))
Sample Data
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
CREATE TABLE "A_ENGAGEMENT"
"ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
"COURT_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"DATE_REFERRED" DATE,
"DETERMINATION_HEARING_DATE" DATE,
"DATE_JOINED_COURT" DATE,
"DATE_TREATMENT_STARTED" DATE,
"DATE_TERMINATED" DATE,
"TERMINATION_TYPE" VARCHAR2(50 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
"DEFENDANT_ID" NUMBER,
CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"))
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
CREATE TABLE "A_PHASE_MEMBERSHIP"
"MPM_ID" NUMBER NOT NULL ENABLE,
"MPM_ENG_ID" NUMBER NOT NULL ENABLE,
"PHASE_NUMBER" VARCHAR2(50 BYTE),
"DATE_STARTED" DATE NOT NULL ENABLE,
"DATE_FINISHED" DATE,
"NOTES" VARCHAR2(2000 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"))
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);
The requirements are:
The user must be able to request the extract for one or more calendar months, e.g.
May 2013
May 2013 – Sep 2013.
The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
The file must also include a row of totals.
The user must be able to request the extract for either Waitakere or Auckland or Consolidated (both courts’ statistics accumulated).
Then the part that I am stuck is
For each monitoring phase:
Phase name (e.g. “Phase One”)
Avg_time_in_phase_all_particip
for each phase name,
Add up days in each “phase name” Monitoring Phase, calculated as:
If Monitoring Phase.Date Finished is NULL or > month end date,
+(*Month end date* Minus Monitoring Phase.Date Started Plus 1)+
Otherwise (phase is complete)
+(Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)+
Divide by the numbers of all participants who have engaged in “phase name”.
This is the words of the Business Analyst,
I try to do as required but still struggle to identify end_month for the above formula to display for the range of months.
Of course, I can write two nested cursor. The first one run the list of month, then for each month, run the parameterised report.
But I prefer if possible just use SQL statements, or at least a PL/SQL but return a query.
With this way, I can create an APEX report, and use their CSV Extract function.
Yes, you are right, court_name is one of the selection parameters.
And the statistics is not exactly for one month. It is kind of trying to identify all phases that are running through the specified month (even phase.date_started is before the month start).
This is the reason why I put the condition AND ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY')) (otherwise I get negative avg_days)
User can choose either one court "AA" or "BB" or combined which is all figures.
Sorry for bombarding you a lot of information.
Thanks a lot, again.
Edited by: Ann586341 on Oct 29, 2012 9:57 PM
Edited by: Ann586341 on Oct 29, 2012 9:59 PM -
Using (Select All) for report parameter
Hi there,
I am Looking for assistance in making the the (Select All) option work for a particular report. The parameter is for product families (which there are about 47 unique results for). The report is also influenced by two other parameters, one being a date type
i.e 'MTD' 'YTD' 'MAT'. When a long date type such as MAT is selected, selecting all families causes the report to get stuck in an endless loop.
I've tried creating my own <Select All'> item in the parameter dataset, then I have the opposite issue, the <Select All> selection works perfectly but when I try and tick two or more product families I recieve the following error:
"An expressions of non-boolean type specified in a context where a condition is expected, near ',' "
Parameter Dataset:
SELECT '<Select All>' AS family_description, '<Select All>' AS family_code
UNION ALL
SELECT DISTINCT family_description, family_code
FROM dim_item AS item
ORDER BY family_description
Snippet From Main Report Dataset:
Where
sales.oe_branch_code IN (@Branch)
And
sales.order_status <> 'X' and sales.line_status <> 'X'
AND (item.family_code IN (@Family) OR @Family = '<Select All>')
Any help is appreciated
Thanks Kindly
SQL NoviceHi KCBA,
I have check the query you have provided the issue cause by the query "
AND (item.family_code
IN (@Family)
OR @Family =
'<Select All>')" you are using which is incorrect.
If the parameter @Family have set as "Allow multiple values" then you don't need to add new label "Select All" for the multiple value parameter already have this section, if the parameter @Family is not the multiple values
parameter and you want to select all the values or just select one, you can modify the query as below which will works fine:
"AND (item.family_code =
(@Family) OR
@Family = '<Select All>'
If you are using the stored procedure and have issue about add multiple value parameter in the where clause, you are take reference to below similar case about how to create an function to make it work:
Passing multi-value parameter in stored procedure ssrs
If I have some misunderstanding, please try to provide more details information about the relationship of all the parameters (Cascading or not ), current result you have got and expect result you want(Snapshot).
Any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
Issue with select query for secondary index
Hi all,
I have created a secondary index A on mara table with fields Mandt and Packaging Material Type VHART.
Now i am trying to write a report
Tables : mara.
data : begin of itab occurs 0.
include structure mara.
data : end of itab.
*select * from mara into table itab*
CLIENT SPECIFIED where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Unable to interpret "CLIENT". Possible causes of error: Incorrect spelling or comma error.
if i change to my select query to
*select * from mara into table itab*
where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Without the addition "CLIENT SPECIFIED", you cannot specify the client field "MANDT" in the WHERE condition.
Let me know if iam wrong and we are at 4.6c
ThanksLike I already said, even if you have added the mandt field in the secondary index, there is no need the use it in the select statement.
Let me elaborate on my reply before. If you have created a UNIQUE index, which I don't think you have, then you should include CLIENT in the index. A unique index for a client-dependent table must contain the client field.
Additional info:
The accessing speed does not depend on whether or not an index is defined as a unique index. A unique index is simply a means of defining that certain field combinations of data records in a table are unique.
Even if you have defined a secondary index, this does not automatically mean, that this index is used. This also depends on the database optimizer. The optimizer will determine which index is best and use it. So before transporting this index, you should make sure that the index is used. How to check this, have a look at the link:
[check if index is used|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21eb3a446011d189700000e8322d00/content.htm]
Edited by: Micky Oestreich on May 13, 2008 10:09 PM -
Select query 'for all entries'
Hello Friends,
SELECT emp_id emp_name
INTO corresponding fields of table itab_emp
FROM employee
for all entries in itab_dept
WHERE emp_id = itab_dept_emp_id.
In the above select query we are using 'for all entries' for the internal table itab_dept.What will happen if the join fails?Will we get any data in the output table?
What is the prerequisites for using 'for all entries'.
Please advice me on this.
Regards
Ashish.Hi
In this case all the records available in employee table are extracted into internal table itab_emp.
It is safe to check whether itab_dept is initial or not.
If it is initial then stop the select query.
Check the following program u will get an idea.
Also try this program by removing comment to 'REFRESH IT_LFA1'.
REPORT ZBM_PG .
TABLES: LFA1, EKKO.
DATA:
IT_LFA1 TYPE TABLE OF LFA1 WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
IT_LFA1 TYPE TABLE OF LFA1 WITH HEADER LINE,
IT_EKKO TYPE TABLE OF EKKO WITH HEADER LINE.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 WHERE LIFNR EQ '0000001000' OR LIFNR EQ '0000001500'.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 UP TO 1 ROWS.
refresh it_lfa1.
SELECT * FROM EKKO INTO TABLE IT_EKKO FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR.
LOOP AT IT_EKKO.
WRITE: / IT_EKKO-LIFNR, IT_EKKO-EBELN.
ENDLOOP.
Reward me if it is useful -
PLSQL Funciton in SELECT query for a region in APEX
Hello, I am developing a SQL report based on SELECT query that uses a plsql function.
However the PLSQL Function returns a numeric value and , in addition to that, it also has one out parameter.
How do I display this out paramete's value on APEX report?
Thanks,
RFrom a performance perspective, calling PL/SQL functions from SQL queries is expensive because you context switch between SQL and PL/SQL. That's ok for say 20-30 rows, but as you return more rows it gets more and more expensive. If possible write it all in SQL.
Tyler Muth
http://tylermuth.wordpress.com
"Applied Oracle Security: Developing Secure Database and Middleware Environments": http://sn.im/aos.book -
Hi !!
I have to create a report,which would be called from a form, and I require your help to code a query for a complex logic involving two tables. My application is on Oracle8i and Developer6. The table structures and their values are as below:
Table1
(Main-Part, Sub-Part is a composite key)
MainPart Sub-part
M0001 S0001
M0001 S0002
M0001 S0003
M0002 S0004
M0002 S0101
M0002 S0909
M0003 S1909
Table2 (Part is a primary key)
Part Qty-in-store qty-in-prodn qty-rejected
M0001 10 10 10
S0001 1 10 1
M0003 1 1 1
M0002 2 1 2
S0004 3 2 5
S0003 1 1 8
S0002 10 11 12
S0101 100 200 100
The requirement is that for every fetch of the Main-Sub part pair from table1, details should be fetched from the table2. Since the Main-Sub part pair is a composite key in table1, details from Table2 should be fetched only once for a repeating Main part but as many times for the number of sub-parts. For example, although M0001 is repeated 3 times in table1, it's details should be fetched only once from table2 whereas for the sub-parts of M0001(S0001, S0002, S0003) details should be fetched from table2 for each sub-part.
I tried a query which first fetches the details for the main-part, and in the repeating frame I put formula columns(with appropriate select stmts) for sub-parts. This approach I feel could affect performance because select statement is fired as many times as the number of formula columns.
My report should look like this
============================================================
Part qty-in-store qty-in-prodn qty-rejected
============================================================
M0001 10 10 10
S0001 1 10 1
S0002 10 11 12
S0003 1 1 8
Total 22 32 31
M0002 2 1 2
S0004 3 2 5
S0101 100 200 100
Total 105 203 107
I would like your help to know if there is another way to code a query(or queries) in report builder which will help me solve this above requirement.
Also, is it possibe to do an Update operation on a Database Table from within a report, bcos the totals as shown above need to be updated to the table?
Thanks in advance for the help?
Regards,
AjayJohn,
I believe this is to create the column types in BIRT. Can you open a
bugzilla entry to look at this?
Jason
On 7/27/2010 10:45 AM, john mcteague wrote:
> I have resolved this by changing config.xml in oda-jdbc.jar to use
> policy 1 for the jConnect driver.
>
> Policy 2 executes the query with a maxrows of 1, gets the metadata then
> executes the query again with the desired number of rows.
> Does anyone know why jConnect was set to policy 2 in the first place? -
Select query for KONV and VBAK table
hy Experts.
Please Help me For this Query, i got error on it.
I wnt to take KONV-KBETR (RATE FIELD) for particular SO number. and i used following query but it gives error i cant relate VBAK & KONV table.
Please do needful
SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE VBAK-KNUMV = KONV-KNUMV AND VBAK-VBELN IN VBELN.
Thnks
Bhavesh Panchal.Hello Thnks For Reply,
but still i cant take solution. i am making a Sales order Rports. i got all field but i cant fetch filed for RATE and Pending Order Value.
Please check following Code. if need to change u can.
Thnks
Bhavesh Panchal.
REPORT ZTESTCODE.
TYPE-POOLS:slis.
TABLES: VBEP , VBAP , VBPA , VBKD , VBAK , LIKP , LIPS , VBUP , VBBE, KONV, KNA1.
DATA :BEGIN OF itab OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
EDATU LIKE VBEP-EDATU,
KNUMV LIKE VBAK-KNUMV,
WMENG LIKE VBEP-WMENG,
BMENG LIKE VBEP-BMENG,
LFIMG LIKE LIPS-LFIMG,
OMENG LIKE VBBE-OMENG,
POSAR LIKE VBAP-POSAR,
NETWR LIKE VBAP-NETWR,
NTGEW LIKE VBAP-NTGEW,
KBETR LIKE KOMV-KBETR,
KUNNR LIKE VBAK-KUNNR,
NAME1 LIKE KNA1-NAME1,
*BRGEW LIKE VBAP-BRGEW,
BSTKD LIKE VBKD-BSTKD,
BSTDK LIKE VBKD-BSTDK,
LFSTA LIKE VBUP-LFSTA,
*KNUMV LIKE VBAK-KNUMV,
*posnr LIKE LIPS-POSNR,
*NETWR LIKE VBAK-NETWR,
BRGEW LIKE VBAP-BRGEW,
LFDAT LIKE LIKP-LFDAT,
*NTGEW LIKE LIKP-NTGEW,
DELIVERY LIKE LIPS-VBELN,
WEIGHT like VBAP-NTGEW,
END OF itab.
*variable for Report ID
DATA: v_repid LIKE sy-repid .
*declaration for fieldcatalog
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: it_listheader TYPE slis_t_listheader.
declartion for layout
DATA: alv_layout TYPE slis_layout_alv.
*Title displayed when the alv list is displayed
*DATA: i_title_main TYPE lvc_title VALUE 'FIRST LIST DISPLAYED'.
DATA: i_title_main TYPE lvc_title VALUE 'Reports : Bhavesh Pacnhal'.
INITIALIZATION.
v_repid = sy-repid.
PERFORM build_fieldcatlog.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : VBELN FOR VBAK-VBELN ,
KUNNR FOR VBPA-KUNNR ,
EDATU for ITAB-EDATU.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_listheader USING it_listheader.
PERFORM display_alv_report.
FORM build_fieldcatlog.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'SalesOrderNo'.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field for Customer Name.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_m = 'Customer Name'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Po Number.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BSTKD'.
wa_fieldcat-seltext_m = 'PO No'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Order Value
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NETWR'.
wa_fieldcat-seltext_m = 'Order Value '.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Po Date.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BSTDK'.
wa_fieldcat-seltext_m = 'PO Date'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-seltext_m = 'Item No'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'EDATU'.
wa_fieldcat-seltext_m = 'Delivery Date'.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'VBAP'.
wa_fieldcat-fieldname = 'KWMENG'.
wa_fieldcat-seltext_m = 'Order QTY VABP.'.
wa_fieldcat-outputlen = '14'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Order Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'WMENG'.
wa_fieldcat-seltext_m = 'Ord.QT.WMEN.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Order Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BMENG'.
wa_fieldcat-seltext_m = 'Ord.QT.BMEN.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
field For Delivery Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'LFMING'.
wa_fieldcat-seltext_m = 'DEL QTY.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Open Qty from ITAB.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'OMENG'.
wa_fieldcat-seltext_m = 'OPEN QTY.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Pending Weight from ITAB.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BRGEW'.
wa_fieldcat-seltext_m = 'Pending Weight'.
wa_fieldcat-outputlen = '12'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For netweight.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NTGEW'.
wa_fieldcat-seltext_m = 'Net Weight'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Actual Delivery.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'LFDAT'.
wa_fieldcat-seltext_m = 'Actual Delivery'.
wa_fieldcat-outputlen = '12'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'KBETR'.
wa_fieldcat-seltext_m = 'RATE'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Actual Delivery.
wa_fieldcat-tabname = 'LIPS'.
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-seltext_m = 'Delivery ITEM'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Pending Value.
VBUP-LFSTA
wa_fieldcat-tabname = 'VBUP'.
wa_fieldcat-fieldname = 'LFSTA'.
wa_fieldcat-seltext_m = 'Pending Value'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For pending weight.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'ITAB-OMENG * KOMV-KBETR'.
wa_fieldcat-seltext_m = 'Pending VALUE'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "BUILD_FIELDCATLOG
FORM data_retrieval.
SELECT VBELN NETWR KUNNR FROM VBAK INTO (ITAB-VBELN,ITAB-NETWR,ITAB-KUNNR) WHERE VBELN IN VBELN .
SELECT POSNR POSAR BRGEW FROM VBAP INTO (ITAB-POSNR,ITAB-POSAR,ITAB-BRGEW) WHERE VBELN = ITAB-VBELN .
SELECT EDATU FROM VBEP INTO (ITAB-EDATU) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
SELECT NAME1 FROM KNA1 INTO (ITAB-NAME1) WHERE KUNNR = ITAB-KUNNR .
SELECT BSTKD BSTDK FROM VBKD INTO (ITAB-BSTKD,ITAB-BSTDK) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
SELECT VBELN LFIMG FROM LIPS INTO (ITAB-DELIVERY, ITAB-LFIMG) WHERE VGBEL = ITAB-VBELN AND VGPOS = ITAB-POSNR.
SELECT LFDAT NTGEW FROM LIKP INTO (ITAB-LFDAT,ITAB-NTGEW) WHERE VBELN = ITAB-DELIVERY .
SELECT WMENG BMENG FROM VBEP INTO (ITAB-WMENG,ITAB-BMENG) WHERE VBELN IN VBELN .
SELECT SINGLE OMENG FROM VBBE INTO (ITAB-OMENG) WHERE VBELN IN VBELN.
SELECT SINGLE NETWR FROM VBAK INTO (ITAB-NETWR) WHERE VBELN IN VBELN.
SELECT KNUMV FROM VBAK INTO (ITAB-KNUMV) WHERE VBELN IN VBELN.
*SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE KNUMV = VBAK-KNUMV.
*assign VAR1 = itab-kbetr.
*append itab.
*ENDSELECT.
SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV)WHERE KNUMV = VBAK-KNUMV.
ITAB-KBETR = KONV-KBETR.
ENDSELECT.
APPEND ITAB.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
*ENDSELECT.
ENDFORM. "data_retrieval
FORM build_listheader USING it_listheader TYPE slis_t_listheader.
DATA HLINE TYPE SLIS_LISTHEADER.
DATA: ls_line TYPE slis_listheader.
bhavesh
HLINE-INFO = 'report Developed by Bhavesh'.
HLINE-TYP = 'H'.
Header
Bhavesh
CLEAR ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Sales ORDER Report'.
APPEND ls_line TO it_listheader.
bhavesh
***Selection
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'SFEL'.
APPEND ls_line TO it_listheader.
ls_line-key = 'Key 2'.
ls_line-info = 'SFEL'.
APPEND ls_line TO it_listheader.
***Action
CLEAR ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Status list'.
APPEND ls_line TO it_listheader.
ENDFORM. "BUILD_LISTHEADER
*ENDFORM. "build_listheader
FORM display_alv_report.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = 'STATUS'(002)
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'SFEL SALES EXPEDITING REPORT'
i_background_id = 'ALV_BACKGROUND'
I_GRID_SETTINGS =
IS_LAYOUT = LAYO
IS_LAYOUT = ALV_LAYOUT
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader[].
i_logo = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE -
Select query for fields in selection screen
SELECT * FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat in date_ran.
and enddat in date_ran
How can I rewrite the above query for high and low ranges of date_ran field in condition? It doesn't allow in operator with date_ran-low.Can u please help me outHi
rahul
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat = date_ran-low
and enddat = date_ran -high.
u can write like this or i amnot getting why u r expliciting this date u can give directly as
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
date in date_ran.
plzz reward if i am usefull to u in any way.. plzz dont forget to reward -
Performance optimization on select query for all entries
Hi All,
I want to optimize the select query in my Program.
The select query is taking lot of time to search the records for the given condition in the where clause
and more interestingly there are no records fetched from the database as the where condition does not matches.
It is taking more than 30 min to search the record and the result is no record found.
Below is my select query. I have also created the secondary Index for the same.
In My opinion FOR ALL ENTRIES is taking lot of time. Because there are more than 1200 records in internal table t_ajot
select banfn bnfpo bsart txz01 matnr Werks lgort matkl reswk menge meins flief ekorg
INTO CORRESPONDING FIELDS OF TABLE t_req
FROM eban
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
Please suggest.Hi,
that,
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
looks strange.
However:
How does your index look like?
What executoin plan do you get?
How do the statistics look like?
Whats the content of the variables t_ajot-... and s_badata?
Kind regards,
Hermann -
Hi All,
Could you please help with a SELECT query to retrieve the following dates ...
sysdate - 1
sysdate,
sysdate + 1
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
Regards,
Jitesh Gurnani
Edited by: Jitesh Gurnani on May 22, 2012 2:53 AM>
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
>
select sysdate - level + 2
from dual
connect by level <= 3
order by 1Edited by: Paul Horth on 22-May-2012 02:59
Maybe you are looking for
-
Exchange rate in case of equity and dividend.
Hi experts, I required your help, please see below request and help. I have created a equity (stock) transaction in foreign currency using t.code - TS01 My purchase in USD ( for ex. 10000 USD). At the time of purchase i am able to put an exchange rat
-
Problem displaying fonts in Messages view box
Hi I am running JDeveloper9i and when i compile code everything that comes in the messages view box comes corrupted, can u please help. p.s It does work changing fonts in Tools->Preferences :(
-
Installing airport extreme into my Mac Pro
Hey everyone! I just bought a Refurbished AirPort Extreme Card Part Number: F8881LL/A from the apple store. Ive been searching around and there are no support documents on how to install in in my machine. Does anyone have any instruction on how to do
-
How to add user in administrator group of project server 2010 with powershell command ?
I want to add one user in Administrator group of Project Server . Please let me know how to do this through power shell command.
-
Cannot open Photoshop CC since downloading last week. BridgeCC an Lightroom 5 launch fine, bit PS CC give me error msg.: Could not initialize Photoshop because of a program error." Any ideas?