About query generator.

SAP B1 2007 A PL46
Hi All,
I have many questions about query generator :
1. It is possible to use or to call a stored procedure ? If yes, how can we implement this ?
2. I try to use this query :
declare @commercial integer
set @commercial = [%0]
declare @prjbegin nvarchar(20)
set @prjbegin = '[%1]'
declare @prjend nvarchar(20)
set @prjend = '[%2]'
SELECT T2.[DocNum], T2.[DocDate], T2.[CardCode], T2.[CardName], T3.[ItemCode], T3.[Dscription], T3.[Quantity] FROM [dbo].[OINV]  T2 INNER JOIN [dbo].[INV1]  T3 ON T2.DocEntry = T3.DocEntry WHERE T2.[SlpCode] =@commercial AND  T3.[Project] >=@prjbegin AND  T3.[Project] <=@prjend
but it don't work. How can we do to use this ?
Thanks for your help.
Best regards.
Michael

Hi,
I try this but it's not working :
declare @commercial integer
set @commercial = (SELECT SlpCode FROM OSLP WHERE SlpCode=[%0])
declare @prjbegin nvarchar(20)
set @prjbegin = 'N000001'
declare @prjend nvarchar(20)
set @prjend = 'R000003'
SELECT T2.[DocNum], T2.[DocDate], T2.[CardCode], T2.[CardName], T3.[ItemCode], T3.[Dscription], T3.[Project] FROM [dbo].[OINV]  T2 INNER JOIN [dbo].[INV1]  T3 ON T2.DocEntry = T3.DocEntry WHERE T2.[SlpCode] =@commercial AND  T3.[Project] >=@prjbegin AND  T3.[Project] <=@prjend
I have an error that is : you must specify a table name where execute the selection ...
I think we can't use %0 and the statement DECLARE.
Thanks
Michael

