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/

Similar Messages

  • Query Generator Problem

    Hi, I'm having sounds like silly problem using Query Generator, if I execute this query it does not give me the 'selection list' for Fiscal Year. I'm using v8.8 PL10 but in v2007 it's working fine. If I use other table like OITM w/ fieldX =N'[%0]', its working in v8.8.
    SELECT T0.[Code], T0.[Name] FROM [dbo].[@BA_OAMD2]  T0 WHERE T0.[U_FisYear] =N'[%0]'
    thanks,
    Edited by: Jojo on Jan 8, 2011 4:55 PM
    Edited by: Jojo on Jan 8, 2011 4:56 PM

    Hi, I think the problem has nothing to do w/ the SQL, because if I run it in v2007 it works but not in v8.8.
    SELECT T0.[Code], T0.[Name] FROM [dbo].[@BA_OAMD2]  T0 WHERE T0.[U_FisYear] =[%0]
    creating inner join w/ OFPR and make where condition in OFPR.[Code] is   the alternative solution, but I want to use only the code above and let me have 'list selection'
    SELECT T0.* FROM [dbo].[@BA_OAMD2]  T0
    inner join OFPR T1 on T0.[U_FisYear] =T1.Code WHERE T1.[Code] =[%0]
    I have noticed that if I use UDT in my SQL w/ variable selection the option for 'list selection' and right click on selection criteria 'List of Items' is not working. I'm using v8.8 PL10, is it a bug?
    Edited by: Jojo on Jan 9, 2011 4:22 PM

  • SAP SQL Query Generator

    Hi Gali and Experts!!
    I am working on ECC 6.0 and have worked on 4.X version too. I was wondering if within SAP do we have any SQL Generator which will automatically generate the SQL query? We create views, we do lot of joins  on the tables and we write n number of sql queries, so is there a provision that whenever we generate a view or any other data object we can have access to the underlying SQL query that is being generated at backend. Of course, it must be generating the SQL query behind the scenes....This can be done in Peoplesoft. Please let me know.
    Thanks,
    ~Sid

    well..what about table joins....in query viewer....anyways thanks for the  input...
    ~Sid

  • Strore Procedure run through SAP B1 Query Generator

    Hello Expert
    I wanted to run strore procedure name as "p" which takes 3 parameter
    exec p '2009/01/20', '2009/01/31','Ashish Gupte'
    how i will pass on these 3 parameter through Quary Generater.
    Regds
    Dhanraj Kotian

    hi,
    Check this link,already answered.
    Passing parameters to Stored Procedures
    Jeyakanthan

  • Declarations in SAP QUERY generated ABAP Programs

    hi,
    i had created a ABAP Program through ABAP Query (SQ01,SQ02,SQ03) but i have a issue that when i transport it to the PRD server i got the run time error. The Z program which i had created is the copy of the SQ01 generated program and i had done all the includes declarations in this program. but there is a problem that it is consist of the declarations of the structures,quries .
    I want to know is it necessary to always transport the Infoset and user group and the structure which is present in the program generated .
    Please provide me guidelines for this problem  .
    Edited by: ricx .s on Jul 6, 2009 5:31 AM
    Edited by: ricx .s on Jul 6, 2009 8:07 AM

    hi,
    i had copied the program bcoz i want to chekc that it is really necessary to transport the user group and infoset so that it can achieve functionality similar to the SAP QUERY.
    is there any other way without whichi can ahieve the functionality of SAP QUERY generated program and take it into the ABAP Porgram?

  • Qyery problem in query generator

    Hi friends,
    I have one problem regarding query generator.
    I want to take the field value from the active form for query generator. I got in the demo that u have to use $[table.field]. But still I got the error.
    Query which I tried.
    SELECT 'TRUE' FROM OCRD T0 WHERE $[OCRD.CardCode] = '[%0]'
    any one who take the value from active form as a parameter and pass to the query in the query generator please send my the sample query.
    Thanks in advance.

    hi,
    Thanks for your reply.
    When I try to execute the first query from the query generator I got the error.
    Error :-
    Incorrect syntax near $4.0.0
    statement 'Received Alerts' could not be prepared.
    When I try to execute the second query from the query generator I got the error.
    Error :-
    Incorrect syntax near 'Ocrd.cardcode'
    Statement 'Search function (CSHS)' could not bne prepared.
    What would be the reason.
    Please help me in solving this problem.

  • SAP ABAP Query not generated after upgrade

    Hi All,
    Our client has upgraded from 4.6c to ECC 6.0
    In the upgraded server some SAP Queries have not been generated…and others have generated. I wanted to know why all are not generated….
    I also wanted to know if any table name exists which maintains query with generated program name…
    Please let me know your learning’s on SAP/ABAP Query if any…
    Thanks in advance

    I forgot to mention that FM will just give u the report name..wont generate it.
    I dont think the report name is saved in any tables... it is generated ...
    but u can derive the report name..if u know the user group and query name.. by concatenating those ..
    for details..look into the code for that FM

  • Performance Problems by using a subreport with a SAP BW Query

    Hello Experts,
    we have the following scenario:
    - Crystal Reports Report (CRR) on top of a SAP BW Query
    - SAP BW Query contains a member structure with Month, Year, Prior Year and total
    If I now put some details of a dataset in the main report (e.g. key is project number) and the structure and the characteristic structure in a subreport (linked e.g. by the key project number), the CRR takes like 7,5 hours to display completely. If I don´t use a subreport it takes less then 10 minutes to display (in the preview section of Crystal Reports).
    Is such a significant difference in run time normal ? I have to mention that the used query is quite complex (but this is unavoidable). And it seems also unavoidable to use the subreport to get the desired result in terms of formatting:
    - if I don´t use the subreport and more than one characteristic for the details, the structure which is supposed to display the values for each projects like this
    Month
    Year
    Prior Year
    Total
    gets 'dissolved' - first, Month is listed for each project, than Year is listed for each project, etc. This is only avoidable if use only one characteristic and its attributes, but no other characteristics (that are no attribute to the first one). But of course this is not what the customer wants...
    - so my only solution up to now is to list the desired details in the main report and then next to them the structure and the key figure data in the subreport, so that the structure is listed as in the query - but then as mentioned the performance is awful !
    Many thanks in advance for your help !
    Frank

    Hi Frank
    Have you tried using a join in the main report rather than using the subreport linked on the Project Key Code.
    Try joining the query in the main report with the query in the subreport as a single query in the main report.
    Let me know your observations.
    Regards
    Nikhil

  • 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 you

    Hi 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

  • Using Variables in Query generator

    I'm using the following query to pull a report together later to be used in a query print layout. When i specify the specific part number and customer code it returns what i expect but as soon as i add a variable it says "Must specify table"!
    SELECT T0.U_ACI_CAPT, T0.U_ACI_VDS1, T0.U_ACI_VDE1, T0.U_ACI_VSS1, T0.U_ACI_VSE1, T0.U_ACI_VDS2, T0.U_ACI_VDE2, T0.U_ACI_VSS2, T0.U_ACI_VSE2, T0.U_ACI_KWT1, T0.U_ACI_KWT2, T0.U_ACI_SPD1, T0.U_ACI_SPD2, T0.U_ACI_RNC1, T0.U_ACI_RNC2, T0.U_ACI_RNC3, T0.U_ACI_RNC4, T1.ItemCode, T1.Substitute, T0.U_ACI_VDS3, T0.U_ACI_VDE3, T0.U_ACI_VSS3, T0.U_ACI_VSE3, T0.U_ACI_KWT3, T0.U_ACI_SPD3, T0.U_ACI_RNC5, T0.U_ACI_RNC6, T0.U_ACI_ACDC, T0.U_ACI_PHSE, T0.U_ACI_50HZ, T0.U_ACI_60HZ, T0.U_ACI_OFRQ
    FROM   ((OSCN T1 INNER JOIN ITT1 T2 ON T1.ItemCode = T2.Father) INNER JOIN ITT1 T3 ON T2.Code = T3.Father) INNER JOIN "@ACI_MRBK" T0 ON T3.Code = T0.U_ItemCode
    WHERE T1.ItemCode = '[%0]' AND T1.CardCode = '[%1]'
    Anyone know how to get these things working?

    Hi,
    if your problem is similar with this symptom :
    Using SAP Business One Survey Variables (parameters) in a 'Set' SQL Statement can give an error in the Query Generator.
    here the solution I've got from SAP notes:
    In such cases you need to put in an SQL remark statement a reference field in the DB for the Survey Variable (any field).
    For Example: (to make the above query work)
    Declare @Num as numeric(2)
    Set @Num = /* T0.DocNum */ [%0]
    Select T0.DocNum
    From ORDR T0
    Where docnum = @Num
    Good luck
    Rgds,,

  • Best Practices v3.31 - SAP InfoSet Query connection

    Hi,
    I have a problem with adapting a Crystal Report from Best Practices for Business Intelligence v3.31 to SAP system. The report "Cost Analysis Planned vs. Actual Order Costs.rpt" is using SAP InfoSet Query "CO_OM_OP_20_Q1". This InfoSet Query is working fine in SAP. My SAP-User has access to the following user groups:
    - /SREP/IS_UG
    - /KYK/IS_UG
    - ZBPBI131_USR
    The Controlling Area in SAP is '1000'. Crystal Reports generates this error message:
    - Failed to retrieve data from the database.
    - Database Connector Error: "Controlling area does not exist"
    - Database Connector Error: 'RFC_CLOSED'
    But InfoSet Query "CO_OM_CA_20_Q1" has no problem with Controlling Area '1000' in Crystal Reports and is working fine in SAP!
    Can somebody help?
    Thanks in advance.
    Peter

    Hello Peter,
    I'm using Best Practices for BI v1.31 and this one also has this report you are talking about.
    I face the same issue when trying to adapt it to my ERP, but if I run it in SAP GUI, it goes smoothly without any issue.
    Please advise,
    Thanks in advance,
    Carlos Henrique Matos da Silva - SAP BusinessObjects BI - Porto Alegre/Brazil.

  • Query Generator Funny error message

    Hello Experts, Not sure if you ever seen something like this, but be great if anyone can offer me some insight...
    on a normal query with parameter I have something like thsi
    /*select from ORDR t0*/
    declare @begandate as datetime
    /* where */
    set @begandate = /* t0.docdate*/ '[%0]'
    and it runs fine with just about any table, view...etc.. But as soon as you have a UDT in SBO... put in like
    /*select from ORDR t0*/
    declare @begandate as datetime
    /* where */
    set @begandate = /* t0.docdate*/ '[%0]'
    select * from dbo.[@bos_del_pri] a inner join ordr b on b.u_prioritycode = a.code
    where b.docdate = @begandate
    it give me funny error messages, "Only one epxression can be specifed in the select list when the subquery is not intrudoced with Exist"
    This is ran at a SBO 2005B PL35... when I ran a similar query in SBO 2005A PL45 I get soemthing like
    "must specify table to select from".. I know this error message doesn't make sense, but not sure if anyone has encounter the same problem, and if yes possible solutions?
    Thank You

    Hello Friends,
    This is in accordance to provide the information that Query Generator does not work with parameters and User defined tables together. As per my experience in SQL UDT tables start with "@" and variables declared in SQL are also prefixed with "@" so SQL does not make any difference between UDT of SAP and variable of SQL. Thus we are not able to use ([%0] parameters and UDT tables) together.
    Please correct me if I am wrong.
    Please forgive me if i have posted wrong information  
    I look forward to your reply.
    Regards,
    Murtaza

  • Sales report from query generator

    Hi Experts,
    Im using query generator i had given selection criteria like, Posting date from and To, Profit centre, Numbering series name,
    query:
    SELECT T0.[DocNum], T0.[VatSum], T0.[DocTotal], T1.[PrcCode], T1.[PrcName], T1.[Balance] FROM OINV T0 , OPRC T1 INNER JOIN NNM1 T2 ON T0.Series = T2.Series WHERE T0.[DocDate] > ='[%0]' AND  T0.[DocDate] < ='[%1]' AND T1.[PrcCode] ='[%2]', T2.[SeriesName] ='[%3]'
    Error:
    1.     1)(Microsoft)SQL Native client)(SQL Server)Incorrect syntax error near u2018 u2018,Microsoft(SQL Native client) (SQL Server)statement u2018User Defined Valuesu2019 (CSHS)(1) could not be prepared.
    can u give any idea to solve this problem,
    thanks in advance,
    anand.r

    Hi,
    I made a mistake in the variables:
    SELECT     T0.DocNum, T0.VatSum, T0.DocTotal, T1.PrcCode, T1.PrcName, T1.Balance
    FROM         dbo.OPRC AS T1 INNER JOIN
                          dbo.OINV AS T0 INNER JOIN
                          dbo.NNM1 AS T2 ON T0.Series = T2.Series ON T1.PrcCode = T0.Project
    WHERE     (CAST(T0.DocDate AS VarChar) <= [%1]) AND (T1.PrcCode = [%2]) AND (T2.SeriesName = [%3]) AND (CAST(T0.DocDate AS VarChar) >= [%0])
    Kind regards,
    Hendri Wessels
    EDIT: I see that the variables do work in B1UP like this, but not in SAP Query generator.
    Edited by: Hendri Wessels on Jul 27, 2009 8:58 AM

  • CAN WE HAVE IF CONDITION IN QUERY GENERATOR

    Hi friends,
    am, trying to make use of if condition to obtain a set of values in query generator.  Its possible to retrieve the required result set using query analyser but not in query generator.  am trying to execute the following query
    if exists (select owor.u_reactor from owor,oitt where oitt.code=owor.itemcode and owor.u_reactor = 1 and owor.itemcode = '100-100')
    begin
                    select itt1.u_reactor1 from oitt,itt1 where itt1.father = oitt.code and itt1.father = '100-100'
    end
    else
    if exists (select owor.u_reactor from owor,oitt where oitt.code=owor.itemcode and owor.u_reactor = 2 and owor.itemcode = '100-100')
    begin
         select itt1.u_reac_23 from oitt,itt1 where itt1.father = oitt.code and itt1.father = '100-100'
    end
    else
    if exists (select owor.u_reactor from owor,oitt where oitt.code=owor.itemcode and owor.u_reactor = 3 and owor.itemcode = '100-100')
    begin
         select itt1.u_reactor4 from oitt,itt1 where itt1.father = oitt.code and itt1.father = '100-100'
    end
    if it is not possible to write such query in query generator  can someone help me with a workaround solution.
    Thank u
    Vaitheeswaran

    Hi,
    I dont think Nested IF Statements are allowed in PLD. The reason that u get the result in Query analyser and not in Query Generator is that SAP supports Transact SQL and many SQL Server 2000 functions are not supported.
    However there is a work around in Print Layout Designer for using IF condition by having Linked Objects. Kindly see some tutorials regarding Linked fields available on SDN site and think of some other way of implementing this nested IF query.
    Regards
    Rizwan Hafeez
    Team Lead
    SAP Addon Development Section
    Abacus Consulting - Pakistan

  • Prompt List of Values in WebI - SAP BI Variable - SAP BI Query -BI Infoset

    Hi,
    We have a Multiprovider built on an Infoset. SAP BI Infoset is built using 2 DSOs.
    There is a SAP BI Query on top of this Multiprovider.
    Multiple-Single Values type Optional Variables are created for some of the Objects of this SAP BI Query.
    Universe is created on top of this SAP BI Query, using SAP Integration kit.
    WebI is created on top of this Universe.
    Prompts are created on some of the Universe Objects, for the WebI report.
    We are facing a typical problem.
    When a WebI prompt is created on one particular object, (which also has a Multiple Single Value type Optional Variable in SAP BI Query), its List of Values is showing up only first three values in WebI. The SAP BI Variable in BEX Analyzer shows up all the 8 values for the List of Values, for the same object.
    The Output WebI report has more values for the object than shown up in the List of Values & this is the problem.
    We tried to keep the settings in Info-object, DSO, Infoset, Multiprovider = Values in Master Data (for the List of Values).
    Similar objects and similar variables for the same query / webi show all the List of Values.
    Any guidance on aspects to be checked would be helpful.
    regards,
    Rajesh K Sarin

    Problem :
    If an SAP BI Infoset is used in data modelling, and a restricted key
    figure is created in the SAP BI Query; the resultant WebI Object Prompt
    for the Info-object, only shows up LOVs which have been used for the
    restricted Key Figure. Both the things are not related except for the
    fact that some of the values for the same object are used for the
    restricted key figure.
    Details :
    We have a Multiprovider built on an SAP BI Infoset.
    SAP BI Infoset is built using 2 DSOs.
    There is a SAP BI Query on top of this Multiprovider.
    There is a restricted key figure in the sap bi query. KeyFigure "Number
    of Records" is restricted for 3 of the relevant Info-object "Meter
    Reading Status" values.
    Universe is created on top of this SAP BI Query, using SAP Integration
    kit. WebI is created on top of this Universe.
    Prompt is created on the Universe Object for Meter Reading Status, in
    the WebI report.
    List of Values is showing up only the three values in WebI (which were
    used in the Restricted Key Figure calculation).
    SAP BI Variable in BEX Analyzer for the same Info-object Meter Reading
    Status shows up all the 8 values for the List of Values.
    The Output WebI report has more values for the object than shown up in
    the List of Values & this is the problem.
    We have kept the settings in Info-object, DSO, Infoset,
    Multiprovider, Query = Values in Master Data (for the List of Values).
    When we delete the "Restricted Key Figure" from the SAP BI Query, the
    refreshed Universe and Webi have a complete set of List of Values
    applicable.   
    Steps for Reconstruction    
    1. Create Infoset
    2. Create SAP BI Query on Infoset
    3. Create Restricted Key Figure for Number of Records and few of the
    values for a characteristic info-object "X".
    4. Create BO Universe on SAP BI Query
    5. Create Webi on BO Universe
    6. Create a Prompt on the characteristic info-object "X".
    7. Check List of Values for the characteristic info-object "X" in SAP
    BI Query and WebI.
    8. LOVs in WebI are equal to the values used for restriction in the
    restricted key figure.
    9. Delete the restricted key figure from SAP BI Query.
    10. Refresh Universe
    11. Webi prompt shows all the values for the prompt on "X".

Maybe you are looking for

  • How to put a video player swf file inside a flash file

    i want to know how i can put a flash file inside a flash wbsite. i have found a tutorial http://www.ehow.com/how_4906532_within-another-flash-swf-file.html that says something like that but in this tutorial if i understand correctly it creates a new

  • Page built with a table does not display well in Internet Explorer.

    In Chrome and Safari it appears correctly (items are left justified in each column) while in Internet Explorer all columns are centered. Website is www.eventpowerli.com and it is the home page where we have the issue. I am new to building websites so

  • SB Audigy ZS EAX prol

    I have installed the sb adudigy zs and then updated the drivers but when i go to play games that use eax the game does not recognize that the card has that ability. the wierd thing is i also have windows xp 64bit installed on another partition on my

  • Email Notification after User Self Registers in OIM

    Hello there, Can you please tell me how can send an email notification to users as soon as they register themselves in OIM using the OOTB OIM Self Registration. Actually I am generating a unique User ID as a Post Insert in Create User Event Handler.

  • Adobe Download Assistant

    Frustrated, trying to Download Adobe Acrobat Pro and cant even login to Adobe Download Assistant. (Error 100 check network connection); which is fine. I have already installed the program twice because I had the same problem yesterday! What's the sol