Query gives error

Hi All,
I am encountering such problems time and again while running such queries in Query wizard : following is my query and it runs if I dont add the 'where' clause.
SELECT T0.[CardName] as 'Customer Name' , T0.[NumAtCard], T0.[DocNum], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[Price], T0.[DocTotal], T1.[StockPrice] as 'Final ItemCost',
   convert(varchar,(select sum(isnull(T2.stockprice * T2.Quantity,0)) from dbo.DLN1 T2 where T1.docentry = T2.docentry))  as [Total Item Cost],
(T1.[Quantity] * T1.[Price])-(T1.[StockPrice] * T1.[Quantity])  as 'Profit on Sale of Item', T1.BaseRef as 'Sales Order No.'  FROM dbo.ODLN T0  INNER JOIN dbo.DLN1 T1 ON T0.DocEntry = T1.DocEntry
if at the end , I add
where T1.BaseRef  = [%0]
or
where T1.BaseRef  = Isnull([%0], T1.Baseref)
it gives me the error 'Must specify the table to select from'.
what is that I am doing wrong?
thanks,
Binita

Hi Binita,
Apparently it's because you mentioned T1 in the subquery,
   convert(varchar,(select sum(isnull(T2.stockprice * T2.Quantity,0)) from dbo.DLN1 T2 where T1.docentry = T2.docentry))  as [Total Item Cost],
If you omit the subquery then the query will run with the condition WHERE T1.BaseRef = '[%0]'.
I think Query Generator in SAP B1 has problem in recognizing parameters that refer to tables which are mentioned in subquery.
You need to declare the parameters as variables outside the query and then use the variables in the conditions.
You can use Gordon's query anyway.
Cheers,
Marini

