Query Approval -Series Wise
Dear All
I am facing a issue in the approval scenairo in PO
Series created are AI10,TI10,AM10
Now i ve created approval template with doctotal-inrange 10000-20000 series wise
and in the query in i ve given query as
select distinct 'true' from where t0.series =70
But im getting approval template authorization for all the 3 series
ex if AI10 series is chosen in PO the approval template for TI10 and AM10 also appears.
Can any one give solution for the above so that only one approval template will be triggered
Chintesh Soni and Niladri Bhusan,
I tried like this
select distinct 'True' from opor t0 where t0.series=70 and $[opor.doctotal]>=10000 and $[opor.doctotal]<=20000
what went wrong in the above query
Gordan,
If i use query approval along with built in terms,both are functioning
Similar Messages
-
Query For Series wise Collection
Hi
Please anyone provide query for series-wise collectionSatish Doke,
Im using this query as "Series Wise Outstanding" I want to create another query for "series wise collection".How can i do this.Im not into SAP accounting.Please help.
DECLARE @Date AS DATETIME
DECLARE @Series AS varchar(30)
DECLARE @Branch AS varchar(30)
DECLARE @Exec AS varchar(30)
/* SELECT FROM [dbo].[OINV] S0 WHERE */ SET @Date = /* S0.DocDate*/ '[%0]'
/* SELECT FROM [dbo].[NNM1] S2 WHERE */ SET @Series = /* S2.SeriesName*/ '[%2]'
/* SELECT FROM [dbo].[OLCT] S3 WHERE */ SET @Branch = /* S3.Location*/ '[%3]'
/* SELECT FROM [dbo].[OSLP] S4 WHERE */ SET @Exec = /* S4.SlpName*/ '[%4]'
if( @Exec ='') set @Exec ='%'
if( @Series ='') set @Series ='%'
if( @Branch ='') set @Branch ='%'
if( @Date ='') set @Date =GETDATE()
Select distinct OINV.CardName [Customer Name], ISNULL(NNM1.SeriesName ,'-')+'/'+ CAST(OINV.DocNum as varchar) [Bill No.],
OINV.DocDate [Bill Date],INV1.Dscription,INV1.Quantity,
OINV.DocTotal - OINV.PaidToDate [Out Standing Amount],
DATEDIFF(dd,OINV.DocDate,@Date)[No of Days] from OINV
inner join INV1 on OINV.DocEntry = INV1.DocEntry
inner join OLCT on INV1.LocCode = OLCT.Code
inner join NNM1 on OINV.Series = NNM1.Series
inner join OSLP on OINV.SlpCode = OSLP.SlpCode
where OINV.DocType ='I' and (OINV.DocTotal - OINV.PaidToDate)>0
and NNM1.SeriesName like @Series and OINV.DocDate<= @Date
and OLCT.Location like @Branch and OSLP.SlpName like @Exec -
Dear All
Stuck at query approval:
SELECT
DISTINCT 'TRUE'
FROM
POR1 INNER JOIN
OITM ON POR1.ItemCode = OITM.ItemCode INNER JOIN
OITB ON OITM.ItmsGrpCod = OITB.ItmsGrpCod
Where POR1.DocEntry = $[OPOR.Docentry]
Group By OITB.U_POLimit
HAVING OITB.U_POLimit < Sum(POR1.GTotal)
Value is coming properly in sap query manager but approval is not executing at the time of transactionHi Sumeet,
Try the below query, but it will consider the item group of the first line "Item code".
For example , one PO will have different type of item group's item then you wont get expected result.
SELECT
DISTINCT 'TRUE'
FROM
POR1 INNER JOIN
OITM ON $[$38.1.1] = OITM.ItemCode INNER JOIN
OITB ON OITM.ItmsGrpCod = OITB.ItmsGrpCod and Isnull(OITB.U_POLimit,0) < $[$22.0.Number] -
Query for Item wise sales report
Hi Guys,
Below is the query i have used to run Sales Register.
But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
(Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
(SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalHi experts..
Pls Update the Query -
Query for Item wise Sales.......
*Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
Pls update the query ...*
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalClosing this ...
Edited by: Parimis on Jun 25, 2010 5:44 PM -
Query approval procedure-SO approval if there is due invoices =90days
Hi,
My customer is running 2007A PL30. He needs approval procedure for SO to be approved if the customer has overdue invoices more than 90 days.
Any idea how to write the query?
Regards
ThomasHi Thomas,
This is surely doable. It can only be done through user query. Try this one:
SELECT distinct 'true' from OINV T0 where T0.CardCode =
$[$4.0.0] and DateDiff(DD, GetDate(), T0.DocDueDate) >= 90
and T0.DocTotal > T0.PaidToDate and T0.DocStatus = 'O'
It can not be run directly. Assign to approval template directly to see.
Thanks,
Gordon -
Query approval procedures issue
Hi all
I'm creating a query for approval procedure in Sales orders. This query is working fine:
SELECT DISTINCT 'TRUE' FROM ORDR T0
WHERE CAST ($[ORDR.DocTotal] AS decimal(19,6))>= $[ORDR.U_Credito]
But the one above give the following error get an error: Could not commit transaction: Error -1 detected during transaction
SELECT DISTINCT 'TRUE' FROM ORDR T0
WHERE CAST ($[ORDR.DocTotal] AS decimal(19,6))>= ($[ORDR.U_Credito]*0.2)
How can i multiply that field to get 20%.
The field ORDR.U_Credito is type amount
Kind Regards,
Margarida Pedroso
Edited by: Margarida Pedroso on Nov 6, 2011 12:21 AM
Edited by: Margarida Pedroso on Nov 6, 2011 12:23 AM
Edited by: Margarida Pedroso on Nov 6, 2011 12:42 AMHi Margarida Pedroso,
Try:
IF $[ORDR.DocTotal.number\] >= ($[ORDR.U_Credito.number\]*0.2)
SELECT DISTINCT 'TRUE'
Thanks,
Gordon -
Query for material wise pricing
i want to extract price for sales org/distribution channel/ Division/material. which tables can i used .
Table
Field combination
A274
- Sales org./Distr. chl/Division/Material/Item
A273
- Sales org./Distr. chl/Division/Material/Customer/Item
Regards
JP -
SQL Query base Finish goods year wise report
Hi
I want to make query base year wise report of Finish Goods.
example like :
Item Name Year2010-11 Year2011-12
abc Sep Oct Nov Sep Oct Nov
xyz 5 0 10 2 5 0
Why this report is need to me because i want to see How old Finish Goods are in the Stock. so that when a delivery make, the person can delivery from old stock first.
Our FY is from September to August
Please help me
Regards,
Mizan
Edited by: mizan700 on Nov 15, 2011 3:28 PMHi Eva,
As Sybrand mentioned, you can't create DDL inside a procedure, and you probably don't need a temporary table. Temporary tables in SQL server used to be used to create a read consistent view for the duration of the procedure, but Oracle's multi version concurrent consistency model eliminates this as a need in all but the most remote cases.
Your create table only seems to be used to take arguments from the user, which I don't see in your code.
If I am looking at your code correctly, all you really want to ask the database is the following:
select nvl(sum(dc.daily_count),0)
from daily_counts_summary dc, branch br, division div
where dc.branch_ky = br.branch_ky
and br.division_ky = div.division_ky
and dc.transaction_dt = t.trndt
and dc.commission_cd = 'R'
and div.division_ky = nvl(v_div_ky,div.division_ky)
and dc.member_type_cd, 'P'
and dc.expiration_dt between v_exp_start_dt and v_exp_end_dt;You can do this in Crystal Reports by writing a procedure that has an out parameter of type sys_refcursor. All you have to do is:
create or replace procedure my_proc(p_curs in out sys_refcursor,v_exp_start_dt date,v_exp_end_dt date) is
begin
open p_cur for
select nvl(sum(dc.daily_count),0)
from daily_counts_summary dc, branch br, division div
where dc.branch_ky = br.branch_ky
and br.division_ky = div.division_ky
and dc.transaction_dt = t.trndt
and dc.commission_cd = 'R'
and div.division_ky = nvl(v_div_ky,div.division_ky)
and dc.member_type_cd, 'P'
and dc.expiration_dt between v_exp_start_dt and v_exp_end_dt;
end;
/...or something close to that, with perhaps calls to your date functions to extract what you need.
You also have several syntax errors in your code. I would recommend you get two books if your are going to work with Oracle:
Anything by Tom Kyte
Anything by Steven Feuerstein
These would both be available on amazon.com
HTH,
Steve -
Rounding data on an approval query
Hello everyone...
As You know, taxes have increased in Mexico so we created new tax codes and accounts, and since I can't block any of the old taxcodes/acounts until all previous documents have ben closed/paid the only option I could think of was creating an approval process for all documents using the previous tax codes, since I can't create an approval query based on document lines/rows, I created it comparing the document's tax vs the document's total ($$). The old taxes were 10% and 15% these are the percentages I want to "block" using the approval process.
Here's the query I created
IF (($($27.0.number) = $($22.0.number).15) OR ($($27.0.number) = $($22.0.number).1) ) SELECT 'TRUE'
The query/approval works, but there is a problem: SBO rounds to 2 decimals, so for a $ 124.15 sale the 15% tas would be 18.6225 but the tax ammount field would show 18.62 only which by being different in 0.0025 passes the criteria...
How can I make this query work with rounded data?, I tried using round($($22.0.number)) but when then I always get a "Cannot comit transaction" error..
Thanks in advance
HugoHugo,
I am glad my suggested solution worked. I try to answer only questions that I know will work.
It does not help in answering on a trail and error basis which unfortunately happens a lot of times as the enthusiasm in answering keeps away the focus.
Depending on your decimal places definition in General Setting the numbers would be rounded.
Using CAST to Varchar will also preserve the decimals but the numeric value will get converted.
Best wishes
Suda -
Query that will trigger on Approval Procedures
Hi All,
I have this requirements that the user will prevent them to Add the Sales Order by triggering the Approval Procedures. I need the script that i can use to link on the Terms Based on the User Queries. The script will check if the Unit Price is deviates 50% from the original Unit Price.
Thanks and Regards,
MelvinHi Melvin,
User query approval will only work on document header. Line level checking is not possible unless you just care about the first line.
Thanks,
Gordon -
Approval Stage & Template Problem
Hi Experts,
I have created approval stages and template for outgoing payments where document total is the only criteria for approval templates. Is it possible to restrict specific user with outgoing payment series wise by writing query ?? If possible how could I do it ...please suggest ..
Regards,
SKHi Rahul,
As per your suggestion I have written this query to restrict particular series and doctotal but its not working actually.The condition fires only on the basis of Total Document (checked) and Ratio - > condition as given
But if I configure this set up as the given below format then
Approval Template Setup -> Terms tab -> "When the following Applies" -> Total Documnet (unchecked) -> added a query in term based on user query box as below :
Select Distinct 'True' From OVPM T0 Where T0.Series=115 And T0.DocType= 'A' and T0.DocTotal>1000 And T0.DocTotal <=10000 and T0.UserSign=7 and T0.DocNum=$[OVPM.DocNum.0]
(The given query is wrtten on basis of specific doc Seris, Account type payemnt, generated user and range of doctotal)
then its not working ....Could you suggest that anything wrong in the query ??? Please guide.
Thanx and regards,
SK -
To get supplier name based on latest approved date
hi
in PO SUPER USER -Purchase Order Summary ,when we enter the item number in Item,rev field a new form Purchase Order Lines opens
in this form there are many lines of PO numbers ,suppliers(vendors),approved date ,can we get the supplier name for which the approved date is most recent
kindly guide
thanking in advancehi
in my system i can see the latest approved date wise but i have to add an inline query on the most recent vendor based on approved date to an already existing query
meaning just the first row data(most recent supplier) should be captured in the query
when i do the following query , i am taking an eg of the item_no 1020101001
select msib.segment1,max(pha.approved_date) from
po_headers_all pha,
po_lines_all pla,
po_vendors pv,
mtl_system_items_b msib
where
pha.po_header_id = pla.po_header_id
and pla.item_id = msib.inventory_item_id
and pv.vendor_id=pha.vendor_id
and msib.segment1='1020101001'
--and pha.approved_date=max(pha.approved_date)
group by
--item_id.
msib.segment1
this is the output i get
segment1 MAX(PHA.APPROVED_DATE)
1020101001 1/9/2011 3:16:48 PMwhen i do the following query
select msib.segment1,max(pha.approved_date) ,pv.vendor_name from
po_headers_all pha,
po_lines_all pla,
po_vendors pv,
mtl_system_items_b msib
where
pha.po_header_id = pla.po_header_id
and pla.item_id = msib.inventory_item_id
and pv.vendor_id=pha.vendor_id
and msib.segment1='1020101001'
--and pha.approved_date=max(pha.approved_date)
group by
--item_id.
msib.segment1
,pv.vendor_name
segment1 MAX(PHA.APPROVED_DATE) VENDOR_NAME
1020101001 7/21/2008 9:09:20 AM TRIZAC ABU DHABI
1020101001 1/9/2011 3:16:48 PM SAUDI CEMENT COMPANY
1020101001 2/14/2010 4:03:46 PM UNION CEMENT NORCEM CO.
1020101001 5/19/2010 3:08:32 PM AS CIMENTO SANAYI VE TICARET A.S.i require the most recent vendor_name for a particular item ( i require the output as below)
segment1 MAX(PHA.APPROVED_DATE) VENDOR_NAME
1020101001 1/9/2011 3:16:48 PM SAUDI CEMENT COMPANY
kindly guide me
thanking in advance -
2007B
want to trigger an approval for purchase orders higher than 25000 rupees.
I need the query for this approvalHI,
B1 standard approval based on all document series. So, for your issue, just use query approval (in the approval procedure template, there is a query matrix where you put it there). Try to use Gordon's query but if not succeed, you could post here the error message.
you could also try this query approval:
for spares:
select distinct 'true' from OPOR t0 where
$[OPOR.series] = '..'
and $[OPOR.doctotal] > '25000' --
fill in the blanks the series code for spares
for raw material:
select distinct 'true' from OPOR t0 where
$[OPOR.series] = '...'
and $[OPOR.doctotal] > '25000' --
fill in the blanks the series code for raw material
You have to create to approval templates and optional for the stage. I mean for the approval stage, you could create 1 stage or 2 stage depends on how many authorizers to approve.
Rgds, -
How to use Results from Another Query for SAP BW universes
Hi Everyone,
I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding Sales doc no in first data provider.
I want to place all these fileds into a single report like as shown.
(Datarpovider1) (Datarpovider1) (Datarpovider2)
*Sales Doc No* Orderqty BillQty
Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
I tried it but it was giving the follwing error:
A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
All this I am doing in Webi Rich Client.
Appreciate your help
Thanks &in Advance
Kiran SakaHi Kiran,
I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
Regards,
Neeraj
Maybe you are looking for
-
Running a report in Background
Hi Guys, I am designing a ALV report. This report have option in the selection screen, to run immediately or Background. I am using JOB_OPEN, JOB_SUBMIT and JOB_CLOSE FM's. My doubt is at which point I have to use these FM's. Immediatel
-
I can't family share a song I purchased today
I bought several songs today. I tried to family share these songs with my wife. Only one of the songs showed up in my recent purchases list. Does anyone know why this happened? Can some songs not be shared?
-
Problems with the 10.9.5 update (Mavericks)
Hi, recently i update my Mavericks into 10.9.5 and today some problems starts to rise.... Someone can tell what should i do with this problem? https://www.youtube.com/watch?v=UMWVKMxtUoM&feature=youtu.be please,help me to fix it please!
-
Unable to copy DVD with home movies
I am able to play a DVD that has home movies on it on my Imac and MacBook Pro. I am not able to import into IMovie to try some editing and I cannot copy or burn another disk to share. The copy company stated there was no copy protection on the disk.
-
How to Debug a Screen or Transaction ?
Hi , I am developing a screen with table control. I would like to debug that one. How can I do it ? Bye, Muttu.