Parameter not accepted in Query Generator

Dear Experts,
  i had tried customer aging report. it's working fine without parameter (m5.lastname = [0%]) but client needs parameter.  I'm badly stuck with following error
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. 2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'Blanket Agreement' (OOAT) (s) could not be prepared.
My query as below
SELECT  M2.cardcode 'Customer Code', M2.cardname 'Customer Name', M4.U_salManNm, m2.U_BeatCode, m4. U_salManNm,
case l.transtype
when '13' then 'INV'
when '14' then 'AR CN'
when '24' then 'INCOMING'
WHEN '30' THEN 'J.E'
else 'Other'
end 'Type',
j.BaseRef AS 'Doc.No',
l.LineMemo AS 'Remarks',
CONVERT(VARCHAR(10), l.refdate, 103)'Posting Date' ,
CONVERT(VARCHAR(10), l.duedate, 103) 'Due Date',
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 30
and (datediff(dd,l.refdate,current_timestamp))+1< 61)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "30-61 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 60
and (datediff(dd,l.refdate,current_timestamp))+1< 91)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "61-90 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 90
and (datediff(dd,l.refdate,current_timestamp))+1< 121)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "91-120 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 120
and (datediff(dd,l.refdate,current_timestamp))+1< 181)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "120-180 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 180
and (datediff(dd,l.refdate,current_timestamp))+1< 221)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "180-220 Days",
CASE
when (DATEDIFF(dd,l.refdate,current_timestamp))+1 > 220
then
case
when BalDueCred= 0 then BalDueDeb
when BalDueDeb= 0 then BalDueCred * - 1
end
end "221 + Days"
FROM JDT1 l
INNER JOIN OJDT j On j.TransId=l.TransId
LEFT OUTER JOIN OCRD M2 ON M2.cardcode= l.shortname inner join dbo.[@CQ_RTSM] m4 on m2.U_BeatCode=m4.U_RoutCode inner join ohem m5 on m5.lastname = m4. U_salManNm
WHERE l.[BalDueDeb]!='0.00' AND  m5.lastName=[%0] and
M2.cardtype= 'C'
AND
l.intrnmatch= '0'
ORDER BY
M2.CardCode, l.taxdate

Hi,
Try this:
DECLARE @name AS nvarchar(30)
/* SELECT FROM [dbo].[OHEM] T0 */
/* WHERE */
SET @name = /* T0.lastname */ '[%0]'
SELECT  M2.cardcode 'Customer Code', M2.cardname 'Customer Name', M4.U_salManNm, m2.U_BeatCode, m4. U_salManNm,
case l.transtype
when '13' then 'INV'
when '14' then 'AR CN'
when '24' then 'INCOMING'
WHEN '30' THEN 'J.E'
else 'Other'
end 'Type',
j.BaseRef AS 'Doc.No',
l.LineMemo AS 'Remarks',
CONVERT(VARCHAR(10), l.refdate, 103)'Posting Date' ,
CONVERT(VARCHAR(10), l.duedate, 103) 'Due Date',
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 30
and (datediff(dd,l.refdate,current_timestamp))+1< 61)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "30-61 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 60
and (datediff(dd,l.refdate,current_timestamp))+1< 91)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "61-90 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 90
and (datediff(dd,l.refdate,current_timestamp))+1< 121)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "91-120 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 120
and (datediff(dd,l.refdate,current_timestamp))+1< 181)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "120-180 Days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 180
and (datediff(dd,l.refdate,current_timestamp))+1< 221)
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end "180-220 Days",
CASE
when (DATEDIFF(dd,l.refdate,current_timestamp))+1 > 220
then
case
when BalDueCred= 0 then BalDueDeb
when BalDueDeb= 0 then BalDueCred * - 1
end
end "221 + Days"
FROM JDT1 l
INNER JOIN OJDT j On j.TransId=l.TransId
LEFT OUTER JOIN OCRD M2 ON M2.cardcode= l.shortname inner join dbo.[@CQ_RTSM] m4 on m2.U_BeatCode=m4.U_RoutCode inner join ohem m5 on m5.lastname = m4. U_salManNm
WHERE l.[BalDueDeb]!='0.00' AND  m5.lastName = @name and
M2.cardtype= 'C'
AND
l.intrnmatch= '0'
ORDER BY
M2.CardCode, l.taxdate
Thanks & Regards,
Nagarajan