Similar Messages

  • Select query gives error in Code inspector and extended program check

    Hi,
    I have a query .
    SELECT pernr
      FROM pa9100
      INTO TABLE t_nca_tab
      WHERE endda EQ c_date AND
      z_nca_required EQ c_yes.
    This query gives me an error in Code inspector like :
    Large table pa0001: No first field of table index in WHERE  condition
    I have one more query that gives error in extended program check
    SELECT SINGLE stell ename
          INTO (g_stell, g_name)
          FROM pa0001
          WHERE pernr EQ wa_nca_tab-pernr AND
                endda EQ c_date.
    The warning says:
    *In "SELECT SINGLE ...", the WHERE condition for the key field "SEQNR" does not
    test for equality. Therefore, the single record in question may not be unique.*
    Its too urgent.
    Please reply.
    Regards,
    Binay.

    The first field is PERNR .. so if UR not giving pernr it will fetch
    all the data from the said table and between the given dates ..
    Check if this is your requirement ...
    write the select as ...
    where r_pernr is a range ...
    SELECT pernr
    FROM pa9100
    INTO TABLE t_nca_tab
    WHERE pernr in r_pernr  <----
                 endda EQ c_date AND
                 z_nca_required EQ c_yes.
    As UR using select single it's expecting to use all the key
    fields in the where condition ...
    U can ignore this warning message

  • Quote Form: Repeatively Query gives Error:ORA-06502: PLSQL numeric or value

    Hi,
    I am trying to query the sales order form (in Order Management) with the order number.
    Steps to Reporduce:
    Without closing the sales order form, query the same/different order number repetively again and again (upto 30 times) in sales order form and i am getting the following error. It might be due to the form buffer error i think, but i want to know how to resolve this issue.
    ORA-06502 : PLSQL : numeric or value error
    I have suggested the workaround as closing the form after querying every 15 times, but the customer needs a permanent fix by querying continously without closing the form, they want to query the record. Please suggest how to resolve this issue.
    Thanks

    The errors comes when in variable or fields data is coming more than the maximum length it.
    e.g
    declare
    vcheck varchar2(1) := 'ABC'; ---Errorplz share your code where you feel the problem might occurring usually POST-QUERY trigger.
    Baig,
    http://baigsorcl.blogspot.com

  • BOE XI 3.1 SP3 Webi on SAP BW Query gives errors

    Fri Sep 24 21:01:17.061 ThreadID<2844> SAPMODULE : RFC function call MDDataProviderBW.GetHierarchies returned E
    Fri Sep 24 21:01:17.061 ThreadID<2844> SAPMODULE : Error info:
         Message Class               BRAINOLAPAPI
         Message number               12
         Message                    Unknown error when executing MDX
         Application log number          
         Application log serial number     0
         Message 1               
         Message 2               
         Message 3               
         Message 4               
         Parameter Name                    
         Lines in parameter          0
         Field in parameter

    Hi Ingo,
    I'm Experiencing the same issue described here. My situation is the following. I have a webi report on top of an OLAP universe where the bex queries were running in BW 3.5. Later the client upgraded the system to BW 7.01 SP6 and when trying to re run the webi report it started to fail. I then activated to logging to see what the problem could be and found this error. It looks to me that a dimension is giving the error. Any tips to understand this log?
    Thu Nov 25 13:05:47.703: 5564: SAPMODULE: STRUCTURE: Error info:
         Message Class               BRAINOLAPAPI
         Message number               12
         Message                    Error desconocido en la ejecución MDX
         Application log number          
         Application log serial number     0
         Message 1               
         Message 2               
         Message 3               
         Message 4               
         Parameter Name                    
         Lines in parameter          0
         Field in parameter          
         System                    B03CLNT222
    Thu Nov 25 13:05:47.703: 5564: SAPMODULE: STRUCTURE: RFC function call MDDataProviderBW.GetHierarchies failed.  Error desconocido en la ejecución MDX
    Thu Nov 25 13:05:47.734: 5564: SAPMODULE: STRUCTURE: RFC function call MDDataProviderBW.GetHierarchies failed.  Error desconocido en la ejecución MDX
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Created
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount raised to 3
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount lowered to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Created
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount raised to 3
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount lowered to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 344 (7D1A68F0): Created
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 344 (7D1A68F0): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount raised to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 344 (7D1A68F0): Refcount raised to 3
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 343 (7D1A4370): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 344 (7D1A68F0): Refcount lowered to 2
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 344 (7D1A68F0): Refcount lowered to 1
    Thu Nov 25 13:05:47.734: 5564: SAPMODULE: No Value: Error getting hierarchies for dimension (Cube ZDU_O06/QRY_VAR_PENDING): Error desconocido en la ejecución MDX
    Thu Nov 25 13:05:47.734: 5564: MEMORY: StringMessageInsert: Instance 342 (7D1A43F0): Refcount lowered to 0
    The BOE Platform is BOE XI 3.1 SP2 FP2.7
    Any ideas of what could be?
    Kind regards,
    xtian
    Edited by: xtianw on Nov 25, 2010 5:46 PM

  • Query in 10g DB gives error when size of element exceeds 4000 characters?

    I used this query give in this thread Need help in reading a _fmb.XML and writing the item properties to a table
    select x1.item_name
         , x1.item_type
         , x2.property
         -- to convert back entities such as
    to their character values :
         , utl_i18n.unescape_reference(x2.property_value) as property_value
         -- parent information :
         , x1.parent_item_name
         , x1.parent_item_type
    from xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /Module/descendant::*[@def:Name]
            return element item {
              attribute item_name {data($i/@def:Name)}
            , attribute item_type {local-name($i)}
            , attribute parent_item_name {data($i/parent::*/@def:Name)}
            , attribute parent_item_type {local-name($i/parent::*)}
            , $i
           passing xmltype(bfilename('TEST_DIR','length_test_fmb.xml'), nls_charset_id('AL32UTF8'))
           columns item_name         varchar2(50) path '@item_name'
                 , item_type         varchar2(50) path '@item_type'
                 , parent_item_name  varchar2(50) path '@parent_item_name'
                 , parent_item_type  varchar2(50) path '@parent_item_type'
                 , item              xmltype      path '.'
         ) x1
       , xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /item/*/attribute::def:*
            let $propname := local-name($i)
            where $propname != "Name"
            return element p {
              element name {$propname}
            , element value {data($i)}
           passing x1.item
           columns property       varchar2(50)  path 'name'
                 , property_value varchar2(4000) path 'value'
        ) x2
    ;This works perfectly, but I tried a form which has a program unit which exceeds 4000 characters, i.e. I converted a fmb to xml, I.E. PROPERTY VALUE. When you run the query then you get error "function returned value too large".
    I tried changing the VARCHAR2 to CLOB but then you get another error.
    We cannot migrated to 11g as yet, so how to handle this in 10g?
    Any help would be greatly appreciated.
    Edited by: Channa on Oct 25, 2011 6:40 AM

    Hi Channa,
    I should have mentioned it in the previous thread, a sound approach to the overall requirement would be to use object-relational storage for loading XML documents in the database.
    You can read more here : http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb03usg.htm#g1055369
    However, that's not possible if we use the DUMP=ALL option to convert Forms files to XML because the generated files do not conform to the Forms XML schema.
    So unless you decide to use DUMP=OVERRIDDEN, you're stuck with the current situation.
    If I remember correctly, the ability to project large strings as CLOB with XMLTable was added in version 10.2.0.4.
    You're not out of options though.
    Here are two, one being "dirtier" than the other...
    1) Divide the property value into multiple chunks of 4000 characters (or less if the db uses a multi-byte character set), then rebuild the string as CLOB in the SELECT clause :
    select x1.item_name
         , x1.item_type
         , x2.property
         , to_clob(utl_i18n.unescape_reference(x2.property_value1)) ||
           to_clob(utl_i18n.unescape_reference(x2.property_value2)) as property_value
         , x1.parent_item_name
         , x1.parent_item_type
    from xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /Module/descendant::*[@def:Name]
            return element item {
              attribute item_name {data($i/@def:Name)}
            , attribute item_type {local-name($i)}
            , attribute parent_item_name {data($i/parent::*/@def:Name)}
            , attribute parent_item_type {local-name($i/parent::*)}
            , $i
           passing xmltype(bfilename('TEST_DIR','module2.xml'), nls_charset_id('AL32UTF8'))
           columns item_name         varchar2(50) path '@item_name'
                 , item_type         varchar2(50) path '@item_type'
                 , parent_item_name  varchar2(50) path '@parent_item_name'
                 , parent_item_type  varchar2(50) path '@parent_item_type'
                 , item              xmltype      path '.'
         ) x1
       , xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /item/*/attribute::def:*
            let $propname := local-name($i)
            let $propval := data($i)
            where $propname != "Name"
            return element p {
              element name {$propname}
            , element value1 {substring($propval,1,4000)}
            , element value2 {substring($propval,4001,4000)}
           passing x1.item
           columns property        varchar2(50)   path 'name'
                 , property_value1 varchar2(4000) path 'value1'
                 , property_value2 varchar2(4000) path 'value2'
        ) x2
    ;2) Output the property value as a text() node (XMLType datatype) and serialize as CLOB in the SELECT :
    select x1.item_name
         , x1.item_type
         , x2.property
         , dbms_xmlgen.convert(x2.property_value.getclobval(),1) as property_value
         , x1.parent_item_name
         , x1.parent_item_type
    from xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /Module/descendant::*[@def:Name]
            return element item {
              attribute item_name {data($i/@def:Name)}
            , attribute item_type {local-name($i)}
            , attribute parent_item_name {data($i/parent::*/@def:Name)}
            , attribute parent_item_type {local-name($i/parent::*)}
            , $i
           passing xmltype(bfilename('TEST_DIR','module2.xml'), nls_charset_id('AL32UTF8'))
           columns item_name         varchar2(50) path '@item_name'
                 , item_type         varchar2(50) path '@item_type'
                 , parent_item_name  varchar2(50) path '@parent_item_name'
                 , parent_item_type  varchar2(50) path '@parent_item_type'
                 , item              xmltype      path '.'
         ) x1
       , xmltable(
           xmlnamespaces(default 'http://xmlns.oracle.com/Forms', 'http://xmlns.oracle.com/Forms' as "def")
         , 'for $i in /item/*/attribute::def:*
            let $propname := local-name($i)
            where $propname != "Name"
            return element p {
              element name {$propname}
            , element value {data($i)}
           passing x1.item
           columns property        varchar2(50)   path 'name'
                 , property_value  xmltype        path 'value/text()'
        ) x2
    ;Edited by: odie_63 on 25 oct. 2011 17:03
    Edited by: odie_63 on 25 oct. 2011 17:04

  • See my query and error, see my query and error

    hi master
    sir i use inner query but not run
    please see my query with error
    query :==========
    select accid as acccode,fstatus, case when fstatus=1 then
    (select sum(drbal) from accbal where substr(accbal.accid,1,length(acccode))=acccode)
    end what
    from chartofacc
    error :========
    SQL> /
    (select sum(drbal) from accbal where substr(accbal.accid,1,length(acccode))=acccode)
    ERROR at line 2:
    ORA-00904: "ACCCODE": invalid identifier
    please sir give me any idea *

    Does this column ACCCODE exist in your table accbal?
    The columns in the outer query will not be visible in the inner query but the vise versa is true.

  • Select...Model query giving error when compiled in form6i's WVI trigger

    friends i have this installed at my home;
    Forms [32 Bit] Version 6.0.8.25.2 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    and i have a query which is running fine at the back-end,
    select avgprice
    from (
    select t.*
    from (
    select seq_no
    , invxh_DATE
    , INVXH_code
    , invxh_No
    , invxH_total_qty
    , INVXH_net_AMOUNT_Scy INVXH_net_AMOUNT_Scy
    , balqty
    , ROUND(balamt, 3) balamt
    , ROUND(avgprice, 10) avgprice
    , ROUND(cost, 3) cost
    from (select b.*,
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    row_number() over (order by INVXH_date) seq_no
    from invs_TXN_head b
    where INVXH_BROK_code = 'B00001'
    aND INVXH_Securit_CODE = 'S00001'
    and INVXH_date < to_DATE('25/02/2008','dd/mm/yyyy'))
    model
    dimension by (seq_no)
    measures (invxh_DATE
    , INVXh_code
    , INVXH_no
    , INVXH_total_qty
    , balqty
    , INVXH_net_AMOUNT_Scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules (
    balamt[seq_no is any] = nvl(balamt[cv() - 1], 0) +
    decode(INVXH_code[cv()], 'BUY', INVXH_net_AMOUNT_Scy[cv()] , -(balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()]) ) ,
    cost[seq_no is any] = decode(INVXH_code[cv()], 'SEL', balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()], 0),
    avgprice[seq_no is any] = decode(INVXH_code[cv()], 'BUY', balamt[cv()] /
    balqty[cv()] , avgprice[cv() - 1])
    ) t
    order by seq_no desc
    ) where rownum = 1
    AVGPRICE
    2.17612187560
    but when i try make use of this query in 1 of my form Item's When-Validate-Trigger, replacing with form variables,
    declare
         avgprice1 number;
    begin
    select avgprice INTO AVGPRICE1
    from (
    select t.*
    from (
    select seq_no
    , invxh_DATE
    , INVXH_code
    , invxh_No
    , invxH_total_qty
    , INVXH_net_AMOUNT_Scy INVXH_net_AMOUNT_Scy
    , balqty
    , ROUND(balamt, 3) balamt
    , ROUND(avgprice, 10) avgprice
    , ROUND(cost, 3) cost
    from (select b.*,
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    row_number() over (order by INVXH_date) seq_no
    from invs_TXN_head b
    where INVXH_BROK_code = :INVXH_brok_CODE
    aND INVXH_Securit_CODE = :invxh_Securit_CODE
    and INVXH_date < to_DATE('25/02/2008','dd/mm/yyyy'))
    model
    dimension by (seq_no)
    measures (invxh_DATE
    , INVXh_code
    , INVXH_no
    , INVXH_total_qty
    , balqty
    , INVXH_net_AMOUNT_Scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules (
    balamt[seq_no is any] = nvl(balamt[cv() - 1], 0) +
    decode(INVXH_code[cv()], 'BUY', INVXH_net_AMOUNT_Scy[cv()] , -(balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()]) ) ,
    cost[seq_no is any] = decode(INVXH_code[cv()], 'SEL', balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()], 0),
    avgprice[seq_no is any] = decode(INVXH_code[cv()], 'BUY', balamt[cv()] /
    balqty[cv()] , avgprice[cv() - 1])
    ) t
    order by seq_no desc
    ) where rownum = 1;
    :INVXH_gainloSs_AMOUNT_lcy := :INVXH_NET_AMOUNT_Scy - (:INVXH_TOTAL_QTY * avgprice1);
    end;
    it does'nt get complied & gives error as;
    Encountered the symbol "(" when expecting one of the following
    +, from+
    its actually pointing to this line of the above query;
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    at this position...*OVER (...*
    is it a form6i-10g compatibility issue or what else..?
    TYVM

    ok,, i have put my code in a stored function 'WTAG1' in the database. its working fine at the back-end.
    i am calling it now from forms WVI trigger in this way;
    declare
         avgprice1 number(14,10);
    begin
         avgprice1 := GET_WTAVG(:invxh_BROK_code, :INVXH_securit_CODE, TO_DATE(:INVXH_DATE,'DD/MM/YYYY'));      
    :INVXH_gainloSs_AMOUNT_lcy := :INVXH_NET_AMOUNT_Scy - (:INVXH_TOTAL_QTY * NVL(avgprice1,0));
    end;
    at run time m getting ORA-06502 ERROR,dont know why..?
    :INVXH_gainloSs_AMOUNT_lcy property is 9,999,999.000
    AT the back-end the query works fine aS below;
    SQL> @WTAG1
    Function created.
    SQL> SELECT GET_WTAVG('B00001','S00001',TO_DATE('27/4/2008','DD/MM/YYYY')) AG FROM DUAL;
    AG
    2.1761218756
    this iS my function;
    create or replace function GET_WTAVG(P_BROK_CODE IN VARCHAR2, P_SECURIT_CODE IN VARCHAR2, P_DATE IN DATE)
    return NUMBER Is
      v_avgprice NUMBER(14,10);
    BEGIN
    SELECT avgprice INTO V_avgprice
      FROM   (SELECT t.*
              FROM   (SELECT seq_no,
                             invxh_date,
                             invxh_code,
                             invxh_no,
                             invxh_total_qty,
                             invxh_net_amount_scy invxh_net_amount_scy,
                             balqty,
                             round(balamt, 3) balamt,
                             round(avgprice, 10) avgprice,
                             round(cost, 3) cost
                      FROM   (SELECT b.*,
                                     SUM(decode(invxh_code,
                                                'BUY',
                                                invxh_total_qty,
                                                -invxh_total_qty)) over(ORDER BY invxh_date) balqty,
                                     row_number() over(ORDER BY invxh_date) seq_no
                              FROM   invs_txn_head b
                              WHERE  invxh_brok_code = P_BROK_CODE
                              AND    invxh_securit_code = P_sECURIT_CODE
                              AND    invxh_date < to_char(P_DATE,'DD/MM/YYYY'))
    model
    dimension BY(seq_no)
    measures(invxh_date
    , invxh_code
    , invxh_no, invxh_total_qty
    , balqty
    , invxh_net_amount_scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules
    balamt[seq_no IS ANY] = nvl(balamt[cv() - 1], 0) +
                            decode(invxh_code[cv()], 'BUY', invxh_net_amount_scy[cv()], - (balamt[cv() - 1] /
                            balqty[cv() - 1] * invxh_total_qty[cv()])),
    cost[seq_no IS ANY]   = decode(invxh_code[cv()], 'SEL', balamt[cv() - 1] /
                            balqty[cv() - 1] * invxh_total_qty[cv()], 0),
    avgprice[seq_no IS ANY] = decode(invxh_code[cv()], 'BUY', balamt[cv()] / balqty[cv()], avgprice[cv() - 1]))) t
              ORDER  BY seq_no DESC)
      WHERE  rownum = 1;
    RETURN V_avgprice;
    exception
    when TOO_MANY_ROWS
    then return 'Too Many Authors in that State';
    when NO_DATA_FOUND
    then return 'No Authors in that State';
    when others
    then raise_application_error(-20011,'Unknown Exception in authName Function');
    END GET_WTAVG;
    /

  • Query running error

    Hi, all.
    In our PROD system we faced one problem. When we run query we get error
    "Cannot create characteristic combination: type \BI0\0100000100" doesn't exit"
    "Special situation CX_SY_CREATE_DATE_ERROR"
    I think we have problem with temporary database objects what is described in SAP note 1139396. And we execute report "SAP_DROP_TMPTABLES", but it doesn't help.
    Can anybody help us with this problem?
    wbr, Fanil. 

    This probably won't solve your issue... but have you tried to regenerate your query using RSRT -> Generate button?  I've found that this feature has helped resolved some query execution errors after transporting.
    Can you give us any information about what dates are used in your query (standard or custom, any variables created on these date InfoObjects?).  Thanks!

  • Query view error

    Hi
    When I open my query I get an error which says internal error when generating the history use a different view then i click on ok then i have to choose infoares tab i cannot chooose history view as it gives  error.
    Regards,
    Nikhil.

    Go to transaction spro and click the SAP Reference IMG button. Go to Business Information Warehouse, Reporting relevant settings, general reporting settings, and select activate personalization in BEx. This will solve your problem.
    Regards

  • SQL Query giving error in SAP B1 8.82 PL 09

    Hi all,
    Please check the query below.
    If we remove the Where condition from the Query it works fine.
    Otherwise it gives error. The error screen is also attached.
    [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types ntext and
    ntext are incompatible in the equal to operator. 'Blanket Agreement'(OOAT)(OUQR)

    Dear Nagarajan K,
    First of all Thank You for prompt reply to my query.
    Select * from oinv T0 where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    The issue with the above posted query is if you remove the filter conditions i.e where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    The query works.
    Put the filter condition back and it gives eror:
    [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types ntext and
    ntext are incompatible in the equal to operator. 'Blanket Agreement'(OOAT)(OUQR)
    What is possibly going wrong because data is there.

  • My code not give error nut not give pdf report output

    hi master
    sir see my code not give error nut not give pdf report output
    String reportSource = "./WEB-INF/reports/mfa.jasper";
    String reportDest = "./reports/mfa1.html";
    Connection conn = null ;
    Statement msqlStatement = null ;
    ResultSet mrs = null ;
    Connection mconn = null ;
    ExternalContext econtext = getExternalContext();
    InputStream stream = econtext.getResourceAsStream(reportSource);
    if (stream == null) {
    throw new IllegalArgumentException("Unknown report name '" + reportSource
    + "' requested");
    try {
    String mfat = ac_categoryDataProvider.getCachedRowSet().getDataSourceName();
    javax.naming.Context mctx = new javax.naming.InitialContext() ;
    DataSource mds = (DataSource)mctx.lookup(mfat);
    Connection mcon= mds.getConnection();
    mcon.setAutoCommit(false) ;
    JasperPrint jasperPrint = null;
    //getSessionBean1().getTripRowSet(),
    //getSessionBean1().getAc_categoryRowSet(), mfat getSessionBean1().getAc_categoryRowSet()
    jasperPrint = JasperFillManager.fillReport(stream, null,mcon);
    JRExporter exporter = null;
    HttpServletResponse response = (HttpServletResponse)econtext.getResponse();
    FacesContext fcontext = FacesContext.getCurrentInstance();
    exporter = new JRPdfExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,
    response.getOutputStream());
    exporter.exportReport();
    fcontext.responseComplete();
    } catch (Exception ex) {
    log(" Error Description" , ex);
    error("Error counting rows: " + ex.getMessage() );
    error("Error counting rows: " + ex );
    please give me idea
    thank's
    aamir

    Thanks Sven.
    The query works but the other way. The output is for all the targets, not for the respective target which we select from :p1_target.
    select target_name,target_type, column_label,
    warning_threshold,critical_threshold,occurrence_count
    from sysman.MGMT$TARGET_METRIC_SETTINGS@crmodem
    where target_name in (select MEMBER_TARGET_NAME from MGMT$TARGET_FLAT_MEMBERS@crmodem
    where upper(AGGREGATE_TARGET_NAME) like '%X' || :P1_TARGET || '%')
    Thanks again.

  • SAP Query Genrator Error Again

    Experts,
    select T0.Father 'Parent Item',
    T0.Code 'Children',
    Case
    When T1.ItemType = 'I' Then 'Item'
    When T1.ItemType = 'L' Then 'Labour'
    When T1.ItemType = 'T' Then 'Travel'
    End 'Item Type',
    Case
    When T1.PrcrmntMtd = 'B' Then 'Buy'
    When T1.PrcrmntMtd = 'M' Then 'Make'
    End 'Procurement Method ',
    T1.CardCode 'Preferrd Vendor',
    ISNULL((select T2.Price from OSPP T2 where T2.CardCode = T1.CardCode and T2.ItemCode = T0.Code), 0)'Price of the Item in Special price list ',
    Case
    When T1.ItemType = 'L' Then T1.AvgPrice
    Else 0
    End 'Item Cost (If Labour)'
    from ITT1 T0 inner join OITM T1 on T0.Code = T1.ItemCode
    where T0.Father = '[%0]'
    group By
    T0.Father,
    T0.Code,
    T1.ItemType,
    T1.PrcrmntMtd,
    T1.CardCode,
    T1.AvgPrice
    This gives error i SAP Query genrator . Plz help

    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 'Received Alerts' (OAIB) (s) could not be prepared.
    For
    select T0.Father 'Parent Item',
    T0.Code 'Children',
    Case
    When T1.ItemType = 'I' Then 'Item'
    When T1.ItemType = 'L' Then 'Labour'
    When T1.ItemType = 'T' Then 'Travel'
    End 'Item Type',
    Case
    When T1.PrcrmntMtd = 'B' Then 'Buy'
    When T1.PrcrmntMtd = 'M' Then 'Make'
    End 'Procurement Method ',
    T1.CardCode 'Preferrd Vendor',
    ISNULL((select T2.Price from OSPP T2 where T2.CardCode = T1.CardCode and T2.ItemCode = T0.Code), 0)
    'Price of the Item in Special price list ',
    Case
    When T1.ItemType = 'L' Then T1.AvgPrice
    Else 0
    End 'Item Cost (If Labour)'
    from ITT1 T0 inner join OITM T1 on T0.Code = T1.ItemCode
    inner join OSPP t2 on t2.ItemCode = T1.itemcode
    where T0.Father = '[%0]'
    group By
    T0.Father,
    T0.Code,
    T1.ItemType,
    T1.PrcrmntMtd,
    T1.CardCode,
    T1.AvgPrice

  • How to add column to report from the same table? Gives error now

    Steps to reproduce:
    Build a report on a table with easy report, select all columns
    Add column to the table
    Edit report and add column (one has to click Show Related Tables Only: No to view the same table!)
    Report will give error as it will be build as
    SELECT ... FROM table1, table1

    AH HAAA!!!!
    And I was afraid to convert from the "SQL (Structured Query)" to "SQL". Probably because I blew up my other reports...
    Thanks!

  • Post query giving error

    Declare
    cursor fin_ACNTs IS
    SELECT aCODE,dr,cr,seq
    FROM acnts
    where CCODE = :xH_ccode
    and Tcode = :XH_tCODE
    aND tNO = :xh_Tno
    order by seq;
    total_rows NUMBER;
    the above query will return 2 or 3 rows. for example,
    aCODE DR CR SEq
    P30737 1907.600 .000 B1
    P30737 .000 1907.600 B2
    I have 3 rows wise control fields on my form canvas
    r1c1 r1c2 r1c3 r1c4
    r2c1 r2c2 r2c3 r2c4
    r3c1 r3c2 r3c3 r3c4
    & I want to Store the above query result in Such way that
    the 1st row returned should be saved in r1c1 r1c2 r1c3 r1c4
    and the 2nd row returned in r2c1 r2c2 r2c3 r2c4
    if the query returns 2 rows
    i tried to incorporate it in thiS way, but needs SOme help;
    declare
    cursor fin_ACNTs IS
    SELECT aCODE,dr,cr,seq
    FROM acnts
    where CCODE = :xH_ccode
    and Tcode = :XH_tCODE
    aND tNO = :xh_Tno
    order by seq;
    total_rows NUMBER;
    begin
    FOR i IN fin_ACNTs LOOP
    :ctrl.Rc1 := i.aCODE;
    :ctrl.R[i]C2 := i.dr;
    :ctrl.R[i]C3 := i.cr;
    :ctrl.R[i]C4 := i.seq;
    num_total_rows := fin_ACNTs%ROWCOUNT;
    END LOOP;
    end;
    while compling the trigger am getting the errors;
    Error 49 line 15 column 5
    Bad bind var :ctrl.R
    Error 103 line 15 column 5
    Encountered th symbol "[" when expecting one of the following
    := . ( @ % ; indicator

    TYVM, Mr. Kuba,
    those 4 rows r1c1....did get filled properly. I have now 1 more problem. about this form so,
    I have a columnar tables
    inventotry_header (Inv_head) and
    inventory_detail (Inv_detail)
    in post-database-commit i am saving some details in to a 3rd table, ACNTS
    Inv_head is linked to inv_detail thru primary-foreign key, table ACNTS is independant.
    i have joined inv_head==>ACNTs in forms.
    i wrote this post-query Suggested by you. i want to display ONLY the control fields r1c1.....
    derived from the acnts table in post query and keep acnts table fields hidden.
    the acnts table should just be saved in the background(in post-database-commit) and
    its values will be displayed on form thru the control fields.
    but when i make the visible property of the acnts table fields to "NO", the post query result does not display
    the control fields r1c1.... and on querying, at first record it gives error,
    FRM-40106 No navigable items in destinations block
    and why i dont want to use the acnts tables for display, because i want to assign & display the control fields
    as i enter the details in inv_head and inv_detail, in the sequence of r1c1 r1c2 r1c3 r1c4....
    which i dont think will be possible with acnts tables (which is a linked actual db table).
    hope i have made it clear.

  • Weblogic with Hibernate gives error of named queries ? urgent

    I have deployed my application on Weblogic 11g, it gives Hibernate Names query exception.
    My Application uses Hibernate 3.0 and it works successfully on
    Tomcat
    JBOSS
    Glassfish
    But , on weblogic it gives Named query exception .Please any once can help.
    I have put antlr-3.0 jar file in lib folder of Weblogic domain folder , and have added path of it in setDomainEnv.cmd file but still Hibernate gives error of named query.

    You can follow the steps presented here: http://middlewaremagic.com/weblogic/?p=5861
    The reason for the failure is the antlr library, which is already loaded through the system classpath, so you
    need to tell WebLogic which version is should load as Hibernate uses its own implementation of the antlr library.
    Adding it to the domain/lib directory does not help as jar files placed in this directory are added at the end of the system classpath at the end.
    Note that it is not good practice to place jar files in the domain/lib directory.

Maybe you are looking for