Selection Problem in SAP B1 Query Manager
Experts,
select T0.DocNum 'AR Invoice Number',
T0.DocDate 'AR Invoice Date',
T0.CardCode,
T0.CardName,
T0.NumAtCard 'Vendor Ref No',
(select sum (T1.Quantity * T1.Price) from INV1 T1 where T1.DocEntry = T0.DocEntry) 'Base Amount',
ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='1'), 0)'VAT Amount',
ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='1'), 0)'VAT %',
ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='4'), 0)'CST Amount',
ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='4'), 0)'CST %',
ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='5'), 0)'Service Amount',
ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='5'), 0)'Service %',
T0.TotalExpns 'Freight Amount',
T0.WTSum 'TDS Amount',
T0.DocTotal 'Document Total'
from OINV T0
where T0.DocDate >= '[%0]'
and T0.DocDate <= '[%1]'
When I run this query in SBO query maanger, it gives error for the selection criterias.
1). [Microsoft][SQL Native Client][SQL Server]Must specify table to select from. 2). [Microsoft][SQL Native Client][SQL Server]Statement 'User-Defined Values' (CSHS) (s) could not be prepared.
Please hlp
Hi Rahul,
I have just added credit memo with the query as per need, but same problem it shows!
SELECT T0.[DocNum] 'AR Invoice #',
T0.[DocDate] 'Date',
T0.CardName 'Customer Name',
T0.NumAtCard As 'Customer Ref',
T0.[CardName],
Sum(T1.LineTotal) 'Base Amount',
T0.[DocTotal] As 'Total Value',
(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxSum else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) 'VAT_Amt',
(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxRate else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'VAT%',
(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxSum else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'CST_Amt',
(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxRate else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'CST%',
(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxSum else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'Service_Amt',
(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxRate else 0 end))
FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'Service%',
T0.TotalExpns 'Freight Amount',
T0.WTSum 'TDS Amount',
T0.DocTotal 'Grand Total'
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocDate>='[%0]' And T0.DocDate<='[%1]'
Group By T0.[DocNum], T0.[DocDate], T0.NumAtCard, T0.[CardName], T0.[DocTotal] , T0.TotalExpns, T0.WTSum, T0.DocEntry,
T0.WTSum,
T0.TotalExpns
Union All
SELECT T0.[DocNum] 'AR Invoice #',
T0.[DocDate] 'Date',
T0.CardName 'Customer Name',
T0.NumAtCard As 'Customer Ref',
T0.[CardName],
-Sum(T1.LineTotal) 'Base Amount',
-T0.[DocTotal] As 'Total Value',
-(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxSum else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) 'VAT_Amt',
-(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxRate else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'VAT%',
-(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxSum else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'CST_Amt',
-(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxRate else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'CST%',
-(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxSum else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'Service_Amt',
-(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxRate else 0 end))
FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'Service%',
-T0.TotalExpns 'Freight Amount',
-T0.WTSum 'TDS Amount',
-T0.DocTotal 'Grand Total'
FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocDate>='[%0]' And T0.DocDate<='[%1]'
Group By T0.[DocNum], T0.[DocDate], T0.NumAtCard, T0.[CardName], T0.[DocTotal] , T0.TotalExpns, T0.WTSum, T0.DocEntry,
T0.WTSum,
T0.TotalExpns
Plz hlp
Similar Messages
-
Input help selection problem in SAP GUI screen
Hi All,
We are using a SAP GUI based transaction for one ESS service. In this service, we have a input field. This field is defined as dictionary field And its picking F4 values from dictionary.
Now we have a problem here.
We have to set this field as mandatory(set in fields property using screen painter). Everything was fine, just before we did testing
When user host this service, for above mentioned field user get to see one "?" mark. When user does not select any of the entry provided by F4. user gets a message "please fill mandatory field" and input field contains first entry from F4 help.
Now this is very confusing, so we want to avoid selection of this entry.
if any of you have faced similar problem ??
any suggestions here.Yes Sudir ,
We also stopped a bit at this point.
Wht we did is impemented all the mandatory checks at module pool itself and throwed status msg by using Message class.
Now if a user leaves any mandatory field , the status msg will point the filed he left blank ..
But Cursor won't point to that field .
Regards ,
J
Do Award Points by clicking the left of this info. -
SAP B1 Query Manager - Urgent Question
I have a question, when we used query filter , how can clear the history when using query ?
Hi . Nagarajan
Many thanks for your information . Could you give me details instruction how to clear .Also do you have any command when open the query default clear the history first .
Thanks
Jackie Wong -
SAP B1 query generator problem
Experts,
i have created one Stored Procedure and want to execute from SAP B1 query manager, but it gives error like
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Warning: Null value is eliminated by an aggregate or other SET operation. 'Service Contracts' (OCTR)
whereas i have used ISNULL everywhere, so no NULL values in any column.
Exec [dbo].[Micro] '20110401', '20111021'
is what i am using to get the data/START/
USE [MIPL_PROD_17 10 2011]
GO
/****** Object: StoredProcedure [dbo].[Micro] Script Date: 10/21/2011 16:37:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Micro] @FrDt as Date,@ToDt as Date
AS
BEGIN
create table #temp1 (
TransNum int,
TransType int,
TypeOfTransaction varchar(100),
ItemCode varchar (100),
QuantityReceived int,
ChapterId varchar (100),
PREF varchar (100),
CUSTOMER varchar (100),
SUPPLIER varchar (100),
DUTYP varchar (100),
PDUTY Float,
PostingDate Date,
DocNum int,
CVD_DUTY Float,
EDU_CESS Float,
SEC_CESS Float,
ADC Float,
TotalDutyPassed Float,
QuantityIssued Float,
EntryNo int
create table #temp (
TransNum int,
TransType int,
TypeOfTransaction varchar(100),
ItemCode varchar (100),
QuantityReceived int,
ChapterId varchar (100),
PREF varchar (100),
CUSTOMER varchar (100),
SUPPLIER varchar (100),
DUTYP varchar (100),
PDUTY Float,
PostingDate Date,
DocNum int,
CVD_DUTY Float,
EDU_CESS Float,
SEC_CESS Float,
ADC Float,
TotalDutyPassed Float,
QuantityIssued Float,
EntryNo int,
Stock int
Declare @TransNum int,
@TransType int,
@TypeOfTransaction varchar(100),
@ItemCode varchar (100),
@QuantityReceived int,
@ChapterId varchar (100),
@PREF varchar (100),
@CUSTOMER varchar (100),
@SUPPLIER varchar (100),
@DUTYP varchar (100),
@PDUTY Float,
@PostingDate Date,
@DocNum int,
@CVD_DUTY Float,
@EDU_CESS Float,
@SEC_CESS Float,
@ADC Float,
@TotalDutyPassed Float,
@QuantityIssued Float,
@EntryNo int,
@Stock int
Insert #temp1
TransNum,
TransType,
TypeOfTransaction,
ItemCode,
QuantityReceived,
ChapterId,
PREF,
CUSTOMER,
SUPPLIER,
DUTYP,
PDUTY,
PostingDate,
DocNum,
CVD_DUTY,
EDU_CESS,
SEC_CESS,
ADC,
TotalDutyPassed,
QuantityIssued,
EntryNo
select
T0.TransNum,
T0.TransType,
CASE
When T0.TransType = '59' Then 'Opening Balance / Goods Receipt'
When T0.TransType = '20' Then 'GRPO'
When T0.TransType = '18' Then 'AP Invoice'
When T0.TransType = '21' Then 'Goods Return'
When T0.TransType = '67' Then 'Inventory Transfer'
When T0.TransType = '60' Then 'Goods Issue'
When T0.TransType = '59' Then 'Goods Receipt'
When T0.TransType = '13' Then 'AR Invoice'
When T0.TransType = '15' Then 'Deliveries'
When T0.TransType = '69' Then 'Landed Cost'
End 'Type of Transaction' ,
T0.ItemCode,
ISNULL(CASE
when T0.TransType = '18' Then (Select MAX(T9.Quantity) from PCH1 T9 inner join OPCH T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)
When T0.TransType = '59' Then T0.InQty
End, 0) 'Quantity Received',
(select MAX(T1.SuppCatNum) from OITM T1 where T1.ItemCode = T0.ItemCode) 'Chapter Id',
ISNULL(CASE
When T0.TransType = '13' Then
(Select MAX(isnull(T2.U_Att1, 0) + '/' + isnull(T2.U_Att2, 0)) from INV1 T2 where T2.ItemCode = T0.ItemCode)
When T0.TransType = '18' Then
(Select MAX(isnull(T2.U_Att1, 0) + '/' + isnull(T2.U_Att2, 0)) from PCH1 T2 where T2.ItemCode = T0.ItemCode)
End, '') 'PREF',
ISNULL(CASE when T0.TransType = '13'
Then T0.CardName
End, '') 'CUSTOMER',
ISNULL(CASE when T0.TransType = '18'
Then T0.CardName
End, '') 'SUPPLIER',
ISNULL (CASE When T0.TransType = '18' Then
(select MAX (CAST(isnull(T2.U_CVDP, 0) as varchar(10)) +'% '+ CAST(isnull(T2.U_UNEP, 0) as varchar(10)) +'% '+CAST(isnull(T2.U_USHP, 0) as varchar(30))
+'% '+ CAST(isnull(T2.U_ADCP, 0) as varchar(10)))+'%' from PCH1 T2 inner join OPCH T15 on T2.DocEntry = T15.DocEntry where T15.DocNum = T0.Base_Ref and T2.ItemCode = T0.ItemCode and T2.LineNum = T0.DocLineNum)
End, 0) 'DUTYP',
ISNULL(CASE When T0.TransType = '18' Then
(select MAX((isnull(T2.U_CVD, 0) * T2.Quantity) + (isnull(T2.U_UNE, 0) * T2.Quantity) + (isnull(T2.U_USH, 0) * T2.Quantity)
+ (isnull(T2.U_ADC, 0) * T2.Quantity)) from PCH1 T2 inner join OPCH T15 on T2.DocEntry = T15.DocEntry where T15.DocNum = T0.Base_Ref and T2.ItemCode = T0.ItemCode and T2.LineNum = T0.DocLineNum)
End, 0) 'PDUTY',
T0.DocDate 'Posting Date',
T0.BASE_REF 'Doc Num',
CASE When T0.TransType = '13' Then
ISNULL((Select MAX(isnull(T9.U_CVD, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum), 0)
End 'CVD_DUTY',
CASE When T0.TransType = '13' Then
ISNULL((Select MAX(isnull(T9.U_UNE, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum), 0)
End 'EDU_CESS',
CASE When T0.TransType = '13' Then
ISNULL((Select MAX(isnull(T9.U_USH, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum), 0)
End 'SEC CESS',
CASE When T0.TransType = '13' Then
ISNULL((Select MAX(isnull(T9.U_ADC, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum), 0)
End 'ADC',
CASE When T0.TransType = '13' Then
ISNULL((
(Select MAX(isnull(T9.U_CVD, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)+
(Select MAX(isnull(T9.U_UNE, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)+
(Select MAX(isnull(T9.U_USH, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)+
(Select MAX(isnull(T9.U_ADC, 0) * T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)
), 0)End 'Total Duty Passed',
ISNULL(CASE
when T0.TransType = '13' Then (Select MAX(T9.Quantity) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.Base_Ref and T9.LineNum = T0.DocLineNum)
When T0.TransType = '60' Then T0.OutQty
End, 0) 'Quantity Issued',
ISNULL(CASE
When T0.TransType = '13' Then (Select MAX(isnull(T9.U_RG23D, 0)) from INV1 T9 inner join OINV T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.BASE_REF and T9.LineNum = T0.DocLineNum)
When T0.TransType = '60' Then (Select MAX (isnull(T11.U_RG23D, 0)) from IGE1 T11 inner join OIGE T12 on T11.DocEntry = T12.DocEntry where T12.DocNum = T0.BASE_REF and T11.LineNum = T0.DocLineNum)
When T0.TransType = '59' Then (Select MAX (isnull(T11.U_RG23D, 0)) from IGN1 T11 inner join OIGN T12 on T11.DocEntry = T12.DocEntry where T12.DocNum = T0.BASE_REF and T11.LineNum = T0.DocLineNum)
When T0.TransType = '18' Then (Select MAX(isnull(T9.U_RG23D, 0)) from PCH1 T9 inner join OPCH T10 on T9.DocEntry = T10.DocEntry where T10.DocNum = T0.BASE_REF and T9.LineNum = T0.DocLineNum)
End, 0) 'Entry No'
from OINM T0
where
T0.ItemCode = 'ELE3ACC0010108' and
T0.DocDate between @FrDt and @ToDt
and T0.TransType NOT IN ( '15','20')
group by T0.TransNum,T0.TransType,T0.ItemCode, T0.CardName, T0.DocDate, T0.BASE_REF, T0.InQty, T0.OutQty, T0.DocLineNum
order by T0.DocDate
SET @Stock = 0
DECLARE rt_cursor CURSOR FORWARD_ONLY READ_ONLY FOR
select * from #temp1
OPEN rt_cursor
FETCH NEXT FROM rt_cursor INTO
@TransNum,
@TransType,
@TypeOfTransaction,
@ItemCode,
@QuantityReceived,
@ChapterId,
@PREF,
@CUSTOMER,
@SUPPLIER,
@DUTYP,
@PDUTY,
@PostingDate,
@DocNum,
@CVD_DUTY,
@EDU_CESS,
@SEC_CESS,
@ADC,
@TotalDutyPassed,
@QuantityIssued,
@EntryNo
SET NOCOUNT ON
WHILE @@FETCH_STATUS = 0
BEGIN
SET @Stock = @Stock + @QuantityReceived - @QuantityIssued
Insert #temp values
@TransNum,
@TransType,
@TypeOfTransaction,
@ItemCode,
@QuantityReceived,
@ChapterId,
@PREF,
@CUSTOMER,
@SUPPLIER,
@DUTYP,
@PDUTY,
@PostingDate,
@DocNum,
@CVD_DUTY,
@EDU_CESS,
@SEC_CESS,
@ADC,
@TotalDutyPassed,
@QuantityIssued,
@EntryNo,
@Stock
FETCH NEXT FROM rt_cursor INTO
@TransNum,
@TransType,
@TypeOfTransaction,
@ItemCode,
@QuantityReceived,
@ChapterId,
@PREF,
@CUSTOMER,
@SUPPLIER,
@DUTYP,
@PDUTY,
@PostingDate,
@DocNum,
@CVD_DUTY,
@EDU_CESS,
@SEC_CESS,
@ADC,
@TotalDutyPassed,
@QuantityIssued,
@EntryNo
END
CLOSE rt_cursor
DEALLOCATE rt_cursor
select * from #temp
drop table #temp
drop table #temp1
End
/END/ -
Passing Parms to Query Manager
I have seen several questions and answers in the forum on this but would like to confirm what I perceive to be the limitations.
The following code works and allows the entry of two parms:
set @parm_rep = (SELECT t0.slpcode FROM oinv t0 where t0.slpcode = '[%0]' )
set @parm_date = (SELECT t0.docduedate FROM oinv t0 where t0.docduedate = '[%1]' )
Requirement 1: table alias must be the same. That is, the above works but the following does not
set @parm_rep = (SELECT t0.slpcode FROM oinv t0 where t0.slpcode = '[%0]' )
set @parm_date = (SELECT t1.docduedate FROM oinv t1 where t1.docduedate = '[%1]' )
Requirement 2: tables must be the same. That is, the following does not work
set @parm_rep = (SELECT t1.slpcode FROM oslp t1 where t1.slpname = '[%0]' )
set @parm_date = (SELECT t1.docduedate FROM oinv t1 where t1.docduedate = '[%1]' )
Requirement 2, in particular, prevents me from allowing the User to select from a list of Salesrep names and Invoice dates because the Salesrep name is not carried on the Invoice, only the code.
In general, I can not have parameters set from different tables for use later in the query and am restricted to only paremeters that are represented within one specific table. I then created my own table which contained the combination of fields I wanted to select from. While I could select from that table in Query Manager, I was unable to set a parm from that table.You can use more table for getting parameter values. And you donu2019t need to use only existing values from the tables. You can close the select inside a comment and use the manually entered parameter values.
Like this:
declare @n char(20)
declare @i char(20)
/*SELECT T0.[DocNum], T1.[ItemCode]
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.[DocNum] ='[%1]' and T1.[ItemCode] ='[%0]'*/
set @n='[%1]'
set @i='[%0]'
select @n,@i -
How to add drop down list for query manager report in sap business one
Hi Every one,
I need drop down list for parameter selection in sap business one Query Manager.I have two Parameters 'Sales Order','Invoice'.
Please suggest.
Thanks and Regards
DEVHi,
you need to use this :
/*select from [dbo].[OINV] T2*/
DECLARE @Invoice varchar(100)
/*where*/
set @Invoice =/* T2.DocNum */N'[%2]'
you can change the tables and the parameter number but you have to write it exactly that way.
when you run the query within the SBO you will get list of objects ( in this case list of invoices)
hope it was helpful
Shachar -
Here's an interesting problem a client is having. I have a simple query for them that retrieves some information from the primary B1 database, along with a UDT. The query works just fine inside SQL Server Management Studio. When we implement it into the query manager, before saving it, it worked just fine. We then saved it then tried running it again. One of the columns is not visibil. When click the edit button and try running it, it still doesn't work. But when we add or delete whitespace while in edit mode the query works just fine. I haven't been able to find anything on the notes yet and the customer is on 2007A PL 10 but they are planning on upgrading to 8.8+.
Any ideas on why the query manager is behaving this way? Is it a bug thats been fixed in a later patch for 2007A or is it something else entirely?You may add index to U_slsm column.
Update your query as:
Select T0.U_slsm as 'Slsm',
LEFT(T0.Code,9) as 'PC No',
T0.U_date,
T3.CardCode,
T1.DocNum as 'Shop',
T2.DocNum as 'Quote',
T0.U_amount,
T0.U_dm,
T0.U_comment
From [dbo].[@ORDERLOG T0]
Left Join dbo.ORDR T1 on T0.U_DocNum = T1.DocNum
Left Join dbo.OQUT T2 on T0.U_quote = T2.DocNum
Left Join dbo.OCRD T3 on T0.U_CardCode = T3.CardCode
Where T0.U_slsm = '[%0]'
Order By T0.U_date Desc, T0.U_amount
I have doubt regarding your links to those 3 system tables. Are those documents having internal links? -
Query Manager SQL DateDiff and Parameter Problem
Im having trouble with a date calculation in the Query Manager. Im wondering if anyone has run into something similar.
I am trying to write a query that returns records that are X days old, where X is a parameter input by the user.
Heres an example you can paste this into your system and duplicate the issue:
<b>SELECT T0.DocNum, T0.DocDueDate FROM ORDR T0 where datediff(dd, T0.DocDueDate, getdate()) <= [%0]</b>
Returns a date error code if you try to input an integer (e.g. the "Define Survey Variables" dialog is looking only for date values)
However
<b>SELECT T0.DocNum, T0.DocDueDate FROM ORDR T0 where datediff(dd, T0.DocDueDate, getdate()) <= 30</b>
Works just fine.
Any ideas?> I tried your query and it's working perfection for
> me. I'm using SBO B1 2005 A.
>
> The [%0] in your case is looking for the type of the
> critary and because it sees T0.DocDueDate it thinks
> you should give the query with a date and not a
> numeric. Maybe you cshould try to add a casting
> function to return a numeric ?
Merci Daniel,
I too am using SBO B1 2005 A (PL 22)
I should have expanded on my original problem. I have tried using CAST and CONVERT in the following ways:
<b>SELECT T0.DocNum, T0.DocDueDate FROM ORDR T0 where datediff(dd, T0.DocDueDate, getdate()) <= CAST([%0] as Integer)
SELECT T0.DocNum, T0.DocDueDate FROM ORDR T0 where cast(datediff(dd, T0.DocDueDate, getdate())as Integer) <= [%0]
</b>
also
<b>SELECT T0.DocNum, T0.DocDueDate, cast(datediff(dd, T0.DocDueDate, getdate())as Integer) as Date FROM ORDR T0 where Date <= [%1]</b>
Nothing seems to work (although I could be getting the syntax wrong) -
Hello all,
I'm using sap 2005 SP01 PL36.
I wrote this SQL instruction :
SELECT * FROM
(SELECT 'FAT_ACQ' AS TipoDoc, NNM1.SeriesName AS Serie, CONVERT(char(12), OPCH.DocDate, 3) AS DataDiRegistrazione, OPCH.DocNum AS Num,
OPCH.CardCode, OPCH.CardName AS NomeFornitore, CONVERT(char(12), OPCH.U_DateFrom, 3) AS DaData, CONVERT(char(12), OPCH.U_DateTo, 3)
AS AData, CASE OPCH.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), OPCH.DocTotal) ELSE CONVERT(decimal(9, 2), OPCH.DocTotalFC)
END AS TotaleDocumento, OPCH.DocCur AS Valuta, CASE OPCH.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), OPCH.PaidToDate)
ELSE CONVERT(decimal(9, 2), OPCH.PaidFC) END AS TotalePagato, OPCH.DocCur AS Valuta_, OPCH.DocStatus
FROM OPCH INNER JOIN
NNM1 ON OPCH.Series = NNM1.Series
UNION
SELECT 'NOT_CRE' AS TipoDoc, NNM1.SeriesName AS Serie, CONVERT(char(12), ORPC.DocDate, 3) AS DataDiRegistrazione, ORPC.DocNum AS Num,
ORPC.CardCode, ORPC.CardName AS NomeFornitore, CONVERT(char(12), ORPC.U_DateFrom, 3) AS DaData, CONVERT(char(12), ORPC.U_DateTo, 3)
AS AData, CASE ORPC.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), ORPC.DocTotal) ELSE CONVERT(decimal(9, 2), ORPC.DocTotalFC)
END AS TotaleDocumento, ORPC.DocCur AS Valuta, CASE ORPC.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), ORPC.PaidToDate)
ELSE CONVERT(decimal(9, 2), ORPC.PaidFC) END AS TotalePagato, ORPC.DocCur AS Valuta_, ORPC.DocStatus
FROM ORPC INNER JOIN
NNM1 ON ORPC.Series = NNM1.Series) T0
<b>WHERE CARDCODE = 'F00090'</b>
This query works.
When I change <b>WHERE CARDCODE = 'F00090'</b> with <b>WHERE CARDCODE = '[%0]'</b>, it stops to work.
Some one can help me???
CiaoErcole,
The problem is SAP is unable to determine which values to display for CardCode as you have CardCode in your Select statement from both OPCH and ORPC.
When you hardcode the Value SAP does not have to evaluate the '[%0]' and works fine.
SAP sometimes expects you to qualify the Table name with an Alias. I have just added the <b>ALIAS</b> and tested the Query below and it works well. Copy the Query below and Test.
SELECT * FROM
(SELECT 'FAT_ACQ' AS TipoDoc, T1.SeriesName AS Serie, CONVERT(char(12), T0.DocDate, 3) AS DataDiRegistrazione, T0.DocNum AS Num,
T0.CardCode, T0.CardName AS NomeFornitore, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.DocTotal) ELSE CONVERT(decimal(9, 2), T0.DocTotalFC)
END AS TotaleDocumento, T0.DocCur AS Valuta, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.PaidToDate)
ELSE CONVERT(decimal(9, 2), T0.PaidFC) END AS TotalePagato, T0.DocCur AS Valuta_, T0.DocStatus
FROM [DBO].[OPCH] T0 INNER JOIN
[DBO].[NNM1] T1 ON T0.Series = T1.Series
UNION
SELECT 'NOT_CRE' AS TipoDoc, T1.SeriesName AS Serie, CONVERT(char(12), T0.DocDate, 3) AS DataDiRegistrazione, T0.DocNum AS Num,
T0.CardCode, T0.CardName, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.DocTotal) ELSE CONVERT(decimal(9, 2), T0.DocTotalFC)
END AS TotaleDocumento, T0.DocCur AS Valuta, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.PaidToDate)
ELSE CONVERT(decimal(9, 2), T0.PaidFC) END AS TotalePagato, T0.DocCur AS Valuta_, T0.DocStatus
FROM [DBO].[ORPC] T0 INNER JOIN
[DBO].[NNM1] T1 ON T0.Series = T1.Series) T0
WHERE T0.CARDCODE = '[%0]'
Suda -
Query Manager Input Date Problem
Dear expert,
When i paste the following code in query manager,
error is encountered.
What is the problem.
Regards,
Kit
Code:
declare @type int
declare @opening DateTime
declare @closing DateTime
declate @tmp DateTime
select @type = T0.ItmsGrpCod from [dbo].[oitb] T0 where T0.ItmsGrpNam = '[%0]'
select distinct @opening = T1.DocDate from [dbo].[oinm] T1 where T1.DocDate ='[%1]'
select distinct @closing = T2.DocDate from [dbo].[oinm] T2 where T2.DocDate = '[%2]'
/* swap date */
if @opening > @clsoing
begin
set @tmp = @opening
set @opeing = @closing
set @closing = @tmp
end
select ItemCode , BatchNum,
sum(Opening) as 'Opening',
sum(InQty) as 'InQty',
sum(OutQty) as 'OutQty',
sum(Closing) as 'Closing',
UnitCost ,
sum(TotalClosingStock) as 'TotalClosingStock',
sum(TotalOut) as 'TotalOut'
from (
select * from GetMovementReport(@type,@opening,@closing)
union
select * from GetSTMovementReport(@type,@opening,@closing)
) result
group by ItemCode , BatchNum, UnitCostHi Chun,
I can see couple of spelling errors:
1. declate @tmp DateTime must be: decla<b>r</b>e @tmp DateTime
2. if @opening > @clsoing should be if @opening > @cl<b>os</b>ing
3. set @opeing = @closing should be set @ope<b>n</b>ing = @closing
Hope it helps,
Adele -
Query Manager Condition Problem
Dear expert,
In B1 query manager, i found a report called 'Production Order Report' and there is a searching condition which i don't understand.
Code:
T3.CardName= '[%9]' or '[%9]' = ''
If user dose not input this parameter, how the query manager handle the query??Hi Kit,
The query code you mentioned basically says that if the [%9] variable is blank, don't filter on it, else filter on it. You can test it with this query
declare @Code varchar(15)
set @Code= ''
--set @Code = 'C1000'
select * from ocrd where (Cardcode= @Code or @Code = '')
If you run it as is, all records in OCRD will be returned, if you run it with the commented line uncommented it will return only C1000.
Hope it helps,
Adele
<i>PS: I have seen that every post you make you set as answered/solved problem already. Please make sure which problems are solved and which not. People tend to not look at solved posts that often. Every question you asked have been marked as solved before anyone replied. Were they solved?</i> -
RSDMWB - Create Model - BW Query Model Field Selection - Problem
I am trying to create a Data Mining model.
In RSDMWB I select "Create Model" in the right click context menu after selecting a Data Mining model.
In the "Create Model" window I try to select a BW Query I have previously created as source for Model Field Selection.
To find the query I press F4 and get a list of available objects sorted by InfoAreas. However, the InfoArea containing my InfoProviders and the BW Queries is not visible.
If I try selecting a BW Query that is visible this BW query does not appear in the BW Query field in the Create Model window.
However as I press 'enter' I get a field selection list!
Last but not least, I cannot type manually a BW Query name in the abovementioned BW Query field.
I am not sure it is related, but I found a note about some UI problem at model creation
"Data Mining: UI adjustment SAP Note Number: 851886". It says that BW35 SP14 should be needed. I am currently on SP12.
Does anyone have the same problem. What is the solution to it?
Claudio Ciardelli
SAP BI Consultant at Unisys.Hi,
- do you see the variables from the BW query in Crystal Reports ?
- where in the BW query are the variables defined ?
Ingo -
Problem with a SAP BW Query and Webi
Hi all,
Does anybody knows the reason why when using webi to access a SAP BW query that prompts the user for
a date, it gives an error on the format? It seems the lov is not being populated correctly. If I write
manually the value the prompt expects, it works, but if you select one of the values of the list it doesn't.
The version is XIR2 and if you create a simple query everything seems to work fine.
Any idea?
I don't know if there is something to do with language parameters or something like that.
Thank youHi Mike,
thanks for your answer.
I will try to send you a screenshot, but I cannot do it at the moment because I am not at the customer site.
I'll try to explain what we get when we running the webi report.
The lov to select from retrievs data like "K41002008" that is supposed to be a date, but if you select this value the report fails. Instead of
selecting the value, if I manually write for instance "01/01/2008", the report works fine.
I don't know if this is useful.
Once I have more info to send, I'll do it right away.
Thanks again for your time
Regards -
One more Problem with SAP query
Hi All,
I am having a problem with SAP query
Execution of SAP query transaction is leading to Dump
the dump says Field 'R01' contains no fields, syntax check on the program shows same error.
When I tried regenerating the Query in SQ01
" Query Specification cannot be use to generate list
Ranked list contains only numeric fields
Please help meGianpiero Bucchieri wrote:
> So its important to listening the following tables too: Faktura (invoice), Partner Role, Partnernumber and the requierements number. The table are EKKO EKPO AND VRKPA OR vbkd, but if I join this table the query doesn't listining any results. If I cancel this 3 or 4 table and I start the query, the listening are ok.
>
I am not sure what business process you are describing here - is it some kind of third-party sales order? If so, your join is wrong.
From VB E P, firled BANFN and BNFPO you can go to table EBAN, where in field EBELN you will find the number of the purchase order (if somebody already had an MRP+Me58 run over the PR) which will lead you to table EKKO, and EKPO.
So what we have here (essentially is):
VBAK -> VBAP -> VBEP -> EBAN -> EKKO -> EKPO
But that only solves one of your problems - you still have a long way to go to get invoices, partner and partner roles into there and I am beginning to ask myself what exactly it is you want to evaluate.
Care to explain?
Edited by: Mylène Dorias on Apr 1, 2010 2:10 PM -
Order of the selection fields in SAP QUERY
Hello All,
How can we set the order of the selection fields in SAP QUERY!
Regards!
AshishHi,
You can go into infoset and change the order.
Or you can select 1 by 1 in the same order, you want to display.
Below is the link which might help you:
help.sap.com/printdocu/core/Print46c/EN/data/.../BCSRVQUE.pdf
Please revert, if needed more clarifications
Regards,
Yashwin
Maybe you are looking for
-
Can it not possible that i can retrive it for all line items in a single qu
I have to make report for my application in which I am facing a following problem: In the application there are multiple suppliers and each supplier having multiple line items and each item having multipale events. each evant having three status GREE
-
Sometimes I will click on Firefox and it does not open. If I go into task manager it shows that it is running but the program is not active on my desktop. Today I shut down 9 instances that did not automatically close.
-
Transfer hosting payment to client
I am trying to take a site off of my 5 free webbasics sites on my creative cloud account. Using the admin console, I went to site settings--> site management--> upgrade now. I selected 'invoice my customer directly' and filled out all required info.
-
Found white powder in earphone connection and sound doesn't work, red light coming thru hole
I found a white powder accumulating in the earphone port which after cleaning out delicately, the sound on the computer is grayed off and a redlight comes thru the hole...what is happening, please help, thank you
-
The material document 4900000476 2009 does not have materials relevant for
Dear SAP Experts, I have created the Subcontracting Purchase order for the finished product.In Material Data I have entered the subcomponents.I have done the transfer posting of that particular components to that vendor with 541 Mov Type, When i go t