Query For Series wise Collection

Hi
Please anyone provide  query for series-wise collection

Satish Doke,
Im using this query as "Series Wise Outstanding" I want to create another  query for "series wise collection".How can  i do this.Im not into SAP accounting.Please help.
DECLARE @Date AS DATETIME
DECLARE @Series AS varchar(30)
DECLARE @Branch AS varchar(30)
DECLARE @Exec AS varchar(30)
/* SELECT FROM [dbo].[OINV] S0 WHERE */ SET  @Date = /* S0.DocDate*/ '[%0]'
/* SELECT FROM [dbo].[NNM1] S2 WHERE */ SET  @Series = /* S2.SeriesName*/ '[%2]'
/* SELECT FROM [dbo].[OLCT] S3 WHERE */ SET  @Branch = /* S3.Location*/ '[%3]'
/* SELECT FROM [dbo].[OSLP] S4 WHERE */ SET  @Exec = /* S4.SlpName*/ '[%4]'
if( @Exec ='') set @Exec ='%'
if( @Series ='') set @Series ='%'
if( @Branch ='') set @Branch ='%'
if( @Date ='') set @Date =GETDATE()
Select distinct OINV.CardName [Customer Name], ISNULL(NNM1.SeriesName ,'-')+'/'+ CAST(OINV.DocNum as varchar) [Bill No.],
OINV.DocDate [Bill Date],INV1.Dscription,INV1.Quantity,
OINV.DocTotal - OINV.PaidToDate [Out Standing Amount],
DATEDIFF(dd,OINV.DocDate,@Date)[No of Days]  from OINV
inner join INV1 on OINV.DocEntry = INV1.DocEntry
inner join OLCT on INV1.LocCode = OLCT.Code
inner join NNM1 on OINV.Series = NNM1.Series
inner join OSLP on OINV.SlpCode = OSLP.SlpCode 
where OINV.DocType ='I' and (OINV.DocTotal - OINV.PaidToDate)>0
and NNM1.SeriesName like @Series and OINV.DocDate<= @Date
and OLCT.Location like @Branch and OSLP.SlpName like @Exec

