Hellp needed urgent in modifying the query
my requriment is as follows.
the data looks like as follows - 3 columns
sheet_id sequence_no rap_no
1 2
1 4
1 5
1 1
2 4
2 6
2 7
3 8
3 10
4 3
4 7
and the max of seqno should be updated on rap_no.
is the group by clause not neededin the following query .
In tht case how to modify the foll query.
update t3756_cue_sheet_music a set a.c3756_rap_sequence_no=
(select max(to_number(c3756_sequence_no))
FROM t3756_cue_sheet_music b
where a.c3756_cue_sheet_id = b.c3756_cue_sheet_id)
WHERE c3756_rap_sequence_no is NULL;
Thanks in advance.
Do reply
Can you be a little more clear?
create table t
(sheet_id number
,sequence_no number
,rap_no number);
alter table t add constraint tpk primary key (sheet_id, sequence_no);
insert into t (sheet_id, sequence_no) values (1, 2);
insert into t (sheet_id, sequence_no) values (1, 4);
insert into t (sheet_id, sequence_no) values (1, 5);
insert into t (sheet_id, sequence_no) values (1, 1);
insert into t (sheet_id, sequence_no) values (2, 4);
insert into t (sheet_id, sequence_no) values (2, 6);
insert into t (sheet_id, sequence_no) values (2, 7);
insert into t (sheet_id, sequence_no) values (3, 8);
insert into t (sheet_id, sequence_no) values (3, 10);
insert into t (sheet_id, sequence_no) values (4, 3);
insert into t (sheet_id, sequence_no) values (4, 7);
update t a
set a.rap_no=
(select max(to_number(sequence_no))
FROM t b
where a.sheet_id = b.sheet_id)
WHERE rap_no is NULL;
select *
from t;
SHEET_ID SEQUENCE_NO RAP_NO
1 2 5
1 4 5
1 5 5
1 1 5
2 4 7
2 6 7
2 7 7
3 8 10
3 10 10
4 3 7
4 7 7Doesn't this give you the correct results?
Similar Messages
-
Need urgent help with the query - Beginer
Hello - I need help with a query to populate data in a table.Here is the scenario.
Source1
MnthID BranchCod CustID SegCode FXStatus ProfStatus Profit
200712 B1 C1 20 Y Y 100
Source2
MnthID BranchCod CustID ProdCode ProdIndex
200712 B1 C1 12 1
200712 B1 C2 12 0
Destination
MnthID BranchCod SegCode ProdCode CountSegCust CountProdCust ProfitProdCust
Condition and Calculations:
1)Source1 customer are base customers.If Source2 has customers who is not in source1 then that customer's record should not be fetched.
2)SegCode, FX Status, ProfStatus is one variable in destination table. [ SegCode = SegCode+ FXStatus (if FXStatus = Y)+ ProfStatus (if FXStatus = Y) ]
3)CountSegCust = CountCustID Groupby MnthID,BranchCod,SegCode Only.
4)CountProdCust = CountCustID Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
5)ProfitProdCust = Sum of Profit of Customers Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
Apologies for bad formatting.
Thanks in advance!!A total guess indeed.
It's not clear whether some aggregation can be done (summing counts of grouped data might cause some customers being counted more than once)
insert into destination
select mnthid,branchcod,segcode,prodcode,countsegcust,countprodcust,profitprodcust
from (select s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end segcode,
s2.prodcode,
count(s1.custid) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
order by null
) countsegcust,
count(case proindex when 1
then custid
end
) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) countprodcust,
sum(case proindex when 1
then profit
end
) over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) profitprodcust,
row_number() over (partition by s1.mnthid,
s1.branchcod,
s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
s2.prodcode
order by null
) the_row
from source1 s1,source2 s2
where s1.mnthid = s2.mnthid
and s1.branchcod = s2.branchcod
and s1.custid = s2.custid
where the_row = 1Regards
Etbin -
VO Extension Error in modifying the query of XML Publisher Report Template
Hi Friends,
I have one requirement related to calling XML Publisher Reports Template from OAF Page.
When clicking on the submit button the XML Publisher template is calling and displaying the data.
Our requirement is to display some more columns in the XML Publisher Template and display the data.
As according to OAF stndards,whenever we need to add new columns for display or SELECT purpose,
we will do the VO Extension. So we modified the query by adding the new additional colums in the standard VO.
I am able to retrieve the data from the SQL DEVELOPER. But when doing the VO Extension process and
calling the template from the OAF page its throwing the following error.Please suggest me some alternatives
to fix the issue.
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT
DECODE(ASO_QUOTES.RESOURCE_ID, null, sales.name, sales1.name) sales_rep_name,
aso_quotes.quote_name,
aso_quotes.contract_id,
aso_quotes.quote_number||decode(aso_quotes.quote_version,NULL,'',' - ') || aso_quotes.quote_version quote_name_version,
to_char(aso_quotes.quote_expiration_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) quote_expiration_date,
TO_NUMBER(TO_CHAR(aso_quotes.quote_expiration_date,'J')) - TO_NUMBER(TO_CHAR(Sysdate,'J')) duration,
I_HEADER_CONTACT_PARTY.PARTY_NAME sold_to_contact_name,
I_CUST_PARTIES.party_name customer_name,
I_PHONE.PHONE_AREA_CODE || DECODE(I_PHONE.PHONE_AREA_CODE , NULL, '',' ' ) || I_PHONE.PHONE_NUMBER full_phone_number,
I_INVOICE_REL_PARTY.PARTY_NAME invoice_to_contact_name,
I_ACCTS_INV_PARTY.PARTY_NAME invoice_to_cust_party_name,
I_INVOICE_LOCATIONS.ADDRESS1 invoice_to_address1,
I_INVOICE_LOCATIONS.ADDRESS2 invoice_to_address2,
I_INVOICE_LOCATIONS.ADDRESS3 invoice_to_address3,
I_INVOICE_LOCATIONS.ADDRESS4 invoice_to_address4,
decode(I_INVOICE_LOCATIONS.city, null,'',I_INVOICE_LOCATIONS.city || decode(I_INVOICE_LOCATIONS.county,null,'',',' || I_INVOICE_LOCATIONS.county)) invoice_to_city,
I_INVOICE_LOCATIONS.state || decode(I_INVOICE_LOCATIONS.postal_code, null,'',' '||
I_INVOICE_LOCATIONS.postal_code || decode(I_INVOICE_LOCATIONS.province,null,'',',' ||I_INVOICE_LOCATIONS.province )) invoice_to_county,
I_INVOICE_LOCATIONS.country invoice_to_country,
aso_quotes.currency_code Currency_Code,
(select distinct ppf.email_address
from per_people_f ppf,
JTF_RS_SALESREPS jrs
where jrs.resource_id = aso_quotes.resource_id
and jrs.PERSON_ID = ppf.person_id
and ppf.person_type_id = 3
) Sales_Rep_Email,
aso_quotes.quote_header_id, oav.name||decode(oav.agreement_num,NULL,'',',')||oav.agreement_num||decode(oav.agreement_num,NULL,'',',')||oav.revision Agreement_name,
oav.name||oav.agreement_num||oav.revision Agreement_check,
to_char(oav.revision_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) revision_date,
(select payment_term_name
FROM
aso_payments_v
WHERE
quote_line_id is null and
quote_header_id = aso_quotes.quote_header_id) payment_terms,
to_char(sysdate, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) curr_date,
aso_quotes.total_list_price total_list_price,
aso_quotes.total_adjusted_amount total_adjusted_amount,
(aso_quotes.total_list_price + aso_quotes.total_adjusted_amount) total_net_price,
aso_quotes.total_shipping_charge charges_total,
aso_quotes.total_tax taxes_total,
aso_quotes.total_quote_price total_quote_price,
(select cust_po_number
FROM
aso_payments
WHERE
quote_line_id is null and
quote_header_id = aso_quotes.quote_header_id ) cust_po_number,
(select fct.name
from fnd_currencies_tl fct
where aso_quotes.currency_code = fct.currency_code
and fct.language = userenv('lang')) Currency_Name,
(select fcurr.symbol
from fnd_currencies fcurr
where aso_quotes.currency_code = fcurr.currency_code) Currency_Symbol,
(Select meaning
From oe_lookups
Where lookup_type = 'FREIGHT_TERMS'
And lookup_code = (select aship.freight_terms_code
from aso_shipments aship
where aship.quote_header_id = aso_quotes.quote_header_id
and aship.quote_line_id is null)) Freight_Terms,
(Select fl.meaning
From fnd_lookup_values fl
where fl.lookup_type = 'SHIP_METHOD'
And fl.lookup_code = (select aship.ship_method_code
from aso_shipments aship
where aship.quote_header_id = aso_quotes.quote_header_id
and aship.quote_line_id is null)
And fl.language = userenv('LANG')) shipping_method ,
aso_quotes.org_id ,
aso_quotes.quote_number ,
aso_quotes.Quote_version VersionNumber,
I_ACCTS.ACCOUNT_NUMBER CustomerNumber,
oav.agreement_num Agreement_Number,
:action action,
aso_quotes.minisite_id minisite_id,
(select imt.msite_name from ibe_msites_tl imt where imt.msite_id = aso_quotes.minisite_id
and imt.language = userenv('LANG')) msite_name,
(select asl.meaning from oe_lookups asl, aso_shipments ash
where asl.lookup_type = 'SHIPMENT_PRIORITY'
and asl.lookup_code = ash.shipment_priority_code
and ash.quote_header_id = aso_quotes.quote_header_id) shipment_priority_name
,(select OE_SYS_PARAMETERS.VALUE('INSTALLMENT_OPTIONS',aso_quotes.org_id) from dual) enable_pay_now
from
hz_CONTACT_POINTS I_PHONE ,
HZ_RELATIONSHIPS I_HEADER_CONTACT_REL,
HZ_PARTIES I_HEADER_CONTACT_PARTY,
ASO_QUOTE_HEADERS ASO_QUOTES,
HZ_RELATIONSHIPS I_INVOICE_REL,
HZ_PARTIES I_INVOICE_REL_PARTY,
HZ_PARTY_sites I_INVOICE_PARTY_SITES,
HZ_LOCATIONS I_INVOICE_LOCATIONS,
HZ_PARTIES I_CUST_PARTIES,
HZ_CUST_ACCOUNTS I_ACCTS,
HZ_CUST_ACCOUNTS I_ACCTS_INV,
HZ_PARTIES I_ACCTS_INV_PARTY,
JTF_RS_SALESREPS_MO_V SALES,
JTF_RS_SALESREPS_MO_V SALES1,
FND_TERRITORIES_VL I_TERRITORIES,
oe_agreements_vl oav
where
ASO_QUOTES.PARTY_ID = I_HEADER_CONTACT_REL.PARTY_ID(+)
AND I_HEADER_CONTACT_REL.SUBJECT_ID = I_HEADER_CONTACT_PARTY.PARTY_ID(+)
AND I_HEADER_CONTACT_REL.SUBJECT_TYPE(+) = 'PERSON'
AND I_HEADER_CONTACT_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
and i_header_contact_rel.object_id(+) = aso_quotes.cust_party_id
AND ASO_QUOTES .INVOICE_TO_PARTY_SITE_ID = I_INVOICE_PARTY_SITES.PARTY_SITE_ID (+)
AND I_INVOICE_PARTY_SITES.LOCATION_ID = I_INVOICE_LOCATIONS.LOCATION_ID(+)
AND I_INVOICE_LOCATIONS.country = I_TERRITORIES.territory_code(+)
AND ASO_QUOTES.INVOICE_TO_PARTY_ID = I_INVOICE_REL.PARTY_ID(+)
AND I_INVOICE_REL.SUBJECT_ID = I_INVOICE_REL_PARTY.PARTY_ID(+)
AND I_INVOICE_REL.SUBJECT_TYPE(+) = 'PERSON'
AND I_INVOICE_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
AND i_invoice_rel.object_id (+) = aso_quotes.invoice_to_cust_party_id
AND ASO_QUOTES.ORG_ID = SALES.ORG_ID(+)
AND ASO_QUOTES.EMPLOYEE_PERSON_ID = SALES.PERSON_ID (+)
AND ASO_QUOTES.ORG_ID = SALES1.ORG_ID (+)
AND ASO_QUOTES.RESOURCE_ID = SALES1.RESOURCE_ID (+)
AND ASO_QUOTES.CUST_ACCOUNT_ID =I_ACCTS.CUST_ACCOUNT_ID(+)
AND ASO_QUOTES.CUST_PARTY_ID = I_CUST_PARTIES.PARTY_ID
AND ASO_QUOTES.INVOICE_TO_CUST_ACCOUNT_ID = I_ACCTS_INV.CUST_ACCOUNT_ID(+)
AND ASO_QUOTES.INVOICE_TO_CUST_PARTY_ID = I_ACCTS_INV_PARTY.PARTY_ID(+)
AND aso_quotes.phone_id = i_phone.contact_point_Id(+)
AND oav.agreement_id(+) = aso_quotes.contract_id
AND aso_quotes.quote_header_id = 666584
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:886)
at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:1009)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
at OA.jspService(_OA.java:212)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
at OA.jspService(_OA.java:221)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
## Detail 0 ##
java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
at OA.jspService(_OA.java:212)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
at OA.jspService(_OA.java:221)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
at OA.jspService(_OA.java:212)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
at OA.jspService(_OA.java:221)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)"java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL"
Try the suggestions in this? https://kr.forums.oracle.com/forums/thread.jspa?messageID=10253362
Check the bindign styles and bind variables.. -
Need to install only the query for fi account receivables standard data ?
Hi all,
I need to insall only the query for the standard business content for fi_ar in bw 3.5 ?
i have selected the cube and then in grouping i have selected data flow afterwards only.
And i have selected the queries only. but the cube is selected again. Should i uncheck the cube and install only the queries and transport it?
Pls guide me on this!!
Thanks
PoojaHi,
If the required cube is already avaialble and continue with the existing design, you can uncheck the cube and install only queries. Check all the prerequisites before installing queries like used infoobjects, other targets if any.
Hope this helps,
Regards,
Rama Murthy. -
Hi All,
I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
Thanks in Advance886755 wrote:
Hi All,
I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
Thanks in Advancemodify it how to do what?
SELECT Nvl(MIN(p_lay), 0),
Nvl(MIN(tid), 0),
Nvl(MIN(ttime), 0),
Nvl(MIN(tsource), 0)
FROM (SELECT p_lay,
tid,
ttime,
tsource
FROM (SELECT ( CASE
WHEN t1.internal_type = 3 THEN -1
ELSE t_report.Get_lay(t1.eve_id, t1.eve_time, :B4)
END ) p_lay,
t1.eve_id tid,
t1.eve_time ttime,
t1.ala_source_id tsource
FROM t_eve_log t1,
t_eve_log t2
WHERE t1.ala_id = t2.root_ala_id
AND t2.eve_time >= :B3
AND t2.eve_time < :B2
AND t2.ala_id = :B1
AND t2.act_id IN ( 2, 5 ))
ORDER BY p_lay)
WHERE ROWNUM = 1 -
Is ther any otherway i can modify the below query to create emp_target to get the expected result below at the end
CREATE EMP_TARGET as
SELECT emp.empno,emp.ename, emp.deptNO,dept.dname,EMP.mod_time,dept.mod_time FROM
(SELECT * FROM EMP WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY'))emp
left join
(select * from dept WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY') ) dept
on
emp.DEPTNO=dept.DEPTNO
CREATE TABLE EMP
EMPNO INT NOT NULL ,
ENAME VARCHAR(10) ,
JOB VARCHAR(9) ,
MGR INT ,
SAL NUMERIC(7,2) ,
DEPTNO INT,
mod_time date
CREATE TABLE DEPT
DEPTNO INT,
DNAME VARCHAR(14),
LOC VARCHAR(13) ,
mod_time date
INSERT INTO emp VALUES
(7369, 'SMITH', 'CLERK', 7902, 800, 20,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7499, 'ALLEN', 'SALESMAN', 7698, 1600, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7521, 'WARD', 'SALESMAN', 7698, 1250, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7566, 'JONES', 'MANAGER', 7839, 2975, 20,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7654, 'MARTIN', 'SALESMAN', 7698, 1250, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7698, 'BLAKE', 'MANAGER', 7839, 2850, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7782, 'CLARK', 'MANAGER', 7839, 2450, 10,to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7788, 'SCOTT', 'ANALYST', 7566, 3000, 20,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7839, 'KING', 'PRESIDENT', NULL, 5000, 10,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7844, 'TURNER', 'SALESMAN', 7698, 1500, 30,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7876, 'ADAMS', 'CLERK', 7788, 1100, 20,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7900, 'JAMES', 'CLERK', 7698, 950, 30,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7902, 'FORD', 'ANALYST', 7566, 3000, 60,to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO EMP VALUES
(7934, 'MILLER', 'CLERK', 7782, 1300, 10,to_DATE('01-SEP-2012','DD-MON-YYYY'));
SELECT * FROM EMP
INSERT INTO DEPT
VALUES (10, 'ACCOUNTING', 'NEW YORK',to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO DEPT
VALUES (20, 'RESEARCH', 'DALLAS',to_DATE('31-JUL-2012','DD-MON-YYYY'));
INSERT INTO DEPT
VALUES (30, 'SALES', 'CHICAGO',to_DATE('01-SEP-2012','DD-MON-YYYY'));
INSERT INTO DEPT
VALUES (40, 'OPERATIONS', 'BOSTON',to_DATE('01-SEP-2012','DD-MON-YYYY'));
SELECT * FROM DEPT
CREATE EMP_TARGET as
SELECT emp.empno,emp.ename, emp.deptNO,dept.dname,EMP.mod_time,dept.mod_time FROM
(SELECT * FROM EMP WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY'))emp
left join
(select * from dept WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY') ) dept
on
emp.DEPTNO=dept.DEPTNO
Emp_target expected result
empno ename deptno dname emp_mod_time dept_mod_time
7782 CLARK 10 ACCOUNTING 31-JUL-12 31-JUL-12
7566 JONES 20 RESEARCH 31-JUL-12 31-JUL-12
7369 SMITH 20 RESEARCH 31-JUL-12 31-JUL-12
7698 BLAKE 30 31-JUL-12
7654 MARTIN 30 31-JUL-12
7521 WARD 30 31-JUL-12
7499 ALLEN 30 31-JUL-12 Edited by: choti on Jan 8, 2013 10:20 AMHi,
choti wrote:
CREATE TABLE EMP
EMPNO INT NOT NULL ,
ENAME VARCHAR(10) ,
JOB VARCHAR(9) ,
MGR INT ,
SAL NUMERIC(7,2) ,
DEPTNO INT,
mod_time date
Thanks for posting the CREATE TABLE and INSERT statements.
Remember why you need to go to all that trouble: so the people who want to help you can re-create the problem and test their ideas. If you post statements that don't work, then people can't use them. Please test (and, if necessary, correct) your statements before you post them.
There is no NUMERIC datatype in Oracle SQL. I think you meant the datatype of sal to be NUMBER.
Here's one way to create the emp_target table:
CREATE TABLE emp_target
AS
SELECT e.empno
, e.ename
, e.deptno
, d.dname
, e.mod_time AS emp_mod_time
, d.mod_time AS dept_mod_time
FROM emp e
LEFT OUTER JOIN dept d ON d.deptno = e.deptno
AND d.mod_time <= TO_DATE ('31-JUL-2012','DD-MON-YYYY')
WHERE e.mod_time <= TO_DATE ('31-JUL-2012','DD-MON-YYYY')
; -
How to modify the query to get max id record
Hi All,
How to modify below query to get proper result.The query is returning some records are duplicated.I need only one record to display from duplicate based on max assetid.
Here is my query:
SELECT *
FROM (
SELECT a.uppertitle, a.composer, a.esongid,
MAX (asset_new.assetid) AS assetid,asset_new.ownerid
FROM (SELECT DISTINCT NVL (esong.title, '~') AS uppertitle,
INITCAP (NVL (esong.composer, '~')
) AS composer,
esong.esongid
FROM esong, esongcountry_us eus
WHERE 1 = 1
AND eus.esongid = esong.esongid
AND eus.isocountrycode IN ('US')
AND esong.title LIKE 'LIVE TO TELL%'
AND ROWNUM < 390) a,
songwebrecording,
recordingasset_new,
asset_new
WHERE a.esongid = songwebrecording.esongid(+)
AND songwebrecording.recordingid = recordingasset_new.recordingid(+)
AND recordingasset_new.assetid = asset_new.assetid(+)
GROUP BY a.uppertitle, a.composer, a.esongid,asset_new.ownerid)
WHERE ROWNUM <= 390
ORDER BY uppertitle
result:
upperlittle composer esongid assetid onwerid
1. LIVE TO TELL Gelb, Howe 480340000 null null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 null null
3. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
4. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3038107 null
5. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
I need the result like this :
upperlittle composer esongid assetid onwerid
1. LIVE TO TELL Gelb, Howe 480340000 null null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
3. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
Please help me on this regard. oracle version is 9i
Regards,
Rajasekharcan you please format your code with
-
Can i modify the query in discoverer
Hi
I am working on discoverer vierwer, is it possible to change the query and run the query myself. I can access the query but i can't make any changes.
The problem i am having is i want to show the sum of a variable but not show the count, is this possible ?
any help would be appreciated
thanks
nimeshHi Nimesh
Presumably the workbook you are referring to is not owned by you and has only been shared with you? In this case, while you can make changes to the query while it is in memory, providing you have the necessary privileges that is, you will not be able to save over the original. This is because only the owner can do this and you are not the owner.
What you can do though is to use Save As and save ourself a variant of the report. Of course this opens up another spoke in the wheel of reinvented queries, something that most organizations would like to avoid.
Therefore, perhaps the best option would be to contact the owner of the workbook and request that it be modified for your needs.
I hope this helps
Best wishes
Michael Armstrong-Smith
URL: http://learndiscoverer.com
Blog: http://learndiscoverer.blogspot.com -
Need help in modifying the column length
Hi Experts,
I need to modify the length of a column from char(10) to char(5), but it's showing the error of:
ALTER TABLE appr_group_table MODIFY (APPR_TBLNO CHAR(5)) It's showing the below error:
ERROR at line 1:
ORA-01441: cannot decrease column length because some value is too bigI've checked in the dbase but there is no any value of this column having more than 5 characters:
SQL> SELECT APPR_TBLNO FROM appr_group_table;
APPR_TBLNO
ANTAB
ANTAB
ANTST
SCCTR
SOTAB
SOTAB
SOTAB
SOTAB
SOTAB
SOTAB
SOTAB
11 rows selected.Thnx in advance for helping me out.....char means fixed length variable. when you say char(10) oracle will reserve 10 places for your data. that means in your output what you are seeing as blank spaces are also considered as data. that is the reason, it is not allowing you to reduce the size.
better solution is to create new column with varchar2 or char(5) datatype and transfer this column data into new column and then drop original column. -
Need help in refining the query
Hello Experts,
Need your help in refining the query further more.
table structure
Mskey Col A Col B
1 empno [20141127-20151128]1234
1 empno [20151201-99991231]232544
1 salutation [20141127-99991231]Mrs
1 salutation [20151127-99991231]Mr
2 empno [20141127-20151128]1234
2 empno [20151201-99991231]232544
2 salutation [20141127-99991231]Mrs
2 salutation [20151127-99991231]Mr
My requirement is to find the list of overlapping records based on the dates
user details may be varying from time to time as new data would be pushed through HR systems to identity store via an interface.
The job is getting failed whenever there is any overlapping with dates. So we proactively decided to schedule a job in this regards which runs weekly and would let us know for which and all the users there is overlapping dates are there, so that we can send the list to HR team for pushing new data.
Overlapping Issue Example:
The users employee id for an year it is 1234 and later he moved to another department and his employee id got changed and it became 2345 remaining all details are same. So the HR systems send the data for this user as empno - [20141127-20151128]1234 and empno - [20151201-99991231]232544
it means from 20141127 to 20151128 his employee no is 1234 and from 20151201 to 99991231 his employee would be 2345.
This is a correct case and the tool would accept this data.
the below cases are invald
Case 1: 1 salutation [20141127-99991231]Mrs 1 salutation [20151127-99991231]Mr
Case 2: 2 salutation [20141127-99991231]Mrs 2 salutation [20141127-99991231]Mr
So we wanted to find these overlapping records from tables.
My Query:
I am able to successfully write query for the case 2 type but unable to write for case1.
select id,colA
count(left(ColB,CHARINDEX(']',ColB))) as 'Count'
from tblA with (nolock)
where id in (Select distinct id from tblb with (nolock))
group by id, cola,left(ColB,CHARINDEX(']',ColB))
having count(left(ColB,CHARINDEX(']',ColB)))>1Finally got the required answer with the below query
WITH Cte AS
SELECT ID,ColA,ColB,ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS RN,
CAST(SUBSTRING(ColB,2,CHARINDEX('-',ColB)-2) AS DATE) AS StartDT,
CAST(SUBSTRING(ColB,CHARINDEX('-',ColB)+1,8) AS DATE) AS EndDT FROM TblA
SELECT c1.ID, c1.ColA,c1.ColB
FROM Cte c1 JOIN Cte c2
ON c1.RN != c2.RN
AND c1.ID=c2.ID
AND c1.ColA=c2.ColA
AND (c1.StartDT BETWEEN c2.StartDT AND c2.EndDT OR c2.StartDT BETWEEN c1.StartDT AND c1.EndDT ) -
I need urgent help for the logic
hi all,
Initially, the requirement was to create PO regardless the Purchase Requisition based on the formula
If (Open Qty + Current Stock) < Safety Stock ==>> THEN A PO NEEDS TO BE CREATED
This is absolutely fine, this created the PO as per the above condition.
OUR REQUIREMENT
Modify the same program to create PO's only if there is any PR for that material . Meaning, turn all the PR's into PO. Also, when creating PO, the delivery date should be = (Current date - 7 days) when creating a PO for an PR(I think the table name is VETVG.) Nothing else. We need to change the IF condition in the following code .
so can any one let me that what modification i need to do ie what logic i should use to get the requirement fullfilled.
*Report Z_STO_SAFETY_STOCK *
Program Name : Z_STO_SAFETY_STOCK *
Date : 09.03.2007 *
Programmer : Rajdeep Kumar
Last Change : Van Tran 22/03/2007 *
Specification: *
Program Type : Report *
Description : Create STO requirement for Plant
Transaction : None *
Input Files : None *
Output Files : None *
Scheduling Issues : *
Run Frequency : *
Mod# Date By Description *
New 09.03.2007 Rajdeep Kumar Created *
DEVK905890 *
M01 20.03.2007 Rajdeep Kumar Material Group Added to *
DEVK905892 Selection Screen *
*Update 05.04.2007 DEVK906082 Added two new selection *
fields beskz and sobsl *
and is select statement *
REPORT z_sto_safety_stock NO STANDARD PAGE HEADING.
*& TABLES
TABLES:
t001w,
marc. " M01
marc, " M01
mara. " M01
*& DATA DECLARATION
DATA: BEGIN OF it_marc OCCURS 0,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
eisbe LIKE marc-eisbe,
bstmi LIKE marc-bstmi,
bstrf LIKE marc-bstrf,
beskz LIKE marc-beskz,
sobsl LIKE marc-sobsl,
END OF it_marc.
DATA: BEGIN OF it_mard OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
labst LIKE mard-labst,
END OF it_mard.
DATA: BEGIN OF it_po OCCURS 0,
ebeln LIKE ekko-ebeln,
werks LIKE ekpo-werks,
ebelp LIKE ekpo-ebelp,
loekz LIKE ekpo-loekz,
etenr LIKE eket-etenr,
matnr LIKE ekpo-matnr,
menge LIKE eket-menge,
wemng LIKE eket-wemng,
END OF it_po.
DATA: BEGIN OF it_po_2 OCCURS 0,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
loekz LIKE ekpo-loekz,
etenr LIKE eket-etenr,
menge LIKE eket-menge,
wemng LIKE eket-wemng,
END OF it_po_2.
DATA: BEGIN OF it_po_pend OCCURS 0,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
pendi LIKE eket-menge,
END OF it_po_pend.
DATA: BEGIN OF wa_join OCCURS 0,
ebeln LIKE ekko-ebeln,
werks LIKE ekpo-werks,
ebelp LIKE ekpo-ebelp,
loekz LIKE ekpo-loekz,
etenr LIKE eket-etenr,
matnr LIKE ekpo-matnr,
menge LIKE eket-menge,
wemng LIKE eket-wemng,
END OF wa_join.
DATA : BEGIN OF itab_marc_mard OCCURS 0,
werks LIKE marc-werks,
matnr LIKE marc-matnr,
eisbe LIKE marc-eisbe,
bstmi LIKE marc-bstmi,
bstrf LIKE marc-bstrf,
beskz LIKE marc-beskz,
sobsl LIKE marc-sobsl,
labst LIKE mard-labst,
menge LIKE ekpo-menge,
ordqty LIKE ekpo-menge,
END OF itab_marc_mard.
DATA: BEGIN OF it_sto OCCURS 0,
werks LIKE mard-werks,
matnr LIKE mard-matnr,
orqty LIKE ekpo-menge,
eisbe LIKE marc-eisbe,
bstmi LIKE marc-bstmi,
bstrf LIKE marc-bstrf,
beskz LIKE marc-beskz,
sobsl LIKE marc-sobsl,
labst LIKE mard-labst,
pendi LIKE eket-menge,
END OF it_sto.
DATA: ws_poheader LIKE bapimepoheader.
DATA: ws_poheaderx LIKE bapimepoheaderx .
DATA: ws_ebeln TYPE mepoheader-ebeln.
DATA: ws_posnr LIKE ekpo-ebelp.
DATA: ws_etenr LIKE eket-etenr VALUE '0001'.
DATA: ws_purchaseorder LIKE ekko-ebeln.
DATA: ws_flg1 TYPE c. " VALUE 'X'.
DATA: ws_flg2 TYPE c.
DATA: ws_flg3 TYPE c.
*-- For Handling Error Messages in BAPI
DATA: tbl_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
*-- For Item Details
DATA: tbl_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: tbl_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: tbl_posched LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
DATA: tbl_poschedx LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
*& CONSTANTS
CONSTANTS: ws_flg TYPE c VALUE 'X'.
CONSTANTS: c_unistruct(2) TYPE c VALUE 'Z3'. "For UNISTRUCT STO
*& SELECTION-SCREEN
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks FOR t001w-werks,
s_matnr FOR marc-matnr. " M01
s_matnr FOR marc-matnr, " M01
s_matkl FOR mara-matkl, " M01
s_beskz FOR marc-beskz,
s_sobsl FOR marc-sobsl.
PARAMETERS: p_test TYPE check.
SELECTION-SCREEN : END OF BLOCK b1.
*& START OF SELECTION EVENT
START-OF-SELECTION.
Get the Safety Stock & Minimum Lot Size for the materials
PERFORM get_plant_data.
Get the Quantities in stock
PERFORM get_stock_data.
Determine the open quantities for the materials concerned
[EKKO, EKET, EKPO]
PERFORM get_open_quantities.
PERFORM open_quantities.
Determine overall the quantities required for each material
PERFORM determine_mat_qty_required.
Print the details
PERFORM print_details.
IF p_test EQ space.
PO is created for each plant.
Create the PO required.
PERFORM create_po.
Create the PO's for each plant with the materials required
PERFORM create_header_item.
Bapi call to create a Purchase order
PERFORM create_purhase_order.
ENDIF.
END-OF-SELECTION.
TOP-OF-PAGE.
PERFORM print_header.
*& Form get_plant_data
To get the Safety Stock
--> p1 text
<-- p2 text
FORM get_plant_data .
start " M01
SELECT matnr werks eisbe bstmi
INTO TABLE it_marc
FROM marc
WHERE matnr IN s_matnr AND
werks IN s_werks AND
eisbe GT 0.
end " M01
start " M01
SELECT marc~matnr werks eisbe bstrf beskz sobsl
" bstmi
INTO TABLE it_marc
FROM marc AS marc
INNER JOIN mara AS mara
ON maramatnr EQ marcmatnr
WHERE marc~matnr IN s_matnr AND
werks IN s_werks AND
matkl IN s_matkl AND
beskz IN s_beskz AND
sobsl IN s_sobsl AND
eisbe GT 0.
end " M01
ENDFORM. " get_plant_data
*& Form get_stock_data
To get the Current Stock
--> p1 text
<-- p2 text
FORM get_stock_data .
DATA: BEGIN OF lt_mard OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
END OF lt_mard.
CHECK NOT it_marc[] IS INITIAL.
SELECT matnr werks lgort labst
INTO TABLE lt_mard
FROM mard
FOR ALL ENTRIES IN it_marc
WHERE matnr EQ it_marc-matnr AND
werks EQ it_marc-werks.
SORT lt_mard BY matnr werks.
LOOP AT lt_mard.
AT NEW werks.
it_mard-matnr = lt_mard-matnr.
it_mard-werks = lt_mard-werks.
ENDAT.
it_mard-labst = it_mard-labst + lt_mard-labst.
AT END OF werks.
APPEND it_mard.
CLEAR it_mard.
ENDAT.
ENDLOOP.
ENDFORM. " get_stock_data
*& Form open_quantities
text
--> p1 text
<-- p2 text
FORM open_quantities .
Storing MARC and MARD data in an internal table to find the open
quantities
LOOP AT it_marc.
itab_marc_mard-matnr = it_marc-matnr.
itab_marc_mard-werks = it_marc-werks.
itab_marc_mard-eisbe = it_marc-eisbe.
itab_marc_mard-bstmi = it_marc-bstmi.
itab_marc_mard-bstrf = it_marc-bstrf.
itab_marc_mard-beskz = it_marc-beskz.
itab_marc_mard-sobsl = it_marc-sobsl.
READ TABLE it_mard WITH KEY matnr = it_marc-matnr.
IF sy-subrc EQ 0.
itab_marc_mard-labst = it_mard-labst.
ENDIF.
APPEND itab_marc_mard.
CLEAR itab_marc_mard.
ENDLOOP.
CHECK NOT itab_marc_mard[] IS INITIAL.
Join EKKO EKPO
SELECT a~ebeln
b~ebelp
b~werks
b~matnr
b~menge
c~etenr
c~wamng
INTO CORRESPONDING FIELDS OF TABLE it_po
FROM ekpo AS b
INNER JOIN ekko AS a
ON aebeln = bebeln
INNER JOIN eket AS c
ON bebeln = cebeln AND bebelp = cebelp
FOR ALL ENTRIES IN itab_marc_mard
WHERE b~matnr = itab_marc_mard-matnr AND
b~werks IN s_werks .
DATA : t_menge TYPE ekpo-menge . "local variable
*Store the contents of it_po to the work area to get the minimum order
*quantity
wa_join[] = it_po[].
LOOP AT it_po.
delete the entries where MENGE = WAMNG
DELETE it_po WHERE menge = it_po-wemng.
LOOP AT wa_join WHERE matnr = it_po-matnr
AND werks = it_po-werks.
t_menge = t_menge + wa_join-menge.
ENDLOOP.
it_po-menge = t_menge.
MODIFY TABLE it_po TRANSPORTING menge.
CLEAR :t_menge.
ENDLOOP.
Once you get the quantities delete the repeating materials for the
plant.
DELETE ADJACENT DUPLICATES FROM it_po COMPARING werks matnr.
SORT it_po BY matnr.
LOOP AT itab_marc_mard.
READ TABLE it_po WITH KEY matnr = itab_marc_mard-matnr
APPEND it_sto.
ELSE.
WRITE:/ 'There are no open quantities to create Purchase order'.
ENDIF.
CLEAR it_sto.
ENDLOOP. werks = itab_marc_mard-werks BINARY
SEARCH.
itab_marc_mard-ordqty = itab_marc_mard-labst + it_po-menge .
If Open quantiy + Current Stock < Safety Stock
IF itab_marc_mard-ordqty LE itab_marc_mard-eisbe.
Minimum order qty = Safety Stock - (Open qty + current stock)
itab_marc_mard-ordqty = itab_marc_mard-eisbe - ( it_po-menge +
itab_marc_mard-labst ) .
Move all the contents to the internal table it_sto ie Plant,
Material and the Min Order Qty
so that we can create PO based on this internal table
it_sto-matnr = itab_marc_mard-matnr.
it_sto-werks = itab_marc_mard-werks.
it_sto-orqty = itab_marc_mard-ordqty.
ENDFORM. " open_quantities
*& Form CREATE_HEADER_ITEM
text
FORM create_header_item.
LOOP AT it_sto.
*--- Document date with flag
ws_poheader-doc_date = sy-datum.
ws_poheaderx-doc_date = ws_flg.
*--- Document type with flag
ws_poheader-doc_type = 'Z3'(c01).
ws_poheaderx-doc_type = ws_flg.
*--- Purchasing group with Flag
ws_poheader-pur_group = '005'. " hardcoded
ws_poheaderx-pur_group = ws_flg.
*--- Purchasing Organization with flag
ws_poheader-purch_org = '2000'.
ws_poheaderx-purch_org = ws_flg.
*--- Supply plant with flag
ws_poheader-suppl_plnt = '2000'.
ws_poheaderx-suppl_plnt = ws_flg.
*--- Company Code with flag
ws_poheader-comp_code = '2000'.
ws_poheaderx-comp_code = ws_flg.
*<--- assinging new item No.
ws_posnr = ws_posnr + 10.
*POPULATE ITEM DATA.
tbl_poitem-po_item = ws_posnr.
tbl_poitem-material = it_sto-matnr.
tbl_poitem-item_cat = 'U'(c02).
tbl_poitem-plant = it_sto-werks.
tbl_poitem-quantity = it_sto-orqty.
APPEND tbl_poitem.
CLEAR tbl_poitem.
*POPULATE ITEM FLAG TABLE
tbl_poitemx-po_item = ws_posnr.
tbl_poitemx-po_itemx = ws_flg.
tbl_poitemx-material = ws_flg.
tbl_poitemx-plant = ws_flg.
tbl_poitemx-item_cat = ws_flg.
tbl_poitemx-quantity = ws_flg.
APPEND tbl_poitemx.
CLEAR tbl_poitemx.
ENDLOOP.
ENDFORM. "CREATE_PO
*& Form
text
--> p1 text
<-- p2 text
FORM create_purhase_order .
CLEAR: tbl_poitem,
tbl_poitemx,
ws_poheader,
ws_poheaderx.
REFRESH: tbl_poitem,
tbl_poitemx.
CLEAR : tbl_return.
REFRESH: tbl_return.
*<--- Bapi to create Purchase order
IF NOT tbl_poitem[] IS INITIAL.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = ws_poheader
poheaderx = ws_poheaderx
IMPORTING
exppurchaseorder = ws_purchaseorder
TABLES
return = tbl_return
poitem = tbl_poitem
poitemx = tbl_poitemx.
READ TABLE tbl_return WITH KEY type = 'E'.
*<--- Bapi to commit the changes
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
ENDIF.
LOOP AT tbl_return.
*<--- Ignore the warning messages
IF tbl_return-type = 'W'.
CONTINUE.
ENDIF.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
IF tbl_return-type = 'S'.
FORMAT COLOR COL_POSITIVE ON.
ELSEIF tbl_return-type = 'W'.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
ELSEIF tbl_return-type = 'E'.
FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
ENDIF.
WRITE:/3 tbl_return-type,12 tbl_return-id,20(85) tbl_return-message
86(10) tbl_return-field,95(20) tbl_return-system.
FORMAT COLOR OFF.
ENDLOOP.
ENDFORM. " create_purhase_order
*& Form get_open_quantities
text
--> p1 text
<-- p2 text
FORM get_open_quantities .
CHECK NOT it_mard[] IS INITIAL.
SELECT ekkoebeln ekpoebelp ekpowerks ekpomatnr
ekpomenge eketetenr eket~wemng
INTO CORRESPONDING FIELDS OF TABLE it_po
FROM ekko AS ekko
INNER JOIN ekpo AS ekpo
ON ekpoebeln EQ ekkoebeln
INNER JOIN eket AS eket
ON eketebeln EQ ekpoebeln AND
eketebelp EQ ekpoebelp
FOR ALL ENTRIES IN it_mard
WHERE ekko~bstyp EQ 'F' AND
ekko~bsart EQ 'Z3' AND
ekko~bsakz EQ 'T' AND
ekko~loekz EQ space AND
ekpo~matnr EQ it_mard-matnr AND
ekpo~werks EQ it_mard-werks AND
ekpo~loekz EQ space AND
ekpo~elikz EQ space.
SORT it_po BY ebeln ebelp etenr.
delete entries where the schedule is complete, else copy to new table
LOOP AT it_po.
IF it_po-wemng GE it_po-menge.
DELETE it_po.
ELSE.
MOVE-CORRESPONDING it_po TO it_po_2.
APPEND it_po_2.
CLEAR it_po_2.
ENDIF.
ENDLOOP.
SORT it_po_2 BY matnr werks.
To determine the pending quantities of the materials at plant level
LOOP AT it_po_2.
AT NEW werks.
it_po_pend-matnr = it_po_2-matnr.
it_po_pend-werks = it_po_2-werks.
ENDAT.
it_po_pend-pendi = it_po_pend-pendi + it_po_2-menge - it_po_2-wemng.
AT END OF werks.
APPEND it_po_pend.
CLEAR it_po_pend.
ENDAT.
ENDLOOP.
ENDFORM. " get_open_quantities
*& Form determine_mat_qty_required
text
--> p1 text
<-- p2 text
FORM determine_mat_qty_required .
DATA: lv_eisbe LIKE marc-eisbe,
lv_labst LIKE mard-labst,
lv_menge LIKE eket-menge,
lv_bstmi_old LIKE marc-bstmi,
lv_bstrf_old LIKE marc-bstrf,
lv_beskz_old LIKE marc-beskz,
lv_sobsl_old LIKE marc-sobsl,
lv_pendi LIKE eket-menge,
lv_total_conf LIKE ekpo-menge,
lv_bstmi LIKE marc-bstmi,
lv_min_qty LIKE marc-bstmi,
lv_bstrf LIKE marc-bstrf,
lv_min_qty LIKE marc-bstrf,
lv_qty_req LIKE mard-labst,
lv_remainder TYPE i.
LOOP AT it_marc.
safety stock
lv_eisbe = it_marc-eisbe.
lv_bstmi_old = it_marc-bstmi.
lv_bstrf_old = it_marc-bstrf.
lv_beskz_old = it_marc-beskz.
lv_sobsl_old = it_marc-beskz.
READ TABLE it_mard
WITH KEY matnr = it_marc-matnr
werks = it_marc-werks
BINARY SEARCH.
IF sy-subrc EQ 0.
qty onhand
lv_labst = it_mard-labst.
ELSE.
CLEAR lv_labst.
ENDIF.
READ TABLE it_po_pend
WITH KEY matnr = it_marc-matnr
werks = it_marc-werks
BINARY SEARCH.
IF sy-subrc EQ 0.
PO pending qty
lv_pendi = it_po_pend-pendi.
ELSE.
CLEAR lv_pendi.
ENDIF.
Total qty on hand & PO qty pending
lv_total_conf = lv_labst + lv_pendi.
Now determine if a PO is required for the material concerned.
IF lv_total_conf < lv_eisbe.
it_sto-matnr = it_marc-matnr.
it_sto-werks = it_marc-werks.
it_sto-eisbe = lv_eisbe.
it_sto-bstmi = lv_bstmi_old.
it_sto-bstrf = lv_bstrf_old.
it_sto-beskz = lv_beskz_old.
it_sto-sobsl = lv_sobsl_old.
it_sto-labst = lv_labst.
it_sto-pendi = lv_pendi.
Actual Qty Required
lv_qty_req = lv_eisbe - lv_total_conf.
IF it_marc-bstmi IS INITIAL.
IF it_marc-bstrf IS INITIAL.
it_sto-orqty = lv_qty_req.
ELSE.
lv_bstmi = it_marc-bstmi.
lv_min_qty = it_marc-bstmi.
lv_bstrf = it_marc-bstrf.
lv_min_qty = it_marc-bstrf.
DO.
IF lv_qty_req <= lv_min_qty.
lv_qty_req = lv_min_qty.
it_sto-orqty = lv_qty_req.
EXIT.
ELSE.
lv_min_qty = lv_min_qty + lv_bstmi.
lv_min_qty = lv_min_qty + lv_bstrf.
ENDIF.
ENDDO.
ENDIF.
APPEND it_sto.
CLEAR it_sto.
ENDIF.
ENDLOOP.
SORT it_sto BY werks matnr.
ENDFORM. " determine_mat_qty_required
*& Form print_details
text
--> p1 text
<-- p2 text
FORM print_details .
LOOP AT it_sto.
WRITE:/ it_sto-werks UNDER text-h01,
it_sto-matnr UNDER text-h02,
it_sto-orqty UNDER text-h03,
it_sto-eisbe UNDER text-h04,
it_sto-bstmi UNDER text-h05,
it_sto-bstrf UNDER text-h05,
it_sto-labst UNDER text-h06,
it_sto-pendi UNDER text-h07.
ENDLOOP.
ENDFORM. " print_details
*& Form print_header
text
--> p1 text
<-- p2 text
FORM print_header .
WRITE: AT 001 text-h01,
015 text-h02,
030 text-h03,
050 text-h04,
070 text-h05,
090 text-h06,
110 text-h07.
030 text-h03 RIGHT-JUSTIFIED,
050 text-h04 RIGHT-JUSTIFIED,
070 text-h05 RIGHT-JUSTIFIED,
090 text-h06 RIGHT-JUSTIFIED,
110 text-h07 RIGHT-JUSTIFIED.
NEW-LINE.
ENDFORM. " print_header
*& Form create_po
text
--> p1 text
<-- p2 text
FORM create_po .
*-Document date with flag
ws_poheader-doc_date = sy-datum.
ws_poheaderx-doc_date = ws_flg.
*-Document type with flag
ws_poheader-doc_type = 'Z3'(c01).
ws_poheaderx-doc_type = ws_flg.
*-Purchasing group with Flag
ws_poheader-pur_group = '005'. " hardcoded
ws_poheaderx-pur_group = ws_flg.
*-Purchasing Organization with flag
ws_poheader-purch_org = '2000'.
ws_poheaderx-purch_org = ws_flg.
*-Supply plant with flag
ws_poheader-suppl_plnt = '2000'.
ws_poheaderx-suppl_plnt = ws_flg.
*-Company Code with flag
ws_poheader-comp_code = '2000'.
ws_poheaderx-comp_code = ws_flg.
LOOP AT it_sto.
AT NEW werks.
CLEAR tbl_poitem.
CLEAR tbl_poitemx.
CLEAR tbl_return.
CLEAR tbl_posched.
CLEAR tbl_poschedx.
REFRESH tbl_poitem.
REFRESH tbl_poitemx.
REFRESH tbl_return.
REFRESH tbl_posched.
REFRESH tbl_poschedx.
CLEAR ws_posnr.
ENDAT.
ws_posnr = ws_posnr + 10.
Item Data
tbl_poitem-po_item = ws_posnr.
tbl_poitem-material = it_sto-matnr.
tbl_poitem-item_cat = 'U'(c02).
tbl_poitem-plant = it_sto-werks.
tbl_poitem-quantity = it_sto-orqty.
APPEND tbl_poitem.
CLEAR tbl_poitem.
Item X Data
tbl_poitemx-po_item = ws_posnr.
tbl_poitemx-po_itemx = ws_flg.
tbl_poitemx-material = ws_flg.
tbl_poitemx-plant = ws_flg.
tbl_poitemx-item_cat = ws_flg.
tbl_poitemx-quantity = ws_flg.
APPEND tbl_poitemx.
CLEAR tbl_poitemx.
Schedule Data
tbl_posched-po_item = ws_posnr.
tbl_posched-sched_line = '0001'.
tbl_posched-delivery_date = sy-datum.
tbl_posched-quantity = it_sto-orqty.
APPEND tbl_posched.
CLEAR tbl_posched.
Schedule Data X
tbl_poschedx-po_item = ws_posnr.
tbl_poschedx-po_itemx = ws_flg.
tbl_poschedx-sched_line = '0001'.
tbl_poschedx-sched_linex = ws_flg.
tbl_poschedx-delivery_date = ws_flg.
tbl_poschedx-quantity = ws_flg.
APPEND tbl_poschedx.
CLEAR tbl_poschedx.
AT END OF werks.
Create the PO
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = ws_poheader
poheaderx = ws_poheaderx
IMPORTING
exppurchaseorder = ws_purchaseorder
TABLES
return = tbl_return
poitem = tbl_poitem
poitemx = tbl_poitemx
poschedule = tbl_posched
poschedulex = tbl_poschedx.
LOOP AT tbl_return WHERE type EQ 'E' OR type EQ 'A'.
EXIT.
ENDLOOP.
If Loop is false - then no error occurred
IF sy-subrc NE 0.
No Errors - Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
SKIP.
LOOP AT tbl_return.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
IF tbl_return-type = 'E' OR tbl_return-type = 'A'.
FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
ELSEIF tbl_return-type = 'W'.
FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
ELSE.
FORMAT COLOR COL_POSITIVE ON.
ENDIF.
WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)
tbl_return-message,
86(10) tbl_return-field,95(20) tbl_return-system.
FORMAT COLOR OFF.
ENDLOOP.
ENDAT.
ENDLOOP.
ENDFORM. " create_poHi,
first you can store these 2 dates into some internal table sat it_sobid and it_ObjectID.Now
sort it_sobid ascending.
loop at it_ObjectID.
Read date from it_sobid binary search index sy-index.
it_ObjectID-date = it_sobid-date.
flag = 'y'.
endloop.
you can write some logic like this. Its just a rough idea you can modify according to ur need.
Regards,
Ravi -
Need help in highlighting the query text in document
Hi, I am trying to load the files in the blob column and trying to create the text index on it.
i need to query the blob column in the document table with a string, which needs to return the relevant documents with the query string highlighted with some color.
Can you please help me with an example on the above.
Thanks in advance.SCOTT@orcl_11gR2> -- table:
SCOTT@orcl_11gR2> CREATE TABLE document_tab
2 (document_col BLOB)
3 /
Table created.
SCOTT@orcl_11gR2> -- procedure to load documents:
SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE load_document
2 (p_dir IN VARCHAR2,
3 p_file IN VARCHAR2)
4 AS
5 v_blob BLOB;
6 v_bfile BFILE;
7 BEGIN
8 INSERT INTO document_tab (document_col)
9 VALUES (EMPTY_BLOB())
10 RETURNING document_col INTO v_blob;
11 v_bfile := BFILENAME (UPPER (p_dir), p_file);
12 DBMS_LOB.FILEOPEN (v_bfile, DBMS_LOB.LOB_READONLY);
13 DBMS_LOB.LOADFROMFILE (v_blob, v_bfile, DBMS_LOB.GETLENGTH (v_bfile));
14 DBMS_LOB.FILECLOSE (v_bfile);
15 END load_document;
16 /
Procedure created.
SCOTT@orcl_11gR2> SHOW ERRORS
No errors.
SCOTT@orcl_11gR2> -- load documents (directory and files must be on server, not client):
SCOTT@orcl_11gR2> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\my_oracle_files'
2 /
Directory created.
SCOTT@orcl_11gR2> BEGIN
2 load_document ('my_dir', 'banana.pdf');
3 load_document ('my_dir', 'english.doc');
4 load_document ('my_dir', 'sample.txt');
5 END;
6 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> -- confirm files were loaded:
SCOTT@orcl_11gR2> SELECT DBMS_LOB.GETLENGTH (document_col)
2 FROM document_tab
3 /
DBMS_LOB.GETLENGTH(DOCUMENT_COL)
222824
22016
60
3 rows selected.
SCOTT@orcl_11gR2> -- text index:
SCOTT@orcl_11gR2> CREATE INDEX document_idx
2 ON document_tab (document_col)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 /
Index created.
SCOTT@orcl_11gR2> -- confirm files were indexed:
SCOTT@orcl_11gR2> SELECT COUNT(*) FROM dr$document_idx$i
2 /
COUNT(*)
319
1 row selected.
SCOTT@orcl_11gR2> -- function to return highlighted document:
SCOTT@orcl_11gR2> CREATE OR REPLACE FUNCTION your_markup
2 (p_index_name IN VARCHAR2,
3 p_textkey IN VARCHAR2,
4 p_text_query IN VARCHAR2,
5 p_plaintext IN BOOLEAN DEFAULT TRUE,
6 p_tagset IN VARCHAR2 DEFAULT 'HTML_DEFAULT',
7 p_starttag IN VARCHAR2 DEFAULT '*',
8 p_endtag IN VARCHAR2 DEFAULT '*',
9 p_key_type IN VARCHAR2 DEFAULT 'ROWID')
10 RETURN CLOB
11 AS
12 v_clob CLOB;
13 BEGIN
14 CTX_DOC.SET_KEY_TYPE (p_key_type);
15 CTX_DOC.MARKUP
16 (index_name => p_index_name,
17 textkey => p_textkey,
18 text_query => p_text_query,
19 restab => v_clob,
20 plaintext => p_plaintext,
21 tagset => p_tagset,
22 starttag => p_starttag,
23 endtag => p_endtag);
24 RETURN v_clob;
25 END your_markup;
26 /
Function created.
SCOTT@orcl_11gR2> SHOW ERRORS
No errors.
SCOTT@orcl_11gR2> -- query that returns highlighted document:
SCOTT@orcl_11gR2> VARIABLE string VARCHAR2(100)
SCOTT@orcl_11gR2> EXEC :string := 'test AND demonstration'
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> SELECT your_markup ('document_idx', ROWID, :string)
2 AS highlighted_text
3 FROM document_tab
4 WHERE CONTAINS (document_col, :string) > 0
5 /HIGHLIGHTED_TEXT
This is a test document for demonstration of highlighting.
1 row selected.
SCOTT@orcl_11gR2> -
Need help in optimizing the query with joins and group by clause
I am having problem in executing the query below.. it is taking lot of time. To simplify, I have added the two tables FILE_STATUS = stores the file load details and COMM table that is actual business commission table showing records successfully processed and which records were transmitted to other system. Records with status = T is trasnmitted to other system and traansactions with P is pending.
CREATE TABLE FILE_STATUS
(FILE_ID VARCHAR2(14),
FILE_NAME VARCHAR2(20),
CARR_CD VARCHAR2(5),
TOT_REC NUMBER,
TOT_SUCC NUMBER);
CREATE TABLE COMM
(SRC_FILE_ID VARCHAR2(14),
REC_ID NUMBER,
STATUS CHAR(1));
INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4);
INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0);
INSERT INTO COMM VALUES ('12345678', 1, 'T');
INSERT INTO COMM VALUES ('12345678', 3, 'T');
INSERT INTO COMM VALUES ('12345678', 4, 'P');
INSERT INTO COMM VALUES ('12345678', 5, 'P');
COMMIT;Here is the query that I wrote to give me the details of the file that has been loaded into the system. It reads the file status and commission table to show file name, total records loaded, total records successfully loaded to the commission table and number of records that has been finally transmitted (status=T) to other systems.
SELECT
FS.CARR_CD
,FS.FILE_NAME
,FS.FILE_ID
,FS.TOT_REC
,FS.TOT_SUCC
,NVL(C.TOT_TRANS, 0) TOT_TRANS
FROM FILE_STATUS FS
LEFT JOIN
SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS
FROM COMM
WHERE STATUS = 'T'
GROUP BY SRC_FILE_ID
) C ON C.SRC_FILE_ID = FS.FILE_ID
WHERE FILE_ID = '12345678';In production this query has more joins and is taking lot of time to process.. the main culprit for me is the join on COMM table to get the count of number of transactions transmitted. Please can you give me tips to optimize this query to get results faster? Do I need to remove group and use partition or something else. Please help!I get 2 rows if I use my query with your new criteria. Did you commit the record if you are using a second connection to query? Did you remove the criteria for file_id?
select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans
from (select fs.carr_cd,
fs.file_name,
fs.file_id,
fs.tot_rec,
fs.tot_succ,
count(case
when c.status = 'T' then
1
else
null
end) over(partition by c.src_file_id) tot_trans,
row_number() over(partition by c.src_file_id order by null) rn
from file_status fs
left join comm c
on c.src_file_id = fs.file_id
where carr_cd = 'LIBM')
where rn = 1;
CARR_CD FILE_NAME FILE_ID TOT_REC TOT_SUCC TOT_TRANS
LIBM CM_LIBM.TXT 12345678 5 4 2
LIBM CM_LIBM.TXT 12345677 10 0 0Using RANK can potentially produce multiple rows to be returned though your data may prevent this. ROW_NUMBER will always prevent duplicates. The ordering of the analytical function is irrelevant in your query if you use ROW_NUMBER. You can remove the outermost query and inspect the data returned by the inner query;
select fs.carr_cd,
fs.file_name,
fs.file_id,
fs.tot_rec,
fs.tot_succ,
count(case
when c.status = 'T' then
1
else
null
end) over(partition by c.src_file_id) tot_trans,
row_number() over(partition by c.src_file_id order by null) rn
from file_status fs
left join comm c
on c.src_file_id = fs.file_id
where carr_cd = 'LIBM';
CARR_CD FILE_NAME FILE_ID TOT_REC TOT_SUCC TOT_TRANS RN
LIBM CM_LIBM.TXT 12345678 5 4 2 1
LIBM CM_LIBM.TXT 12345678 5 4 2 2
LIBM CM_LIBM.TXT 12345678 5 4 2 3
LIBM CM_LIBM.TXT 12345678 5 4 2 4
LIBM CM_LIBM.TXT 12345677 10 0 0 1 -
Pls help me to modify the query for performance improvement
Hi,
I have the below initialization
DECLARE @Active bit =1 ;
Declare @id int
SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END FROM dbo.Students
I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?I dont understand your query...May be below? or provide us sample data and your output...
SELECT * FROM dbo.students
where @Active=CASE
WHEN id=@id and rank ='Good' then 0 else 1 END
But, I doubt you will have performance improvement here?
Do you have index on id?
If you are looking for getting the data for @ID with rank ='Good' then use the below:Make sure, you have index on id,rank combination.
SELECT * FROM dbo.students
where id=@id
and rank ='Good' -
In query designer , cant able to change/modify the query porperties
hai experts / friends
even in production or develeopment i have selected one query in query designer and opened and after that am selecting one default value and then right hand side it displays the properties of that particular query then i can not modify the changes ...that Display and change option is in disable....how can i enable this button...
please help me friends...
previously i have tried using production and then i thought because of production it is not getting enabled then i tried in development , and came to know that even in development also same problem it is not getting enabled....
thanks in advance..
regards
anandhai friends..
thanks for all your reply...
actually i want to explain detail ..
after selecting the one particular query , am just placing the mouse in my charecteristics restrictions and then right hand side
properties window gets displayed and at the top we can find display/change button and save button technical name
button
in that display and change button is disabled...i want that button to be enabled.
i have checked in my authorizations in SU01...
even i have all the profiles like SAP_ALL ...
and then i have been trying to have transaport connection and then creating transport conn. for BeX...but it is asking package name...
in this case i dont know the exact package name....
can any body help me in this regard???
thanks
anand
Maybe you are looking for
-
Excise modvat accounts not defined for CAPE transaction and TS excise group
Hi Guys, Suddenly we are facing issue during exicse invoice capturing with MIGO system is giving following error "Excise modvat accounts not defined for CAPE transaction and TS excise group Message no. 8I402 While in Excise account assignment table C
-
Slide Action on Exit Cancelled by Length of Audio File
Captivate 8.0 Responsive Project Status: Solution to problem works but makes no sense Problem: Slide actions on exit designated in the Properties Inspector do not function. Although the "jump to slide" action was selected, the transition at the en
-
Why does Safari crash on my internal start-up disk and not on a booted SuperDuper external disk? Safari started behaving weird with very high CPU usage, then it refused to start up altogether, it doesn't even reach the safari icon when it crashes. Di
-
Why does my guitar make crackling noises when it plays through logic pro/garageband?
When my guitar plays directly through the interface and montors, it sounds perfectly fine. But whenever I want to add effects through a musical application such as garageband or logic pro x, I get this weird, very loud crackling/bubbly sound. Can an
-
..this library" i only have 3 apps showing in the "ipod touch apps" sidebar on the left, and i don't know if i click sync just to get them on the ipod touch, if they will replace EVERY other app on the ipod. before there used to be a list of all the