SBO query in XLR?

Is it possible to use a query in XL Reporter, that is made in SBO? And how can I use it as basis for a report?

No u cant use the SQL written in SBO for XL-Reporter.
But thro ur selection of fields and expansion in XL-reporter the query will be written accordingly, which u can see at the bottom of the Advanced Report Builder window.
Regards,
Dhana.

Similar Messages

  • Variables in SBO Query Generator

    Hi Expert,
    I have created a VIEW in SQL and querying this via SBO. I need to use FROM and TO Date inputs from the user.
    When using '[%0]' like I normally do, the query does not run.
    {/code}
    Declare @DateFrom as DateTime
    Declare @DateTo as DateTime
    Set @DateFrom = '[%0]'
    Set @DateTo = '[%1]'
    SELECT EARNER, PRODUCTLINE, Sum(LINETOTAL) AS 'Total', Sum(COMMISSION_PAYABLE) AS 'Total Commission'
    FROM [dbo].[COMMISSION]
    WHERE ([dbo].[COMMISSION].[DocDate] >= @DateFrom
    AND [dbo].[COMMISSION].[DocDate] <= @DateTo)
    Group by EARNER, PRODUCTLINE
    ORDER BY EARNER, PRODUCTLINE
    {/code}

    Using Date values duriectly through Variables is not possible due to the formats.
    So try this.
    Declare @DateFrom as DateTime
    Declare @DateTo as DateTime
    /* SELECT FROM [dbo].[OPCH] T0 WHERE */ SET  @DateFrom = /* T0.DocDate*/ '[%0]'
    /* SELECT FROM [dbo].[OPCH] T0 WHERE */ SET  @DateTo = /* T0.DocDueDate*/ '[%1]'
    SELECT EARNER, PRODUCTLINE, Sum(LINETOTAL) AS 'Total', Sum(COMMISSION_PAYABLE) AS 'Total Commission'
    FROM dbo.COMMISSION
    WHERE (dbo.COMMISSION.DocDate >= @DateFrom
    AND dbo.COMMISSION.DocDate <= @DateTo)
    Group by EARNER, PRODUCTLINE
    ORDER BY EARNER, PRODUCTLINE
    DocDate from OPCH is just an example.  You could use this syntax with any date field from any table.

  • PLD Report does not show data from Query

    Hello,
    SAP b1 9.0 PL08 on MSSQL 2008 and I get data on the query, but when the PLD prints, it shows nothing. Is there a way to filter the data that the PLD shows? Does PLD have its own SQL script it uses b/c its not showing data from the query.
    Thanks,
    Nick

    Hi Nicholas,
    Please check below links.
    query based print layout design
    Print Layout Designer \Custom Reports
    How to Make a Print Layout (PLD) Report from a SBO Query | SBOnotes.com
    http://www.tegrous.com/wp-content/uploads/2011/07/HowTo_QPrintLs_88.pdf
    Hope this help
    Regards::::
    Atul Chakraborty

  • Selection Problem in SAP B1 Query Manager

    Experts,
    select T0.DocNum 'AR Invoice Number',
    T0.DocDate 'AR Invoice Date',
    T0.CardCode,
    T0.CardName,
    T0.NumAtCard 'Vendor Ref No',
    (select sum (T1.Quantity * T1.Price) from INV1 T1 where T1.DocEntry = T0.DocEntry) 'Base Amount',
    ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='1'), 0)'VAT Amount',
    ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='1'), 0)'VAT %',
    ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='4'), 0)'CST Amount',
    ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='4'), 0)'CST %',
    ISNULL ((select sum (T3.TaxSum) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='5'), 0)'Service Amount',
    ISNULL ((select MAX (T3.TaxRate) from INV4 T3 where T3.DocEntry = T0.DocEntry and T3.StaType='5'), 0)'Service %',
    T0.TotalExpns 'Freight Amount',
    T0.WTSum 'TDS Amount',
    T0.DocTotal 'Document Total'
    from OINV T0
    where T0.DocDate >= '[%0]'
    and T0.DocDate <= '[%1]'
    When I run this query in SBO query maanger, it gives error for the selection criterias.
    1). [Microsoft][SQL Native Client][SQL Server]Must specify table to select from. 2). [Microsoft][SQL Native Client][SQL Server]Statement 'User-Defined Values' (CSHS) (s) could not be prepared.
    Please hlp

    Hi Rahul,
    I have just added credit memo with the query as per need, but same problem it shows!
    SELECT T0.[DocNum] 'AR Invoice #',
    T0.[DocDate] 'Date',
    T0.CardName 'Customer Name',
    T0.NumAtCard As 'Customer Ref',
    T0.[CardName], 
    Sum(T1.LineTotal) 'Base Amount',
    T0.[DocTotal] As 'Total Value',
    (isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxSum else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) 'VAT_Amt',
    (isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxRate else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'VAT%',
    (isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxSum else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'CST_Amt',
    (isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxRate else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'CST%',
    (isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxSum else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'Service_Amt',
    (isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxRate else 0 end))
    FROM INV4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'Service%',
    T0.TotalExpns 'Freight Amount',
    T0.WTSum 'TDS Amount',
    T0.DocTotal 'Grand Total'
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    WHERE T0.DocDate>='[%0]' And T0.DocDate<='[%1]'
    Group By T0.[DocNum], T0.[DocDate], T0.NumAtCard, T0.[CardName], T0.[DocTotal] , T0.TotalExpns, T0.WTSum, T0.DocEntry,
    T0.WTSum,
    T0.TotalExpns
    Union All
    SELECT T0.[DocNum] 'AR Invoice #',
    T0.[DocDate] 'Date',
    T0.CardName 'Customer Name',
    T0.NumAtCard As 'Customer Ref',
    T0.[CardName], 
    -Sum(T1.LineTotal) 'Base Amount',
    -T0.[DocTotal] As 'Total Value',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxSum else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) 'VAT_Amt',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =1 then T4.TaxRate else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'VAT%',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxSum else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'CST_Amt',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =4 then T4.TaxRate else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'CST%',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxSum else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry ),0)) As 'Service_Amt',
    -(isnull((SELECT SUM((case when upper(t4.STAType) =5 then T4.TaxRate else 0 end))
    FROM RIN4 T4 WHERE T4.DocEntry=T0.DocEntry And T4.LineNum=0),0)) As 'Service%',
    -T0.TotalExpns 'Freight Amount',
    -T0.WTSum 'TDS Amount',
    -T0.DocTotal 'Grand Total'
    FROM ORIN T0  INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
    WHERE T0.DocDate>='[%0]' And T0.DocDate<='[%1]'
    Group By T0.[DocNum], T0.[DocDate], T0.NumAtCard, T0.[CardName], T0.[DocTotal] , T0.TotalExpns, T0.WTSum, T0.DocEntry,
    T0.WTSum,
    T0.TotalExpns
    Plz hlp

  • BP Properties Query

    Hello!
    I want to query for Business Partners based on the properties input by the user.
    For eg, I have set property 64 as "fuses".
    I want to query for all BP's that have fuses checked on user input. I want the user to input the name since I'd be using many properties and I do not want to create multiple queries for each of them.
    The erroneous query that I am using is
    SELECT T0.[GroupCode], T0.[CardCode], T0.[CardName], T0.[GroupCode],
    T0.[CntctPrsn], T0.[E_Mail] FROM OCRD T0 , OCQG T1
    WHERE T1.[GroupName] = '[%0]
    The query above simply lists out all the BP's. I only want the BP's listed where the property is checked.
    I need help on this.
    Prajwal

    I know it has been a while since you posted, but I just stumbled on this because I too was searching for a solution. Here is what I came up with.
    First create a SQL view in your SBO company that replaces the names like 'QryGroup61' with the names that have acutally been assigned to these properties from table OCQG.
    Then create a query inside Business One that references the SQL view.
    First, the code for the SQL view.
    USE [MYSBOCOMPANY]
    --Substitute your SBOCompany DB name
    GO
    create view [dbo].[myView_BPPropertySearch] as
    select cardcode,
    --Substitute values from your company OCQG table.
    --In my case, my first GroupName in OCQG = 'Backup'.
    --Some of the properties are unassigned so they just have the default
    --BP Property + Number GroupName.
    case QryGroup1 when  'Y' then 'Y' else '' end as 'Backup',  
    case QryGroup2 when  'Y' then 'Y' else '' end as 'Data Center',
    case QryGroup3 when  'Y' then 'Y' else '' end as 'Deduplication',
    case QryGroup4 when  'Y' then 'Y' else '' end as 'Disaster Recovery',
    case QryGroup5 when  'Y' then 'Y' else '' end as 'Network',
    case QryGroup6 when  'Y' then 'Y' else '' end as 'Security',
    case QryGroup7 when  'Y' then 'Y' else '' end as 'Storage',
    case QryGroup8 when  'Y' then 'Y' else '' end as 'Unified Communications',
    case QryGroup9 when  'Y' then 'Y' else '' end as 'Virtualization',
    case QryGroup10 when  'Y' then 'Y' else '' end as 'Wan',
    case QryGroup11 when  'Y' then 'Y' else '' end as '11',
    case QryGroup12 when  'Y' then 'Y' else '' end as '12',
    case QryGroup13 when  'Y' then 'Y' else '' end as '13',
    case QryGroup14 when  'Y' then 'Y' else '' end as '14',
    case QryGroup15 when  'Y' then 'Y' else '' end as 'Application Development',
    case QryGroup16 when  'Y' then 'Y' else '' end as 'Business Intelligence',
    case QryGroup17 when  'Y' then 'Y' else '' end as 'Collaboration',
    case QryGroup18 when  'Y' then 'Y' else '' end as 'CRM',
    case QryGroup19 when  'Y' then 'Y' else '' end as 'ERP',
    case QryGroup20 when  'Y' then 'Y' else '' end as '20',
    case QryGroup21 when  'Y' then 'Y' else '' end as '21',
    case QryGroup22 when  'Y' then 'Y' else '' end as '22',
    case QryGroup23 when  'Y' then 'Y' else '' end as '23',
    case QryGroup24 when  'Y' then 'Y' else '' end as '24',
    case QryGroup25 when  'Y' then 'Y' else '' end as 'Full Time Equivalent',
    case QryGroup26 when  'Y' then 'Y' else '' end as 'Managed Services',
    case QryGroup27 when  'Y' then 'Y' else '' end as 'OS / EMail',
    case QryGroup28 when  'Y' then 'Y' else '' end as '28',
    case QryGroup29 when  'Y' then 'Y' else '' end as '29',
    case QryGroup30 when  'Y' then 'Y' else '' end as '30',
    case QryGroup31 when  'Y' then 'Y' else '' end as 'BP Property 31',
    case QryGroup32 when  'Y' then 'Y' else '' end as 'BP Property 32',
    case QryGroup33 when  'Y' then 'Y' else '' end as 'BP Property 33',
    case QryGroup34 when  'Y' then 'Y' else '' end as 'BP Property 34',
    case QryGroup35 when  'Y' then 'Y' else '' end as 'BP Property 35',
    case QryGroup36 when  'Y' then 'Y' else '' end as 'BP Property 36',
    case QryGroup37 when  'Y' then 'Y' else '' end as 'BP Property 37',
    case QryGroup38 when  'Y' then 'Y' else '' end as 'BP Property 38',
    case QryGroup39 when  'Y' then 'Y' else '' end as 'BP Property 39',
    case QryGroup40 when  'Y' then 'Y' else '' end as 'BP Property 40',
    case QryGroup41 when  'Y' then 'Y' else '' end as 'BP Property 41',
    case QryGroup42 when  'Y' then 'Y' else '' end as 'BP Property 42',
    case QryGroup43 when  'Y' then 'Y' else '' end as 'BP Property 43',
    case QryGroup44 when  'Y' then 'Y' else '' end as 'BP Property 44',
    case QryGroup45 when  'Y' then 'Y' else '' end as 'BP Property 45',
    case QryGroup46 when  'Y' then 'Y' else '' end as 'BP Property 46',
    case QryGroup47 when  'Y' then 'Y' else '' end as 'BP Property 47',
    case QryGroup48 when  'Y' then 'Y' else '' end as 'BP Property 48',
    case QryGroup49 when  'Y' then 'Y' else '' end as 'BP Property 49',
    case QryGroup50 when  'Y' then 'Y' else '' end as 'BP Property 50',
    case QryGroup51 when  'Y' then 'Y' else '' end as 'BP Property 51',
    case QryGroup52 when  'Y' then 'Y' else '' end as 'BP Property 52',
    case QryGroup53 when  'Y' then 'Y' else '' end as 'BP Property 53',
    case QryGroup54 when  'Y' then 'Y' else '' end as 'BP Property 54',
    case QryGroup55 when  'Y' then 'Y' else '' end as 'BP Property 55',
    case QryGroup56 when  'Y' then 'Y' else '' end as 'BP Property 56',
    case QryGroup57 when  'Y' then 'Y' else '' end as 'BP Property 57',
    case QryGroup58 when  'Y' then 'Y' else '' end as 'BP Property 58',
    case QryGroup59 when  'Y' then 'Y' else '' end as 'BP Property 59',
    case QryGroup60 when  'Y' then 'Y' else '' end as 'BP Property 60',
    case QryGroup61 when  'Y' then 'Y' else '' end as 'BP Property 61',
    case QryGroup62 when  'Y' then 'Y' else '' end as 'BP Property 62',
    case QryGroup63 when  'Y' then 'Y' else '' end as 'BP Property 63',
    case QryGroup64 when  'Y' then 'Y' else '' end as 'BP Property 64'
    from ocrd
    Now, the code for the SBO query:
    select  bp.cardname, ps.* from ocrd bp
    join myView_BPPropertySearch ps on bp.cardcode = ps.cardcode
    where [Backup]= 'Y'
    for browse
    Teach your users that to use the SBO query, they must substitute an exact match of a name in OCQG.
    Note that theSQL view is NOT dynamic. If someone changes a GroupName in OCQG, you have to alter the SQL view.
    Edited by: Cindy Lange on Apr 28, 2009 11:49 AM

  • How to  Export/Import "report for the query" to another company

    Hello,
    I do this:
    1.create query in SQL analizer
    2.copy paste into SBO query generator and save
    3.create report for the query
    Then, How to Export/Import "report for the query" to another company ?
    Thanks for your HELP.

    Look for SAP Note number 600813
    That's the note Adele means, I guess.
    <b>Edit (@13:18)</b>
    The direct link:
    https://websmp101.sap-ag.de/~sapidb/012006153200000183292003E.ITF
    ---- Replace *SOURCE* with the source database name.
    ---- Replace *DEST* with the destination database name.
    insert into [*DEST*].[dbo].[RDOC]
    select [*SOURCE*].[dbo].[RDOC].*
    from
    [*SOURCE*].[dbo].[RDOC],[*DEST*].[dbo].[cinf],[*SOURCE*].[dbo].[cinf]
    where [*DEST*].[dbo].[cinf].[lawsset]=[*SOURCE*].[dbo].[cinf].[lawsset]and [*DEST*].[dbo].[cinf].[version]=[*SOURCE*].[dbo].[cinf].[version] and [*SOURCE*].[dbo].[RDOC].[Doccode]NOT IN (SELECT Doccode from [*DEST*].[dbo].[RDOC])
    insert into [*DEST*].[dbo].[RITM]
    select [*SOURCE*].[dbo].[RITM].*
    from [*SOURCE*].[dbo].[RITM],[*DEST*].[dbo].[cinf],[*SOURCE*].[dbo].[cinf] where [*SOURCE*].[dbo].[RITM].[Doccode] NOT IN (select Doccode from [*DEST*].[dbo].[RITM])AND [*SOURCE*].[dbo].[RITM].[Doccode]IN (SELECT Doccode from [*DEST*].[dbo].[RDOC])
    Hope it helps...
    Grtz, Rowdy

  • Query with SQL-SP gives error, if not used for few days

    Hi All,
    I have observed that if we do not use some of queries (which usage SQL SPs) for few days, then it stops working.
    But when we go in SQL and execute the SP, the query in SAP starts working, without making any change either in query or the SQL-SP.
    Can anybody throw light on this ? I guess it has some connection with SQL-SP behaviour.
    Thanking you in advance ,
    Samir Gandhi
    Edited by: Rui Pereira on May 1, 2009 1:28 PM

    Hi Gordon,
    Please note the function of the SP is to bring selected data from tables, for example to bring Purchase details (I have copy pasted the SP at bottom of this message).
    These are not SP_notif...
    These SPs are called from the SBO query.
    Once we execute the SP in SQL, then it starts working with SBO also.
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO
    ALTER Procedure [dbo].[pGetPurchaseRegister]
         @StartDate datetime,
         @EndDate  datetime
    as
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpPurchaseReg1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
         drop table tmpPurchaseReg1
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpPurchaseReg2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
         drop table tmpPurchaseReg2
    SELECT T1.LineNum,T0.DocNum AS 'Document Number', T0.DocDate AS 'Posting Date', T0.CardCode AS 'Vendor Code',
           T0.CardName AS 'Vendor Name', T0.NumAtCard as 'Vendor Ref. No', T0.VatSum AS 'Total Tax', T0.DocTotal AS 'Document Total' ,
           T1.AcctCode AS 'Account Code',T1.LineTotal AS 'Basic Amount', T1.ItemCode AS 'Item No.', T1.Dscription AS 'Item/Service Description',
           T2.SuppCatNum, T1.INMPrice AS 'Item Cost', T1.Quantity AS 'Quantity',T3.ItmsGrpNam AS'ItemGroup'
    into tmpPurchaseReg1
    FROM  [dbo].[OPCH] T0
          INNER  JOIN [dbo].[PCH1] T1  ON  T1.DocEntry = T0.DocEntry
          INNER  JOIN [dbo].[OITM] T2  ON  T1.ItemCode = T2.ItemCode
          INNER  JOIN [dbo].[OITB] T3  ON  T2.ItmsGrpCod = T3.ItmsGrpCod
          --WHERE T0.DocDate >= CONVERT(DATETIME, [%0], 112)   AND  T0.DocDate <= CONVERT(DATETIME, [%1], 112)  
         WHERE T0.DocDate >=@StartDate  AND  T0.DocDate <=@EndDate
    ORDER BY T0.DocNum
    select  * into tmpPurchaseReg2 from tmpPurchaseReg1
    declare @Total int
    declare @TmpCardCode varchar(200)
    declare @DocNum int
    declare  PurchseRegister_Cursor cursor LOCAL for
         select  [Document Number] from tmpPurchaseReg1 group by [Document Number] having count([Document Number]) > 1 order by [Document Number]
    open PurchseRegister_Cursor
                            fetch next from PurchseRegister_Cursor into @DocNum
                            while @@fetch_status = 0
                            begin
                                        begin
                                drop table tmpPurchaseRegTemp
                                 select top 1 * into tmpPurchaseRegTemp from tmpPurchaseReg2 where [Document Number] = @DocNum 
                             select @TmpCardCode =[LineNum]  from tmpPurchaseRegTemp     
                             update tmpPurchaseReg2 set [Vendor Name] = '',[Total Tax] = 0,[Document Total] = 0
                                                   where  [Document Number] = @DocNum  and [LineNum] <> @TmpCardCode
                                        end
                                       fetch next from PurchseRegister_Cursor into @DocNum   
                            end
    close PurchseRegister_Cursor
    deallocate PurchseRegister_Cursor
    BR
    Samir Gandhi

  • SBO Metadata

    Hello,
    I am working on a new project and I need to extract the metadata from SAP Business One standard tables. What I need specifically is the description of each table field, similar to what SBO does when you use the query generator. Basically, you type the name of any table, and the system shows you the name of each field and a description. I know how to get the field name, but I do not know how to get the description, not even where it is stored.
    I appreciate any help.
    Cesar.
    Edited by: Rui Pereira on Dec 9, 2008 4:12 PM

    Hello Folks,
    Thanks for your reply but I think I didn't make my self clear. What I need is to access the SBO tables description by code (in a program). What this program has to do is to show the fields of a given table and the corresponding fields' description just like the SBO query generator does.
    There has to be a place where the query generator gets this description from, but I haven't been able to find it. Does anyone know where the fields' description is stored or how to access it from code?
    Thank you
    Cesar.

  • Question about customer aging report

    Greetings,
    One of our Business One consultants needs the information from the customer aging report under the financials\accounting\aging section of Business One. I am trying to help him do this but I do not know how to find the query or stored procedure that is executed to produce this report. Does anyone know the answer to this or maybe know how I can find out what query is executed?
    Thanks.

    As you know there is two ways of generating customer recevieable report:
    1. By Journal Entry
    2. By Sales Documents
    I can not find a stored procedure also, but after analyze SBO-application queries it uses this query:
    SBO query to get customer with balance
    SELECT T0.CardCode, T0.CardName, T0.Balance, T0.BalanceFC, T0.BalanceSys, T0.Currency, T0.DunTerm, T1.MonthDays, T1.YearDays, T1.YearlyRate, T1.MaxLevel FROM  [dbo].[OCRD] T0   LEFT OUTER  JOIN [dbo].[ODUT] T1  ON  T1.TermCode = T0.DunTerm   WHERE T0.CardType = N'C'  AND  (((T0.Currency = N'NOK'  OR  T0.Currency = N'##' ) AND  T0.Balance <> 0 ) OR  (T0.Currency <> N'NOK'  AND  T0.Currency <> N'##'  AND  T0.BalanceFC <> 0 ))  ORDER BY T0.CardCode
    Then send CardCode variable to this query that retreives selected customer:
    SELECT T0.BatchNum, T0.TransId, T0.TransType, T0.CreatedBy, T1.RefDate, T1.DueDate, T1.LineMemo, T0.Ref1, T1.Credit, T1.Debit, T1.FCCredit, T1.FCDebit, T1.SYSCred, T1.SYSDeb, T1.SourceLine, T1.Ref1, T1.Account FROM  [dbo].[OJDT] T0  INNER  JOIN [dbo].[JDT1] T1  ON  T1.TransId = T0.TransId   WHERE T1.ShortName = N'10001' AND T1.IntrnMatch = 0   ORDER BY T1.DueDate
    Antoher easy way is ot create a query like this
    (ref.SAP Note 740241 - User Report for days over duedate on AR Invoice):
    SELECT T0.CardCode, T0.CardName, T0.DocDueDate, Convert(numeric, GetDate()) - convert(numeric, T0.DocDueDate ) as 'Days After DueDate', T0.DocTotal, T0.PaidToDate, (T0.DocTotal - T0.PaidToDate) as 'Debt' FROM OINV T0 WHERE T0.DocStatus = 'O' and Convert (char, T0.DocDueDate, 103) <= convert(char, GetDate(),103) FOR BROWSE
    Hope this helps
    Brgs,
    Geir

  • Formatted Search - Date Time Stamps

    Hi,
    We are trying to use a Date & Time Stamp for two udf's of which I will then calculate the difference in a report. I have a couple of issues. Ideally the user would enter the Start field (udf1), click Shift-F2 and that udf would be populated with a Date/Time Stamp like: 07/12/09 14:30:00 or 07/12/09 02:30PM. The user would also do the same thing for the End field (udf), so I end up with two udf's that both hold a Date/Time Stamp described above.
    1 - It looks like I will either need two udf's each for both stamps, one for the Date (date field type) and one for the Time (hour field type)...or I will need to use an alphanumeric field type to hold the whole timestamp. When using the hour field type I still have some issues.
         and
    2 - I can't seem to get the right sql (sbo query) function to return the date/time stamp and / or I can't cast it or format it the way I would like.
    -If the udf is date field, I can use the GetDate function, but it doesn't seem to get the time with it or the field isn't big enough or formatted properly.
    -If the udf is an alphanumeric field, I cast the GetDate function as nvarchar and it returns the date/time stamp, but it is an alpha field and the date is Jul 21 2009  4:41PM. I don't like the Jul 21 2009 formatting
    -If I use two fields, one for date (date type) and one for time (hours type), the date is formatted the way I like, but the hours field doesn't display the AM or PM and my formatted search doesn't return military time (14:00 instead of 2:00PM), so I can't tell if 2:00 is morning or afternoon.
    So I guess my questions are pretty general...Am I using the correct field types? Any suggestions on what to use? Are there any other ways to format this data? Not all date functions or casts (time, smalldatetime) work in the sbo query so I am looking for options. Any suggestions on what functions or cast to use?
    Thanks

    Hi,
    As you already aware, within B1 you may not treat datetime field easily.  For one of your request: I don't like the Jul 21 2009 formatting.  You could use function such as
    Select CONVERT(nvarchar(30), GETDATE(),106)
    to change it to 21 Jul 2009.
    Thanks,
    Gordon

  • Query on licenced users in SBO

    Hi. ANy ideas on how to query if a user in SBO has an assigned licence. Thanks

    Hi,
    There is no query to reach your goal.  The best way to check might be the file B1upf.xml under licensing server folder.
    Thanks,
    Gordon

  • SBO SQL Query outputs zero values as nulls but need the zeros

    Hi all,
    I'm having a problem with a query I'm writing in SBO where if the field contents are zero, these are output as null.
    I have a field for the stock usage on sales orders and ont too for production orders, but if I add these together they only provide a result if both columns contain a numeric value.
    I've tried adding "0" to the column value, adding and subtracting "1" and also multiplying the value by "1" but still no joy.
    I have also tried adding a "cast" statement to the column, but that doesnt seem to have an effect either (I think as this is more an output function).
    I need to be able to use these columns as separate displays in addition to being used in a further column as part of a calculation.
    If anyone has an idea how I can output a true zero value as opposed to a null value your help would be appreciated.
    Cheers,
    J

    Hello Julian,
    You could try to use a CASE Statement as I have shown below and test this will the SQL below.  If you use the T0.LineNum without any CASE or CAST the LineNum 0 will show as blank in SAP.
    SELECT
    CASE WHEN T0.LineNum != 0 THEN CAST(T0.LineNum AS VARCHAR(10)) ELSE '0' END AS 'Row Number',
    T0.ItemCode AS 'Item No.', T0.BaseQty AS 'Base Quantity', T0.PlannedQty AS 'Planned Quantity - Rows'  FROM  [dbo\].[WOR1\] T0

  • Query report in SBO

    Dear Experts/Gurus,
    I have a problem in developing a report. The report I need is similar with general ledger report but some additional field need to add. If I use query, will it give the same report format with general ledger report in SBO ?
    In general ledger report, the format as follows:
    posting date           due date       Type    Details                               etc.. etc...
    <u>assets</u>       <u> ->1200</u>               <u>HSBC</u>
    ->01.01.04            ->01.01.04      PS      payment S-1211                 etc..etc....
    ->01.01.04            ->01.01.04      PS      payment S-1221                 etc..etc..
    The result of my query is as follows:
    Acctcode              Acctname          posting date    due date         etc..etc..           
    1200                       Asset              01.01.04         01.01.04
    1200                       Asset              01.01.04         01.01.04
    I could not understand that the underline words can't be available in report using query I created. Could the query generator be used to generate report where the underline word is also able to have in the report ? I really appreciate your answer so much. TIA
    Rgds,

    Jimmy,
    If you are using the SAP Query Manager, then no, you will not get the same formatting as a report that you would create using the Print Layout Designer (PLD) in Business One.  The query generator is just like it sounds and is similar to running a query within SQL itself.
    The forum that you have posted your question in is for questions related to the SAP Business One SDK.  Your question seems to be application related and should be posted in the SAP Business One Discussion Forum at ...
    http://cpsn-channel.sap.com/businessoneforum
    Eddy

  • XLR query expert question

    Here is a little challenge from a user. I am using B1 for Stock control and Stock forecasting. Until now we used a Microsoft Access Query to extract to Stock Consumption Quantity from SAP tables and this query works fine and it creates the Stock Consumtion and forecast report for our company. However, I am trying to achieve the same result by using XLR in SAP and I can get the Stock Quantity from the relevant A/R Invoice table and extract the Quantity value for a particular Stock Item ( say MRH001 = Shampoo )
    However, MRH001 is also used as part of other Gift Packs and we use Production Order and Bill of Material, to make up these packs. So the Gift Pack is finally recorded as a new Stock Item called Pack1 which contains MRH001. So our total consumption of Shampoo (MRH001) is made up from sales of MRH001 itself + MRH001 sold as Pack1. So we need a way of finding out the total SALES of MRH001 and so far we could not find a way. Our Business Partner has also tried to come up with an idea but so far we could not crack this one.
    To make things more complex, our Pack1 (which contains MRH001) can be included in another pack (say Pack2). So now we have Shampoo sales under 3 different product codes, MRH001, Pack1 and Pack2.
    Any ideas from SAP experts?
    Thanks
    Robert

    Ho Gordon
    Thanks for this pointer. I used the QPLD before and probably you are right that I may be able to run a Query to do this but when it come to functionality I found the QPLD limiting. I may give it another go.
    Unfortunately, I do not have christal reporting but I have heard that it may become part of B1 in the future?
    Thanks
    Robert

  • Problem use SQL query in coding report with SBO

    Hi everyone!
    I have problem in execute query to delete and create a report with SQL 2000 in SAP.
    Try
            oForm.DataSources.DataTables.Item(0).ExecuteQuery("DELETE FROM rptReport")
    Catch ex As Exception
    End Try
             oForm.DataSources.DataTables.Add("TestReport")
             oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT     Number, RefDate, Memo        into  rptReport   FROM         dbo.OJDT")
             oTable = oForm.DataSources.DataTables.Item("TestReport")
    This code is error. I don't know how to execute 2 this sql command. Hope everyone help me hix hix!  .

    /Invalid query tree  [300-33]. The SQL error is 8180/
    But search in SQL book hasn't got that err. Some person spoke ExecuteQuery property wasn't support Table Delete and Create, it only support simple Select... I tried to use Recordset but don't success. Can I use "Delete" and "Select ... Into..."   query another style??? Help me, please...!!!

Maybe you are looking for