Similar Messages

  • Query Approval -Series Wise

    Dear All
    I am facing a issue in the approval scenairo in PO
    Series created are AI10,TI10,AM10
    Now i ve created approval template with doctotal-inrange 10000-20000 series wise
    and in the query in i ve given query as
    select distinct 'true' from where t0.series =70
    But im getting approval template authorization for all the 3 series
    ex if AI10 series is chosen in PO the approval template for TI10 and AM10 also appears.
    Can any one give solution for the above so that only one approval template will be triggered

    Chintesh Soni and  Niladri Bhusan,
    I tried like this
    select distinct 'True' from opor t0 where t0.series=70 and $[opor.doctotal]>=10000 and $[opor.doctotal]<=20000
    what went wrong in the above query
    Gordan,
    If i use query approval along with built in terms,both are functioning

  • Query for Item wise sales report

    Hi Guys,
    Below is the query i have used to run Sales Register.
    But we need Item wise sales register  and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
    (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
    (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
    FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
    GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal

    Hi experts..
    Pls   Update the Query

  • Query for Item wise Sales.......

    *Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
    Pls update the query ...*
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal

    Closing this ...
    Edited by: Parimis on Jun 25, 2010 5:44 PM

  • Query for exception by collection ID

    Dear Exprt,
    Need your usual support to correct below query to have exception by collection ID (Table)
    select sys.ResourceID,sys.ResourceType,sys.Name0,sys.SMS_Unique_Identifier0,sys.Resource_Domain_OR_Workgr0,sys.Client0
    from SMS_r_system as sys where SMS_r_system.ResourceID not in(
    select  MachineID from SMS_RES_COLL_LAB00012)
    Regards
    [email protected]

    Hi,
    Here is an example:
    http://ccmexec.com/2010/11/planning-an-upgrade-of-an-application/
    Query:
    SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.Active = 1 and SMS_R_System.ResourceId not in (select ResourceID
    from SMS_CM_RES_COLL_0010007B)
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Query for material wise pricing

    i want to extract price for sales org/distribution channel/ Division/material. which tables can i used .

    Table
    Field combination
    A274
    - Sales org./Distr. chl/Division/Material/Item
    A273
    - Sales org./Distr. chl/Division/Material/Customer/Item
    Regards
    JP

  • Wise collection report

    Hi,
        This is request to you that in sap any standard report for customer wise collection report/receipt report  in SAP.?. Please provide the tcode.
    Regards
    Jibanjyoti

    Hi,
    Run t-code FBL5N
    Then under status tab select CLEARED ITEM and execute
    You will get report payment received/collection by customer
    kapil

  • Function returning SQL query for mutiple series in a chart

    Hi,
    I would like to know if there is a way to specify a single PL/SQL function returning the queries for multiple series in a 2D Line Flash Chart. I have multiple series in my chart that has different values in the where clause. I can write a PL/SQL function that can return all these queries in one shot. Is there anyway that I can specify this function as returning the queries for all the series in the chart?
    As an example, assume that I am using the following three queries for the series in my chart:
    select deptno, count(*) from emp where deptno = 10 group by deptno
    select deptno, count(*) from emp where deptno = 20 group by deptno
    select deptno, count(*) from emp where deptno = 30 group by deptno
    I can't write a PL/SQL function that returns a query in the multiple series syntax (SELECT link, label, series_1_value [, series_2_value [, ...]]FROM ...) as I am using an aggregate function and my where clause is different for each series.
    Thanks,
    Rupesh

    Hi Roel,
    Thanks for your reply. I am already using an analytical function (RATIO_TO_REPORT(COUNT(*)) OVER () ) in my actual report. My problem is that the query for one series differs from the other only in one where clause. I will be able to dynamically able to generate all the queries for all the series in one pl/sql function. But the chart definition screen does not allow us to define a single function that returns queries for the all the series - possibly seperated by some seperator like S1: select.... S2:select and so on.
    Regards,
    Rupesh

  • Collection query for computers with windows management framework 3.0

    Hi,
    collection query for computers with windows management framework 3.0, but I cant found a way. I cant see that it is in the inventory data for SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName.
    So any way to get computers with windows management framework 3.0?
    /SaiTech

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SoftwareProduct on SMS_G_System_SoftwareProduct.ResourceId
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareProduct.ProductName like "Windows Management Framework 3.0%"
    That won't work because as mentioned, it doesn't appear in ARP.
    Torsten's suggestion will work or you can resort to software/hardware inventory using the info at
    http://serverfault.com/questions/555100/methods-to-detect-version-of-windows-management-framework
    Jason | http://blog.configmgrftw.com

  • How to write nested cursor for Adv. Collections dunning letter query

    I am trying to write a query for Advanced Collections duninng letters. Some accounts for this customer have invoices for more than one currency. In order to find all of the invoices this query works:
    select to_char(sysdate, 'MM/DD/YYYY') currsysdate,
    decode((per.person_first_name || per.person_last_name), null, ARPT_SQL_FUNC_UTIL.get_lookup_meaning('RESPONSIBILITY', 'APS'), per.person_first_name) first_name,
    per.person_last_name last_name,
    org.party_name org_name,
    loc.address1 address1,
    loc.address2 address2,
    loc.city city,
    loc.state state,
    loc.postal_code postal_code,
    per.person_first_name first_name1,
    (select sum(aps.amount_due_remaining)
    from
    iex_delinquencies_all dd,
    ar_payment_schedules_all aps
    where
    dd.payment_schedule_id = aps.payment_schedule_id and
    dd.party_cust_id = org.party_id and
    dd.cust_account_id = 255849 and
    dd.customer_site_use_id = 13071) total_amount_due_remaining,
    to_char(sysdate+7, 'MM/DD/YYYY') required_pay_date,
    rs.source_email collector_email,
    arc.alias collector_name,
    arc.telephone_number collector_phone,
    ar.account_number,
    cursor
    (select
    ct.trx_number invoice_number,
    to_char(ar.due_date, 'MM/DD/YYYY') due_date,
    ar.amount_due_remaining amount_due_remaining,
    ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    ) as payment_history
    from
    HZ_LOCATIONS loc
    ,hz_parties org
    ,hz_parties per
    ,jtf_rs_resource_extns rs
    ,ar_collectors arc
    ,hz_cust_accounts ar
    where
    loc.location_id = 11600
    and org.party_id= 255849
    --and per.party_id = nvl(:CONTACT_ID, org.party_id)
    and per.party_id = 255849
    and arc.resource_id = rs.resource_id
    and rs.RESOURCE_ID = 100022224
    and ar.cust_account_id = 182399
    But this assumes there is only one invoice currency but there isn't. Now I need to loop through all the distinct currencies in the ar_payment_schedules table so I was trying something like this:
    select to_char(sysdate, 'MM/DD/YYYY') currsysdate,
    decode((per.person_first_name || per.person_last_name), null, ARPT_SQL_FUNC_UTIL.get_lookup_meaning('RESPONSIBILITY', 'APS'), per.person_first_name) first_name,
    per.person_last_name last_name,
    org.party_name org_name,
    loc.address1 address1,
    loc.address2 address2,
    loc.city city,
    loc.state state,
    loc.postal_code postal_code,
    per.person_first_name first_name1,
    (select sum(aps.amount_due_remaining)
    from
    iex_delinquencies_all dd,
    ar_payment_schedules_all aps
    where
    dd.payment_schedule_id = aps.payment_schedule_id and
    dd.party_cust_id = org.party_id and
    dd.cust_account_id = 255849 and
    dd.customer_site_use_id = 13071) total_amount_due_remaining,
    to_char(sysdate+7, 'MM/DD/YYYY') required_pay_date,
    rs.source_email collector_email,
    arc.alias collector_name,
    arc.telephone_number collector_phone,
    ar.account_number,
    cursor
    (select distinct ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    cursor
    (select
    ct.trx_number invoice_number,
    to_char(ar.due_date, 'MM/DD/YYYY') due_date,
    ar.amount_due_remaining amount_due_remaining,
    --ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    and ar.invoice_currency_code = invoice_currency_code
    ) as payment_history
    ) as g_currency
    from
    HZ_LOCATIONS loc
    ,hz_parties org
    ,hz_parties per
    ,jtf_rs_resource_extns rs
    ,ar_collectors arc
    ,hz_cust_accounts ar
    where
    loc.location_id = 11600
    and org.party_id= 255849
    --and per.party_id = nvl(:CONTACT_ID, org.party_id)
    and per.party_id = 255849
    and arc.resource_id = rs.resource_id
    and rs.RESOURCE_ID = 100022224
    and ar.cust_account_id = 182399
    But I am getting missing right parenthesis error which leads me to think I am writing this correctly.

    Note the name of this forum is "SQL Developer *(Not for general SQL/PLSQL questions)*", so only for issues with the SQL Developer tool. Please post these questions under the dedicated SQL And PL/SQL forum (you've posted there before).
    Regards,
    K.

  • Collection or Report query for IE versions

    Hi
    I'm looking for a way to create a collection and also a report which consists of IE versions. Many of the queries available with forums are showing old versions as well the new versions and it's duplicating the system names. Client systems are running with
    Windows 7 
    Thanks in advance
    LMS

    Hello Jorgen
    The above one gives total number of systems, but not sure about the correctness of numbers returned.
    We used below 2 queries for creating the collections and even each of them displyaing different lists
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SoftwareProduct on SMS_G_System_SoftwareProduct.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareProduct.ProductVersion like "x.%" and SMS_G_System_SoftwareProduct.ProductName like "%Internet Explorer%"
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "iexplore.exe" and SMS_G_System_SoftwareFile.FileVersion like "x.%"
    **Replace x with the version number
    So not sure which one to use. 
    Anyway we created collections for IE 8/9/10 & 11, since the list contains overlapped systems or system names we created another collections which contains just IE 8 / 9 / 10 or 11 versions by comparing and removing the collections created before. For
    eg. IE 11 collection created before is the one just for IE 11 since there are no newer versions and so no collections, IE 10 Collection (contains only IE 10) by compare IE 10 & 11 collections and excluded those in IE 11, IE 9 Collection created by comparing
    IE 9/10 & 11 collections and excluded those in 10 & 11 and so for IE 8 only.
    So can you tell me which query provides the exact collection result?
    Regards
    LMS

  • Query for log Parser to get number of hits in a day or week for particular web applications or site collection

    Hi All,
    Want to get the number of hits in a day for a web application with IIS logs. so need to know Query for log Parser to get number hits in a day or week for particular web applications or site collection. Kindly help
    Regards,
    Naveen

    I'm trying to get this from WSS 3.0, Hence using the Log Parser

  • Query for collection "Quick Fix Engineering"

    Hi!
    I try to create query for collection,to find all workstation with install specific KB, from "Quick Fix Engineering".
    Added by this sample:
    http://myitforum.com/myitforumwp/2011/10/04/non-security-hotfix-detection-for-windows-7-2008/
    Maybe you can help? Can not find an example :(
    cenubit

    That's made a lot simpler in ConfigMgr 2012, as it can now simply be selected as an extra class in the
    Hardware Inventory of your client settings.
    Simply go in to your client settings, go to Hardware Inventory
    and click Set Classes. Here you can select the Quick Fix Engineering class to be part of your inventory.
    After an inventory you will be able to create your collection. Do keep in mind that this will also capture a lot of information that you will probably never use.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • Query for create manual tabular form using apex collection add row button functionality

    Hello everyone
    My requirement is i created a tabular form manually using apex collection but if i click on add row button then previously selected data refreshed and added new row in this form it is fine.but i don't want to refreshed previously selected data and click on add row button then add new row .how it is possible? plz help
    Thanks & Regards,
    Ujwala

    Ujwala
    Instead of starting a new thread with the same question as Query for create manual tabular form using apex collection add row button functionality.
    Could you answer the question about what you see while debug the javascript code.
    If you don't understand the question or have trouble debug javascript let us know.
    Nicolette

  • QUERY FOR CUSTOMERS FULL DEBIT AND CREDIT WITH CLOSING BALANCE

    Hi Friends,
       I need query for CUSTOMERS FULL DEBIT AND CREDIT WITH CLOSING BALANCE for selection criteria from date and to date.
       I know the Trial Balance Report will sort out this issue... but i need routeday wise report
    1. Business Partner Master Data - i created one UDF field called U_Routeday (MONDAY, TUESDAY, WEDNESDAY,THURSDAY,FRIDAY)
    2. The query should be like selection criteria 
                                  - Routeday [%0]
                                  - Posting Date [%1]                           
                                  - Posting Date [%2]
    CardCode
    Debit
    Credit
    Balance
    D10503
    25031.50
    24711.50
    2962.00
    D10641
    5466.00
    7460.00
    285.00
    D10642
    2866.00
    142.00
    give any helpful query ASAP... Thanks in advance

    Hi,
    Try this query:
    Declare
    @fromdate as datetime
    Declare
    @Todate as datetime
    Declare
    @Code as nvarchar(25)
    set
    @fromdate = ( select min(Ta.[RefDate]) from OJDT ta where
    Ta.[RefDate] >= [%0])
    set
    @Todate = ( select max(Tb.[RefDate]) from OJDT tb where Tb.[RefDate]
    <= [%1])
    set
    @code = (select max(Tc.[ShortName]) from JDT1 tC where Tc.[ShortName]
    = [%2])
    SELECT
    [Name] as AcctName, [Jan]= sum([1]), [Feb]= sum([2]), [Mar]=
    sum([3]), [Apr]= sum([4]),  [May]= sum([5]), [June]= sum([6]),
    [July]= sum([7]), [Aug]= sum([8]), [Sept]= sum([9]), [Oct]=
    sum([10]), [Nov]= sum([11]), [Dec]= sum([12]), total = sum
    (isnull([1],0)+ isnull([2],0) + isnull([3],0) + isnull([4],0) +
    isnull([5],0) + isnull([6],0) + isnull([7],0) + isnull([8],0) +
    isnull([9],0)+ isnull([10],0) + isnull([11],0) + isnull([12],0))
    from
    (SELECT
    T0.[ShortName] as Name, sum(T0.[Debit]-T0.[Credit]) as T,
    month(T2.[RefDate]) as month FROM JDT1 T0  INNER JOIN OACT T1 ON
    T0.Account = T1.AcctCode INNER JOIN OJDT T2 ON T0.TransId =
    T2.TransId WHERE T2.[RefDate] between @fromdate and @todate and
    T0.[ShortName]  = @code  GROUP BY T0.[ShortName],T2.[RefDate] ) S
    Pivot
    (sum(T)
    For  Month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
    group
    by [Name],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]
    Let me know your result.
    Thanks & Regards,
    Nagarajan

Maybe you are looking for

  • Custom contact ringtones removed when using Hotmail sync

    I sync my Hotmail contacts with my iPhone.  Every so often, custom ringtones that I've assigned to various contacts are removed from the contact ... kicking it back to the default ringtone. I'm guessing it's a problem in that Hotmail doesn't recogniz

  • Existing "Publisher" application

    Is there a simple "microsoft publisher" made in flash. I need to allow clients to produca a very simple graphic via a web interface: Upload some images: Add some borders: Add text boxes & change font etc. Save the finished image as a jpg. Any help ap

  • Oracle.bpm_template_12.1.3.jar is missing in 12c JDev installation.

    Hi, To install BPM in 12c I am using following commands. CD %ORACLE_HOME%\soa\common\bin set QS_TEMPLATES=%ORACLE_HOME%\soa\common\templates\wls\oracle.bpm_template_12.1.3.jar qs_config.cmd The issue is I could not found oracle.bpm_template_12.1.3.ja

  • Multiple effects or plugins in a preset?

    I create alot of looks or effects that require 2 or more effects or plugins and quite often I need to use them again in later projects. Apart from creating a preset folder named "The Effect" and puting all my plugins/effects  in them for later use an

  • Initialize the service of application

    My ear got a program to parse a set of xml config. So, is it possible to initialize this process itself by any special setting of container? Is there any setting of web server/ejb container to accomplish this? It is not a servlet, I can't set the web