Similar Messages

  • 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

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

  • 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

  • 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

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

  • How to define the PLD of a Query generator report

    Hi All,
    I want to define the PLD of a Query Report. Currently I am Convertning it to Excel format. But my client wants it in PLD format.  so please tell me the process of defining the PLD for a Query generator Report.
    Thanks & Regards
    Pankaj Sharma.

    Hi,
    When u wrote yr query at that time save yr query
    Now yr query is save in "Query Manager"
    Open Query Manager > select yr query
    There is a button "Create Report"
    Create USer Report Window is display "define yr name" and select "Base Temple"
    once u save it double click and edit yr PLD....
    Hope it a best way to create uer PLD
    Thanks
    Kevin

  • Error in Query generator

    Dear all,
    I face an issue in Query generator.
    When i execute the query in query generator, the error is like this
    1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
    'Service Contracts' (OCTR)
    My query is like this
    Declare @StartYear as char(4)
    Declare @EndYear as char(4)
    Declare @Dept as char(3)
    Declare @UnitBusiness as char(3)
    Begin
    set @StartYear = (Select   YEAR(T0.[RefDate]) from JDT1 T0 where T0.[RefDate] = [%0] )
    set @EndYear =  (Select YEAR(T1.[RefDate]) from JDT1 T1 where T1.[RefDate] = [%1])
    set @Dept =  (Select T2.[Name] from OASC T2 where T2.[Name] = [%2])
    set @UnitBusiness = (Select   distinct SUBSTRING(T3.[Segment_0],10,2)  from OACT T3 where ( T3.[Segment_0] = [%3] OR ( 1 = (CASE WHEN [%3]  = 'All'  THEN 1 ELSE 2 END) ) ))
    Exec NEC_RPT_FinanceReport @StartYear,@EndYear,@Dept,@UnitBusiness
    End
    The problem is i can not show the input screen after i execute the query generator.
    If i remove the the Variable @Dept and replace with the value it runs well.
    Does any one know where is the problem ?
    Thanks in advance
    Regards
    Bodhi86

    HI Neetu, i have change the query without using store procedure
    my query is like this
    Declare @StartYear as char(4)
    Declare @EndYear as char(4)
    Declare @Dept as char(3)
    Declare @UnitBusiness as char(3)
    Begin
    set @StartYear = (Select   YEAR(T0.[RefDate]) from JDT1 T0 where T0.[RefDate] = [%0] )
    set @EndYear =  (Select YEAR(T1.[RefDate]) from JDT1 T1 where T1.[RefDate] = [%1])
    set @Dept =  (Select T2.[Name] from OASC T2 where T2.[Name] = [%2])
    set @UnitBusiness = (Select   distinct SUBSTRING(T3.[Segment_0],10,2)  from OACT T3 where ( T3.[Segment_0] = [%3] OR ( 1 = (CASE WHEN [%3]  = 'All'  THEN 1 ELSE 2 END) ) ))
    Select @StartYear,@EndYear,@Dept,@UnitBusiness
    The error is like this
    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 'User-Defined Values' (CSHS) (s) could not be prepared.
    Can you help me
    Thanks in advance

  • Decimal places in Query generator

    Hi All,
    I am observing a weird behavior in Query generator's execution of a simple sql query. the query is :
    Select 0.002834
    now, in the general settings - display - amounts , I put the decimal value as 4 or 6,  then only it prints 0.0028 or 0.002834.
    else it prints 0.00 (if the decimal place is 2). it should ideally have nothing to do with the display of amount. any idea?
    (the effect is shown only after you change the decimal display, update it and close and reopen the SAP application.
    Thanks,
    Binita
    Edited by: Binita  Joshi on Apr 12, 2010 4:03 PM

    Hello Binita,
    >I have tried converting it to numeric(19,4) and numeric(19,6) but still the result was same.
    Check your decimal places settings in
    \Administration\System Initialization\General Settings\Display tab
    Check the following values:
    - Units (For meaurement)
    - Decimals in Query
    Now let' s say,
    - Unit set to 6 decimal places
    - Decimals in Query set to 2
    run the following query in query generator:
    select cast(0.000245 as decimal(19,6))
    result will be
    0.00
    run the same query as FMS on item master data in any measurement field (lenght)
    select cast(0.000245 as decimal(19,6))
    result will be
    0.000245
    Now set the - Decimals in Query set to 6 on  \Administration\System Initialization\General Settings\Display tab
    run the following query in query generator:
    select cast(0.000245 as decimal(19,6))
    result will be
    0.000245
    This is a normal habit of SAP B1 rounding engine / displaying engine.
    Regards
    J.

  • RUN Time error while use filter table in query generator

    Hai..
                   I have 2 Functions under "Scalar valued functions" in SQL Server,i try to call this functions in Query generator its working fine,result also display correctly, but i click filter table system showing  Error Message " Run Time Error,Abnormal program termination" then SAP is get closed,i tested this scenario in 3 Database am getting same error , Is this BUG in SAP B1?There is no error number in error message

    This is my function
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    -- =============================================
    -- Author:          <Author,,Name>
    -- Create date: <Create Date, ,>
    -- Description:     <Description, ,>
    -- =============================================
    ALTER function [dbo].[Get_TransObjName](@Obj_type NUMERIC(20,5))
    returns varchar(500) as
    BEGIN
    DECLARE @Obj_type_Name varchar(100)
    select @Obj_type_Name =
    case @Obj_type
    when     -2     then     'Opening Balance'
    when     -3     then     'Closing Balance'
    when     1     then     'oChartOfAccounts'
    when     2     then     'oBusinessPartners'
    when     3     then     'oBanks'
    when     4     then     'oItems'
    when     5     then     'oVatGroups'
    when     6     then     'oPriceLists'
    when     7     then     'oSpecialPrices'
    when     8     then     'oItemProperties'
    when     12     then     'oUsers'
    when     13     then     'A/R Invoices'
    when     14     then     'A/R Credit Memo'
    when     15     then     'A/R DeliveryNotes'
    when     16     then     'A/R Returns'
    when     17     then     'oOrders'
    when     18     then     'A/P Invoice'
    when     19     then     'A/P Credit Memo'
    when     20     then     'Goods Receipt PO'
    when     21     then     'Goods Returns'
    when     22     then     'PurchaseOrders'
    when     23     then     'Quotations'
    when     24     then     'IncomingPayments'
    when     25     then     'Deposit'
    when     28     then     'oJournalVouchers'
    when     30     then     'JournalEntries'
    when     31     then     'oStockTakings'
    when     33     then     'oContacts'
    when     36     then     'oCreditCards'
    when     37     then     'oCurrencyCodes'
    when     40     then     'oPaymentTermsTypes'
    when     42     then     'oBankPages'
    when     43     then     'oManufacturers'
    when     46     then     'VendorPayments'
    when     48     then     'oLandedCostsCodes'
    when     49     then     'oShippingTypes'
    when     50     then     'oLengthMeasures'
    when     51     then     'oWeightMeasures'
    when     52     then     'oItemGroups'
    when     53     then     'oSalesPersons'
    when     56     then     'oCustomsGroups'
    when     57     then     'ChecksforPayment'
    when     58     then     'Stock List'
    when     59     then     'Goods Receipt'
    when     60     then     'Goods Issue'
    when     64     then     'oWarehouses'
    when     65     then     'oCommissionGroups'
    when     66     then     'oProductTrees'
    when     67     then     'Inventory Transfers'
    when     68     then     'oWorkOrders'
    when     69     then     'Landed Costs'
    when     70     then     'oCreditPaymentMethods'
    when     71     then     'oCreditCardPayments'
    when     73     then     'oAlternateCatNum'
    when     76     then     'Postdated Deposit'
    when     77     then     'oBudget'
    when     78     then     'oBudgetDistribution'
    when     81     then     'oMessages'
    when     91     then     'oBudgetScenarios'
    when     97     then     'oSalesOpportunities'
    when     93     then     'oUserDefaultGroups'
    when     101     then     'oSalesStages'
    when     103     then     'oActivityTypes'
    when     104     then     'oActivityLocations'
    when     112     then     'oDrafts'
    when     116     then     'oDeductionTaxHierarchies'
    when     117     then     'oDeductionTaxGroups'
    when     125     then     'oAdditionalExpenses'
    when     126     then     'oSalesTaxAuthorities'
    when     127     then     'oSalesTaxAuthoritiesTypes'
    when     128     then     'oSalesTaxCodes'
    when     134     then     'oQueryCategories'
    when     138     then     'oFactoringIndicators'
    when     140     then     'oPaymentsDrafts'
    when     142     then     'oAccountSegmentations'
    when     143     then     'oAccountSegmentationCategories'
    when     144     then     'oWarehouseLocations'
    when     145     then     'oForms1099'
    when     146     then     'oInventoryCycles'
    when     147     then     'oWizardPaymentMethods'
    when     150     then     'oBPPriorities'
    when     151     then     'oDunningLetters'
    when     152     then     'oUserFields'
    when     153     then     'oUserTables'
    when     156     then     'oPickLists'
    when     158     then     'oPaymentRunExport'
    when     160     then     'oUserQueries'
    when     162     then     'Inventory Valuation'
    when     163     then     'oCorrectionPurchaseInvoice'
    when     164     then     'oCorrectionPurchaseInvoiceReversal'
    when     165     then     'oCorrectionInvoice'
    when     166     then     'oCorrectionInvoiceReversal'
    when     170     then     'oContractTemplates'
    when     171     then     'oEmployeesInfo'
    when     176     then     'oCustomerEquipmentCards'
    when     178     then     'oWithholdingTaxCodes'
    when     182     then     'oBillOfExchangeTransactions'
    when     189     then     'oKnowledgeBaseSolutions'
    when     190     then     'oServiceContracts'
    when     191     then     'oServiceCalls'
    when     193     then     'oUserKeys'
    when     194     then     'oQueue'
    when     198     then     'oSalesForecast'
    when     200     then     'oTerritories'
    when     201     then     'oIndustries'
    when     202     then     'oProductionOrders'
    when     203     then    'A/R Down Payment'
    when     204     then    'A/P Down Payment'
    when     205     then     'oPackagesTypes'
    when     206     then     'oUserObjectsMD'
    when     211     then     'oTeams'
    when     212     then     'oRelationships'
    when     214     then     'oUserPermissionTree'
    when     217     then     'oActivityStatus'
    when     218     then     'oChooseFromList'
    when     219     then     'oFormattedSearches'
    when     221     then     'oAttachments2'
    when     223     then     'oUserLanguages'
    when     224     then     'oMultiLanguageTranslations'
    when     229     then     'oDynamicSystemStrings'
    when     231     then     'oHouseBankAccounts'
    when     247     then     'oBusinessPlaces'
    when     250     then     'oLocalEra'
    when     280     then     'oSalesTaxInvoice'
    when     281     then     'oPurchaseTaxInvoice'
    when     300     then     'BoRecordset'
    when     305     then     'BoBridge'
    when     260     then     'oNotaFiscalUsage'
    when     258     then     'oNotaFiscalCFOP'
    when     259     then     'oNotaFiscalCST'
    when     261     then     'oClosingDateProcedure'
    when     10     then     'oBusinessPartnerGroups'
    when     278     then     'oBPFiscalRegistryID'
    else cast(@Obj_type as char(20)) end
    return @Obj_type_Name
    END

  • 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

  • About query Operator in find page??

    hi all~
    I hava a trouble about query operator.
    for example:
    In find page , there are some attribute for query.
    attribute BRAND for query the vender's name,
    Assume database has the follow data:
      BRAND
    =================
    1.IBM
    2.RedIBM
    3.BLUEIBMCO
    Case 1:When i input IBM in BRAND attribute and press Find,the result is :IBM
    Case 2:When i input %IBM in BRAND attribute and press Find,the result is : RedIBM,BLUEIBMCO
    How could I get above two result just input IBM??
    I want to serch the value of BRAND that contain IBM whether it location at the frond or middle.

    Spray Lin,
    I'm afraid that this time I do not quite understand what you are after.
    When I understand you correctly, you are saying that the current behavior is not what I think it should be, for example IBM results in IBM and IBMblue. That is strange indeed.
    Furthermore is it that when you try to find on IBM it should find everything with IBM in it? Said in other words, entering IBM should have the same result as entering %IBM%?
    If that is the case, you can achieve that by adding an extra property to the find form bean: "wildcardUsage". Setting this to "surround" will result in a "%" being put in front and at the end of the value you enter.
    You can look this up in the JHeadstart Developers Guide in the section Model-Aware Form Beans.
    Jan Kettenis,
    JHeadstart Team

  • Copy and Paste from SQL server to Query Generator eliminate spaces

    Hi:
    My query is run perfectly on SQL server.
    However, when I copied it to Query Generator in SAP B1, it can not be run. When I look closely I see that some spaces have been truncated for example between the fieldname and key words like FROM, LEFT OUTER JOIN. I have to then going through the Query Generator in SAP B1 to put in the spaces in appropriate places. This process took long time and require very close attention and did not make any sense to me, since my query already work in SQL server query manager.
    Is there any way that we can make Query Generator in SAP B1 keeping the same format (ie. not eliminate the spaces) as in SQL server Query Manager?
    Best Regards,
    Phong Nguyen.

    Here is what I mean:
    SELECT YEAR(T1.DocDate) YEAR_NO, DATEPART(wk,T1.DocDate) WEEK_NO,SUM(T1.LineTotal) TotalShrinkage_Sales, (SUM(T1.LineTotal)/SUM(T1.Total_Sales)) Percent_Shrinkage, SUM(T1.Total_Sales) Total_Sales,COUNT(DISTINCT T1.Shrinkage_No) Shrinkage_Volume, SUM(T1.TotalCost) TotalShrinkage_CostFROM (SELECT V0.ITEMCODE, V0.DocEntry Shrinkage_No, V0.DocDate, V0.LineTotal, 0 Total_Sales,  V0.TotalCostFROM dbo.V_SHRINKAGE_TOTAL V0 WHERE V0.TransType='Shrinkage'UNION ALLSELECT V1.ITEMCODE, null Shrinkage_No, V1.DocDate, 0 LineTotal, V1.LineTotal Total_Sales, 0 TotalCostFROM dbo.V_Sales_Invoice V1UNION ALLSELECT V2.ITEMCODE, null Shrinkage_No, V2.DocDate,0 LineTotal, V2.LineTotal Total_Sales, 0 TotalCost FROM dbo.V_Credit_Note V2) T1WHERE DATEDIFF(wk,T1.DocDate,getdate())<=12GROUP BY YEAR(T1.DocDate), DATEPART(wk,T1.DocDate)ORDER BY YEAR(T1.DocDate) ASC,DATEPART(wk,T1.DocDate) ASC
    You can see the the third line (top down) the space between the field TotalShrinkage_Cost and FROM has been eliminated.
    Also you can see that on the 4th line (top down) the space between the field  V0.TotalCost and FROM has been eliminated.
    Also in the 5th line (top down) you can see: V0.TransType='Shrinkage'UNION ALLSELECT --- spaces have been eliminated between 'Shrinkage" and UNION and ALL and SELECT
    The list can go on.
    Can you help there?
    Thanks,
    Phong Nguyen.

  • Update multiple UDF from one query generator

    Hi All,
    I have Form1 with multiple UDF1 which have been key in by users
    And another Form2 with multiple UDF2 which exactly same with Form1 UDF1
    Is there a way that I can copy multiple UDF at Form2UDF2 from Form1UDF1 instead of creating query for each individual UDF, where in query generator I can select more the one column but only first column will be insert to the single UDF.
    Thanks

    Hi Firos,
    I mean I have 7UDF in the Payment Form where the information to this UDF are come from 7UDF in the invoice form which already created previously so I would like to copy those UDF from invoice to UDF in payment by using single query to capture all the UDF information by doing:
    SELECT T0.[DocNum], T0.[UDF1], T0.[UDF2], T0.[UDF3], T0.[UDF4], T0.[UDF5], T0.[UDF6], T0.[UDF7]
    FROM OINV T0 WHERE T0.[CardCode] = $[ORCT.CardCode]
    From above query can I pass the result directly to UDF in Payment Form? or I need to create one query for each individual UDF.
    Thanks

  • About Query returns no results?????

    Has anyone had any luck getting an about(xxx) query to function as described in the documentation? I'm sure it works....but I can't seem to get anywhere.
    I created a table "TEST_HELP". Columns Help_id, Help_Text
    I put a handfull of records in the table, populating the column Help_Text with data such as
    1, This is a document about animals.
    2, This is all about the wonder world of dogs.
    3, This is why fish suck.
    4, Cats and why they think they rule the world.
    5, Creature of the deep.
    ok, next I created a small thesaurus with terms defined as:
    animal
    syn creature
    nt dog
    nt cat
    nt fish
    I load the thesaurus.
    I create a CONTEXT index on TEST_HELP, utilizing LEXER preferences:
    INDEX_TEXT= YES
    INDEX_THEMES= YES
    I can issue a contains query using the thesaurus operators SYN, NT and get the results I expect. However if I issue an about(animal) query I would expect to get all 5 records. (Based on the expansion of all SYN and NT)
    So, can anyone tell me if my process is wrong? Are my expectations wrong? Does it even work?
    Working with Oracle 9.2 on a windows 2000 server platform.
    Thank you all for you time.

    Alright, I recreated the table, thesaurus and index (in that order)
    and the about query appears to be working.
    When I recreated the table I added more robust data to the help_text column.
    (Don't know if this had anything to do with it or not)
    Is there a specific order of creation that needs to be followed? table, thes, index

Maybe you are looking for

  • Input Not Supported

    I was in my mac mini playing with the display settings and I clicked on one that was way to big for my monitor. Now its not coming up at all. I can see the screen when it boots up, however when it gets to the OS, the screen goes to a blank black scre

  • Assigning different authorizations inside a role to different users

    Hello, Could someone please guide me to how can we assign different authorizations (authorizations field values) for an authorization object inside a role to different users; i.e. in the role maintenance transaction (pfcg) after we create a new role

  • Disable the save option in axAcroPDF1 control in c# winforms

    In my c# winform application i want to display pdf in axAcroPDF1 control.I am able to do that.But i dont want the save option.Any body knows how to disble the save option in axAcroPDF1 control...????

  • POSDM Multiple days in one file

    POSDM has received a file on one day which contains two days trading. How can this file be split in POSDM to reflect the data on the individual days? The /POSDW/STOREDAYCHANGEKEY process copies the data from one store/day key effectively duplicating

  • Bad weekday algorithm

    Hi! I bought an iMac a month ago (thus returning to MacOS after an absence of some 8 years). One of the applications I most looked forward to using was iCal. I currently work on a rather large history project related to the crusades, and I had intend