Similar Messages

  • DBMS_SQL.PARSE Not Accepting My Query

    hi all ,
    i am trying to generate a ascii file from my procedure ..
    my ascii file should contain data like the below
    "7200", "SMITH","10-AUG-1981"
    DBMS_SQL.PARSE(l_cursor,'SELECT '"'||empno||'"'||','||'"'||ename||'"'||','||'"'||dob||'"'FROM EMP',dbms_sql.native);
    PLS-00103: Encountered the symbol "'||empno||'" when expecting one of the
    following:
    ) , * & | = - + < / > at in is mod remainder not rem => ..
    please give me any idea how to resolve this ..

    One sec ..i have again a small doubt can we pass parameters to this query
    DBMS_SQL.PARSE(l_cursor,q'[SELECT '"'||empno||'","'||ename||'","'||dob||'"' FROM EMP]',dbms_sql.native);
    i want to include where condition like FROM_DATE >= P_FROM_DATE
    TO_DATE <=P_TO_DATE
    These P_FROM_DATE and P_TO_DATE i am passing as input parameters to my procedures ..can i use them inside this query ?

  • Query not accepted by Record Group

    Hi,
    The below mentioned query is running in oracle 3.3.4.0.0.(which i'm using in my work) and toad also but in forms 5.0 it is not accepting this query.when i enter this query in existing record group then it shows the error ' error frm-12001'
    -- cannot create the rcord group (check your query).I have declared the variable in forms
    Can someone pls tell me whats wrong with this sql query ?
    Select Aim_Item_Desc.
    From Lib_Annexure_Item_Master A,DEP_STATUS_MASTER b
    Where Aim_Type_Id = (Select Atm_Type_Id
    From Lib_Annexure_Type_Master
    Where Upper(Atm_Type_Desc) = 'CONSTITUTION')
    And (Upper(Aim_Item_Desc) in('TRUST','H U F','SOCIETY','PROPRIETORSHIP')
    And :Global.Fv_C_Des_Ind='P')
    Or ( Upper(Aim_Item_Desc) in ('Public limited company','Private limited company')
    And :Global.Fv_C_Des_Ind ='Q')
    Or (Upper(Aim_Item_Desc) ='PARTNERSHIP'
    And :Global.Fv_C_Des_Ind ='R')
    Or (Upper(Aim_Item_Desc) ='Individual'
    Or :Global.Fv_C_Des_Ind ='S');

    Gowtham1232 wrote:
    Hi,
    The below mentioned query is running in oracle 3.3.4.0.0.Seriously? Is there really a computer left that can run a version of oracle that old?
    (which i'm using in my work) and toad also but in forms 5.0 it is not accepting this query.when i enter this query in existing record group then it shows the error ' error frm-12001'
    As it's forms you may want to ask in the forms forum.

  • 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

  • User defined query parameter in query generator

    Hi All,
    i am using query generator in SAP to print some records of user defined query. precisely, the details about sales employees are to be printed. now the columns which exist in the database (ie. sales employee code, name, cardcode) etc can be given as a parameter like [%0] and [%1]. but some user defined parameter such as sales commission does not show as such parameter. i want one column as
    select T0.doctotal, (T0.doctotal * [%0]) / 100  as brokerage from OINV T0
    --where [%0] is some commission percentage that the user will give while running this query
    This query gives correct results but it gives the parameter name as 'doctotal' while showing. any idea as to how to handle it properly in SAP?
    thanks in advance,
    Binita
    Edited by: Binita  Joshi on Sep 8, 2009 3:35 PM

    I sometimes defined a UDT only for getting the appropriate parameter entering window. The table has no data; I used it only for its field names in this window.
    (The parameter request can be placed inside a comment and the entered value is used setting an SQL variable like this:
    declare @d datetime
    /*select t.createdate from ordr t where t.createdate=[%0]*/
    set @d=[%0]
    This SQL variable can be used later in the real query.)

  • In Query mode, date items does not accepts more than 10 characters..Why?

    Dear All,
    In my form, While querying my date items, it does not accepts more than 10 Characters. Could it be changeable.
    Actually i want to search like greater than specified date( >01/01/2007 ).
    But i can specify like >01/01/07. After tabbing out from that item, it displays like >01/01/200.
    How to overcome this issue.
    Please help.
    Regards,
    Balaji

    You are absoletely correct Francois!
    Previously i have made a mistake that both of my maximum length and query length property to 20. That time it was not worked. Now i changed my maximum length to the old one like 11 and i changed only the query length to 20.
    Now it is working. I understood the concept wrongly.
    Thanks Francois!

  • Query..for Field should not accept the manual entry

    i wann query for remarks Field in JE It should Not accept the manual entry it should accept only sys drop data.
    Thanks & Regards
    yogi

    For this field level authorization, you may only use SDK or SP to reach your goal.  SP would be difficult to use in this case.
    Thanks,
    Gordon

  • CGI Parameter sequence not accepted. cal standalone

    calendar standalone
    I've downgraded to Apache 2.0.59 from 2.2 to try and get fastcgi working.
    Now I can't get /ocad-bin/ocad.cgi working. This worked in 2.2. cripes!
    <begin>
    An error occurred during processing.
    Information: CGI parameter sequence not accepted.
    </end>
    this is what a fresh apache 2.0.59 and only.....
    SetEnv ORACLE_HOME C:\product\10.1.2\ocs_3
    include "C:\product\10.1.2\ocs_3\ocad\config\ocad.conf"
    at the end of httpd.conf
    Does any body have a clue when this means, or a possible fix.
    Cheers
    Rob

    Another case closed.
    Seems the calendar interface needs '?sub=web'
    for the CGI to respond. Astonishing that it doesn't redirect automatically. I'm sure there's a reason for this which us lesser beings can't even begin to contemplate understanding.
    Hey ho. Another problem solved through DPI*
    Cheers
    Rob
    * Determination, Perspiration and Inspiration.

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

  • 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

  • Query Generator/Variables

    In Query Generator I need to prompt for dates using [%0] and [%1].  However, I get an error once I input dates.  Do the query variables come in as string format and if so, how do I compare a date input

    I'm not a specialist on this, but I have to learn this for the Certification exam. So, I played with Queries and noticed that the date format is driven by the Date format parameter in Administration - General settings - Display.
    I tried the following query:
    SELECT CardCode, UpdateDate FROM OCRD T0 WHERE T0.UpdateDate >= '[%1]'  ORDER BY T0.UpdateDate
    When the date format is CCYY-MM-DD it works with 2003-11-31 and 03-11-31 and 03.11.31.
    When the date format is set to DD.MM.YYYY the query runs OK with 31.12.02.
    HTH
    Juha

  • How to get report (SQL Query) generating Run Time

    There is a Standard report of Payroll which show employee transfer information on the bases of location, grade job or organization, now to get actual query which is generated by run time in report builder including whether single column parameter or lexical parameter " because currently the query in not complicate but the parameter and lexical parameter is much more due to this not quite easy to under stand just copy past it into toad or pl/sql developer,
    Kindly share your experience to get such kind of query in you working time.
    thanks

    Here i try to explain contain of query.
    Parameter
    P_DEPTNO = 10
    P_WHERE_CLAUSE := ' AND EMPNO IS NOT NULL AND SALARY > 100'
    SELECT * FROM EMP
    WHERE DEPTNO = P_DEPTNO
    &P_WHERE_CLAUSE
    REPROT WILL GENERATE QUERY AT RUN TIME IS LIKE THAT
    SELECT * FROM EMP
    WHERE DEPTNO = 10
    AND EMPNO IS NOT NULL AND SALARY > 100
    Now i want to get this query out(Run time) by doing any oracle database feature or sth similar.
    thanks

  • 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

  • How to do this in Query Generator?

    Dear Experts,
    Please check my following query I've written in Query Generator.
    /* select from dbo.OCRD t0 */
    declare @BP nvarchar(20)
    set @BP=/* t0.CardName */ '[%0]'
    declare @Dt1 datetime
    declare @Dt2 datetime
    set @Dt1=/* Start Date */ [%1]
    set Dt2=[%2]
    select distinct t1.po, Max(t1.supplier) Supplier,Max(t1.process) Process, Max(t1.OrderNo) OrderNo,Max(t1.Date) Date,
    isnull((select sum(t2.Quantity) from dbo.ir t2 where t2.po=t1.po and t2.TType<0),0) Issued,
    isnull((select sum(t3.Quantity) from dbo.ir t3 where t3.po=t1.po and t3.TType>0),0) Received,
    isnull((select sum(t2.Quantity) from dbo.ir t2 where t2.po=t1.po and t2.TType<0),0)-isnull((select sum(t3.Quantity) from dbo.ir t3 where t3.po=t1.po and t3.TType>0),0) Balance
    from dbo.ir t1 where t1.Supplier=@BP and (t1.Date>=@Dt1 and t1.Date<=@Dt2) group by t1.po
    The Query works well. But for the the lines
    set @Dt1=/* Start Date */ [%1]
    set Dt2=[%2]
    it displays BP Code as the prompt next the text boxes meant for inputting dates. I would like to display 'Start Date' and 'End Date' respectively for Dt1 and Dt2.
    Please explain me how to go about it.
    Thanks in advance.
    Regards
    Anand

    declare @Dt1 datetime
    set @Dt1=/* Start Date */ [%0]
    declare @Dt2 datetime
    set @Dt2=/* End Date */ [%1]
    /* select from dbo.OCRD t0 */
    declare @BP nvarchar(20)
    set @BP=/* t0.CardName */ '[%2]'
    I've changed. When I run the query the input box does not appear, the query shows only a blank table.
    Thanks
    Anand

  • Difference in Query generated by OBIEE for same report

    Hi,
    I am using a a report(X) in a filter condition.
    I am seeing a peculiar issue with OBIEE server. When i am running a report(X) alone, the query generated is different. But when i am using the same report in filter condition of other report(Y), the same report is generating some other query. The first report(X) is running fine but the second(Y) is not running at all.
    Case 1(Report X) Query: The report is breaking into 3 parts for different fact tables and combining the data to give result.
    Case 2(Report Y): A single query is being formed and within it is fecthing the data from different fact tables using subqueries.
    Case2 is creating a lot of problem as the performance is totally poor.
    Any suggesstions??
    Thanks
    Tataji

    Hi, we haven't debugged the application or traced the query against the production server (it's in our customer's office) buy I think there's no difference since the query itself has been tested using sqldeveloper against both servers (XE 11.2 and Enterprise 11.1) and the behavior is consistent. By consistent I mean:
    - The query executed via sqldeveloper against Oracle XE 11.2 runs ok and so does the application.
    - The query executed via sqldeveloper against Oracle Enterprise 11.1 fails with an ORA-01790 error, and so does the application (exceptions are being logged in the Event Log).
    To sum up: the same query runs ok in Oracle XE 11.2 and fails in Oracle Enterprise 11.1.
    Additional information: we have tried explicit casting the NULL literals to the corresponding data types (in the UNION ALLs) and the query works fine in both versions. ¿Is there an option in ODAC to tell the query generator to write this explicit castings?
    Regarding the DB schema and the LINQ query, I'll be sending them asap.
    Regards,
    Ernesto.

Maybe you are looking for

  • Windows 8.1 and icloud doesnt sync photos

    Just installed icloud to my windows 8.1 laptop and it doesnt sync photos at all with my air2 (8.1.2). I have tried to sign in, out, middle, top, bottom, front, behind or whatever... Changed compatibility to Win7 etc. Turned off/on icloud sync/photos/

  • Credit card payment through f110

    Hello All I have created ICICI Credit card as a vendor account.  I accounted all expenses and created to vendor a/c. My payment term is Monthly ones or 25th of every month.  I want to give cheq through f110 how can I configerate this.

  • IE renders spry accordion glitchy and unusable (FF works perfectly)

    Hi everyone, I'm making my Dad a website and I've adapted a spry accordion into a large table that expands the row over mouseover. The problem is that internet explorer (only tested in 7 so far) renders it almost unusable, however it looks fine in go

  • RFFOEDI1 Payment Summary

    In RFFOEDI1 there is a payment summary check box. I need to be able to configure the payment summary to print my company logo. Any suggestions???

  • Latency between multiple outputs

    Goal: backing tracks in output 1-2, backing tracks and click in output 3-4 Notes: click track is it's own playback aif due to tempo changes in the songs. Hitting play triggers both the backing tracks and separate click track simultaneously. I have on