Aged Debt Analysis by Sales Employee

Hi Experts
I would like to be able to show our customer receivables ageing report by sales employee.  Can any of the experts suggest how to write a query which give me the same information but can limited by a user defined choice of the sales employee for the business partner.  This is required as on the road sales employees require information of outstanding debt of BPs before making further sales.
Regards
Jon

The following is filtered to show only Business Partner Balances for On Hold customers, but you should be able to tweak it for your purposes? Give it a try
/* SELECT FROM OINV T0 */
declare @AgingDate DateTime
/* WHERE */
SELECT @AgingDate = GetDate()
/* SELECT FROM OCRD T1 */
declare @CustomerFrom nvarchar(20)
/* WHERE */
set @CustomerFrom /* T1.CardCode */ = '' 
/* SELECT FROM OCRD T2 */
declare @CustomerTo nvarchar(20)
/* WHERE */ set @CustomerTo /* T2.CardCode */ = '' 
/* SELECT FROM OCRD T3 */
declare @OnHold nvarchar(20)
/* WHERE */ set @OnHold /* T3.FrozenFor */ = 'Y' 
/* SELECT FROM OSLP T4 */
declare @SalesRep nvarchar(30)
/* WHERE */
set @SalesRep /* T4.SlpName */ = [%0]
IF @AgingDate = CONVERT(datetime, '', 112)
            set @AgingDate = GetDate() 
select ocrd.CardCode [BP Code], 
        ocrd.CardName [BP Name],  
        ocrd.FrozenFor [On Hold], 
        @AgingDate [Aging Date], 
        isnull(T7.[BalanceDue],0) [Balance], 
        isnull(T7.[Current],0) [Current], 
        isnull(T7.[30Days],0) [1 Month], 
        isnull(T7.[60Days],0) [2 Months], 
        isnull(T7.[90Days],0) [3+ Months],                     
        ocrd.CreateDate, 
        T8.[Last Payment Date], 
        ( SELECT SUM(T1.DocTotal) FROM ORCT T1 WHERE T1.CardCode = T8.CardCode AND T1.DocDate = T8.[Last Payment Date]) [Total Last Payment],
        oslp.SlpName [Sales Rep], 
        ocrd.CntctPrsn [Key Contact], 
        ISNULL(ocpr.Tel1, ISNULL(ocpr.Cellolar, ocrd.Phone1)) [Contact Phone]
from ocrd   
        left outer join ocpr on ocpr.Name = ocrd.CntctPrsn and ocpr.CardCode = ocrd.CardCode  
        left outer join oslp on oslp.SlpCode = ocrd.SlpCode  
        left outer join   (
                    SELECT T0.CardCode,
                            SUM(T1.Original-T1.Cleared) [BalanceDue],
                            SUM(CASE WHEN T1.AgeDays < 0 THEN T1.Original+T1.Cleared ELSE 0 END) [Current],
                            SUM(CASE WHEN T1.AgeDays BETWEEN 0 AND 30 THEN T1.Original+T1.Cleared ELSE 0 END) [30Days],
                            SUM(CASE WHEN T1.AgeDays BETWEEN 31 AND 60 THEN T1.Original+T1.Cleared ELSE 0 END) [60Days],
                            SUM(CASE WHEN T1.AgeDays > 60 THEN T1.Original+T1.Cleared ELSE 0 END) [90Days],
                            SUM(CASE WHEN T1.AgeDays > 30 THEN T1.Original+T1.Cleared ELSE 0 END) [Overdue]
                    FROM ocrd T0
                            LEFT OUTER JOIN (
                                        SELECT T1.CardCode, T0.TransId, T0.Line_ID,
                                                DateDiff(m, T0.DueDate, @AgingDate) [AgeMonths],
                                                DateDiff(d, T0.DueDate, @AgingDate) [AgeDays],
                                                T0.Debit-T0.Credit [Original],
                                                SUM(ISNULL(T2.ReconSum,0)* CASE T2.IsCredit WHEN N'C' THEN 1 ELSE -1 END) [Cleared],
                                                (T0.Debit-T0.Credit) + SUM(ISNULL(T2.ReconSum,0)* CASE T2.IsCredit WHEN N'C' THEN 1 ELSE -1 END) [Balance]
                                        FROM jdt1 T0   
                                                inner join ocrd T1 on T1.CardCode = T0.ShortName
                                                left outer join itr1 T2 on T2.TransId = T0.TransId and T2.TransRowId = T0.Line_ID and T2.ReconNum = (select T3.ReconNum from oitr T3 where T3.ReconNum = T2.ReconNum and T3.Canceled = N'N' and T3.ReconType <> 7 and T3.ReconDate <= @AgingDate)
                                        WHERE T0.RefDate <= @AgingDate                                                                               
and T1.CardType = 'C'
                                                and (T1.CardCode >= @CustomerFrom OR @CustomerFrom = '')  
                                                and (T1.CardCode <= @CustomerTo OR @CustomerTo = '')  
                                        GROUP BY T1.CardCode, T0.TransId, T0.Line_ID, T0.DueDate, T0.Debit-T0.Credit
                                   ) T1 on T1.CardCode = T0.CardCode
                    WHERE T0.CardType = N'C'                                                     
                    GROUP BY T0.CardCode
            ) T7 on T7.CardCode = ocrd.CardCode
        left outer join (  
                    SELECT T1.CardCode,          
                                Max(T1.DocDate) [Last Payment Date]        
                    FROM ORCT T1        
                    WHERE (T1.CardCode >= @CustomerFrom OR @CustomerFrom = '')          
                                and (T1.CardCode <= @CustomerTo OR @CustomerTo = '')       
                    GROUP BY T1.CardCode  
               ) T8 on T8.CardCode = ocrd.CardCode
where ocrd.CardType = 'C'  
            and (oslp.SlpName = @SalesRep OR @SalesRep = '')  
            and (ocrd.CardCode >= @CustomerFrom OR @CustomerFrom = '')  
            and (ocrd.CardCode <= @CustomerTo OR @CustomerTo = '')  
               and (ocrd.ValidFor <>'Y')
            and ( (ocrd.FrozenFor = @OnHold
                         and (GetDate() Between isnull(ocrd.FrozenFrom, DateAdd(d,-1,GetDate())) and isnull(ocrd.FrozenTo, DateAdd(d,1,GetDate())))))
order by ocrd.CardCode

Similar Messages

  • Money overflow can not display  on Sales Analysis by Sale employee

    HI all!
    I have a problem when run report Sales Analysis by Sale employee. The value of Total Sales or A/R invoice can not greater than one billion.
    Could you help me?
    Thanks!

    Check this link with subject Money overflow error when updating a Purchase Order   
    Money overflow error when updating a Purchase Order

  • DRQ: down payments & sales analysis per sales employee

    Our client sells projects which last from 2 to 8 weeks. A down payment invoice is issued before the start of the project and the remaining amount is invoiced upon completion. Sometimes due to the fast pace of the project and the payment terms, the down payment invoice payment has not been received before issuing the final invoice. In SAP Business One this results in a problem as only paid down payment invoices can be drawn from the final invoice (this is by system definition). To make matters worse the only workaround seems to be (correct me if I am wrong) to amend this with manual journal entries. However, sales employee field cannot be activated in a manual journal entry. Hence, the sales analysis report per sales employee does not reflect true sales figures. Our suggestion is to develop the down payment functionality so that it can detect issued down payment invoices when putting the final invoice into the system, to make the whole process run smoothly.

    Hi Ajo,
    the comming version 8.8 includes the functionality which in the following scenario:
    1) Create Sales Order
    2) Create DP Invoice based on Sales Order from point 1
    3) Record payment of the DP Invoice
    4) Create Final Invoice based on Sales order from point 1
    proposing ther DP Invoices created based on the Sales Order from point 1 for the Final Invoice (when the Final Invoice is created).
    User can check and adjust (if necessary) the DP Invoices automatically linked to the Final Invoice.
    Hopefully this would help in your customer business process.
    Best Regards,
    Martin Slavik
    SAP Business One Solution Manager

  • Showing Monthly Sales Analysis for Sales Employees (including credit notes)

    Hi Experts,
    I want to show a report for my director so we can accurately decide upon sales targets for each sales employee for 2012.
    The Monthly Report > Invoices by posting date in the Sales Analysis module is not ideal because it does not appear to include credit notes so the totals are incorrect.
    How could I create a query which gave me a total for each month of 2011 for every sales employee which includes invoice minus credit notes.
    Unfortunately my SQL is not great but I started something which might help - this is only for first 2 months of the year.   I presume I would need a select statement for each month if I wanted to have the sales employee name followed by a total for each month.    Maybe this is too intensive a query to run anyway.  
    SELECT T1.[SlpName],
    (select(sum(t2.doctotal)-(t3.doctotal)) where (Month(t2.docdate)=1 and t3.docdate=1) FROM OCRD T0  INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode INNER JOIN OINV T2 ON T0.CardCode = T2.CardCode INNER JOIN ORIN T3 ON T0.CardCode = T3.CardCode)
    (select(sum(t2.doctotal)-(t3.doctotal)) where (Month(t2.docdate)=2 and t3.docdate=1) FROM OCRD T0  INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode INNER JOIN OINV T2 ON T0.CardCode = T2.CardCode INNER JOIN ORIN T3 ON T0.CardCode = T3.CardCode)

    Hi,
    I have moved your posting here because it belongs here.
    You may check this first: Re: Top Customers report
    Thanks,
    Gordon

  • More than one Sales employee

    Dear All,
    i am sales employee functionality. i created partner function P1 by copying the standard function PE. i created two sales emplyees and assigned in customer master dat with partner function PE&P1.
    i rasied the sales order& invoice , there i am getting the these partner functions.
    but when i am going to MCTI (Sales analysis of sales employees ), i am getting only PE partner function revenues. i am not getting the P1 partner function report.
    pealse help me out on above functionality.
    Thanks in advance.
    Regrds,
    Shekar

    Why use 2 different partner functions to identify two different sales employees? Why not just add both as partner type PE?
    You may need to check that PE is not setr to "Unique" (limited to only 1) in IMG: Sales and Distribution > Basic Functions > Partner Determination > Set Up Partner Determination >>Set Up Partner Determination for Customer Master >>>Partner Functions
    By identifying them both as PE, they will both show up in the Sales Analysis report.

  • Monthly Sales By Sales Employee

    Hello All!
    Is there any report that shows Monthly sales by Sales Rep.  So basically, consolidating all invoices for a rep by month. The headers would look like this:
    Sales Rep...Jan...Feb...March...April...etc. Total
    Thanks!
    Mike

    Hello Mike,
    Please check the Sales Module > Sales reports > Sales Analysis > by Sales Employee tab.
    You can select the Annual, Monthly, Qterly Report from the various options in the Selection creteria window.
    Hope it solves the issue you are looking for.
    Regards,
    Jitin Chawla

  • SIS by Sales Employee

    Hi,
    I create new info structure for sales analysis by sales employee by copy from S006 (both info structure and update rule) but when I run report drill down by sales employee system show sales employee number = 0000000 not show the actual sales employee number. Any suggestion pls?
    Regards,
    Jr.SD

    First, you'll need to find out which info structure is used in this report (S006, I guess). Each report is using a different info structure, so if one of them is working it's not an inidicator.
    Then check in SE16 if there are any records whatsoever in the structure. If not, check transaction OMO1 if update is turned on for this structure. If yes, then check if the configuration has been maintained for updates in this info structure. This is too complex to explain here, you might want to read more in SAP help:
    http://help.sap.com/saphelp_470/helpdata/en/c1/37544e449a11d188fe0000e8322f96/frameset.htm

  • Sales Analysis by Item Group (Monthly) - To include Sales Employee Name

    Hi,
    I have added Sales Employee Name in the Sales Analysis by Item Group (Monthly) report by A/R Invoices. I have added this under Repetitve Area Header0. However, the sales employee name showed in the preview is different than the criteria entered.  It seems that the report only the first Sales Employee Name in the report.
    Anyone have any idea? Thanks in advance
    Regards,
    MH

    That is a good question.  You have to find out any unique relationships between your Sales Employee and your sales analysis data if there is. Hope the help below can assist you:
    Relate to
    This option is relevant for special scenarios only and requires knowledge of SQL.
    This field is used for retrieving data related to key records found in tables other than the table linked as default to the current print template.
    A key record is a field used as a primary key in a certain table. This key record functions as the identifier of the record, and, therefore, it is required to retrieve any additional data related to it.
    Following is an example:
    e.g.If you need to print the name of a certain bank, which is not linked to the table used in the current print template, you must first create a Text field of Database source type using the required table and select a key record, such as Bank Code.
    Then, you need to create an additional Text field of Database source type. Select the table again, select the required column (such as Bank Name), and enter the unique ID of the field with the key record in the Relate to field.
    There might be two or more key records in the same table. In such a case, these two key records are both required for retrieving the data.
    Identical bank codes are used in many countries. If you need to print the name of a specific bank, you need to link it to a relevant country, in addition to its relevant bank code.
    You are currently working on a print template for Incoming Payments. However, you need to retrieve data (such as the business partner's bank name) linked to the key record Bank Code from the Bill of Exchange for Payment table, rather than from the Incoming Payments table.
    In the Relate to field, select the unique ID of the field containing the required key record. In this example, this is a Text field of Database source type containing Bill of Exchange for Payment in the Table field and BP Bank Country in the Column field. The drop-down list contains the unique IDs of all the fields that are situated in the same area as the current field.
    This link makes the system retrieve the Bank Code linked to the BP Bank Country field found in the Bill of Exchange for Payment table.

  • Customer Recievables Ageing by Sales Employee showing No Sales Employee

    Dear Sir(s),
    We are on SAP Business One 8.81 PL04.
    The customer recievables Ageing by Sales Employee report shows "No Sales Employee". when we group by sales employee on the selection criteria.
    We have setup all our Customers with sales employees in the Business Partner Master Data.
    Please advise on what could be the cause of this.
    Kind Regards,
    Asif M.

    Hi Rahul,
    Yes, the sales employee details are captured on the invoice.
    Infact, on the "No sales employee" Group, only the Incoming Payments (Type : RC) show for the diferent customers and yet these incoming payments were paid based on the invoices which have the sales employees captured.
    The customers appear both on the "No Sales Employee" Group as negative balances as well as its correct "Sales Employee' group as positve balance. The report shows correctly when we select the group by as  "customer" in the selection criteria.
    Regards,
    Asif

  • Sales Employee analysis

    Hello,
    We do not have SAP HR module implemented, so I have created a new Account Group for Sales Employee and the Sales Employee partner function is linked to all my Sales Document type. I want to know, how will I be able to generate the Sales Employee Analysis (T.Code MCTI) in this case.
    Regards
    Ravi

    Hi Ravi
    First of all  Welcome to SDN forum
    First of all maintain data by doing the assignments  in OVRO and OVRP
    But make sure that you have maintained Customer statistics grp in CMR->sales area data ->sales tab
    In the same way make sure that you have maintained Material statistics grp in MMR->sales orgn1 tab->material statistics grp
    Now run the report MCTI then you will get the data
    Regards
    Srinath

  • Update sales employee to profitability analysis automaticaly

    Dear All
    I have problem like this:
    an order was entered but had the wrong Sales Employee before billing. We made the change in the order header but it is not updated to profitability analysis segment of every item. How can I make this update automatically?
    Regards

    Hi
    You could try using re-alignments with that Sales order.  It will only correct it at PA segment level (ce4XXXX table) and not line item level (ce1xxxx table.  It will then reflect correctly in the reports.
    Hope this helps
    Kind regards
    Dawn

  • SIS: sales employee analysis

    for a sales employee and customer on 25.05.09 and 27.05.09 2 invoices posted respectively but first invoice value shown in MCTI for the above combinations but second invoice value not shown in the same. i had already checked all settings for update groups and assignments.
    first inovice was cancelled once and again created on same date.
    what could be the reason that it is not shown in MCTI. keys and chracteristics not altered in standard infostructure S006.
    please help.

    Hi Bhushan,
    Can you check in the Billing Documents Tables VBRK and VBRP at Header and Item level if the Correct Update Group has been
    entered in the database.
    Also if above is OK then please check Simulation for these 2 billing documents and check what is the difference in the second documents Simulation when compared to First One.
    Hope this Info Helps.
    Madhukar.

  • Aged debt report( account receivable)

    Hi,
    I am supposed to develope a aged debt report. Will anyone please give me the an example of aged debt report.Is there any business content aged debt report available ??
    how will we find out the oustanding days, I mean between what date to what date.
    Please provide me as much as information in this.
    regards,
    Bill

    Hello Bill,
      Check  Business content FIAR, FIAP . where you have such reports.
    These reports use Posting date of the document , Clearing date on the document and user entry  Key date for the analysis.
    http://help.sap.com/saphelp_nw70/helpdata/en/ac/b2ae397f768c3ce10000000a11402f/content.htm
    Jaya

  • Sales Employee Incentive

    Hi,
    I have a typical case of a Sales employee eligible for an incentive on the billing document. I have created a Condition type (Item level) ZSEM by copying the Agent Commission since this is not in the standard process.
    In the pricing procedure (given Requirement Routine as 24 i.e. In the Billing Document and Calculation Type as 7 i.e. Percentage Variant), if I keep this as Statistical, this value is not getting posted to A/C's and if I don't then this value is adding upto the total Net value.
    My need is this value should accrue in one account and at the end of the month I should be able to run a report and disburse incentive to this employee whom I created thru FI route as a Vendor.
    Kindly suggest a solution to this issue.
    Regards,
    Vinod

    hi vinod,
    " as i understand ZSEM keeping it statistical is not passing to Accounting ".
    I am sure it goes to accounting still. You can also confirm this with the FI. As well when you release to accounting, you can see this in the billing document > account determination analysis.
    Even you can pass this value to CO-PA also for costing purposes by assigning this condition type to value fields through KE4I.
    Make sure you have an acckey attached with this condition in the pricing procedure. Even if you mark a condition as statistical it releases to accounting provided you have assigned an acckey to it in the pricing procedure and have done required revenue account determination in VKOA. Keep a different GL account so that you can clearly know whats the condition value.Otherwise you can pass this condition value to a sub total field and use it for any further processing with the help of abapers.
    Not only for a sales employee, even incase say we have depot sales managed by a third and pay commision to him for example 0.5 % on the turnover made, we can have a condition type determined in the sales order and capture the value. We need to keep it statistical only to ensure it doesnt effect the net value calculation.
    Thanks
    Sadhu Kishore

  • SIS - sales employee

    Hi experts,
    How to activate the report named "MCTI - sales employee"? Pls advise. Thx.
    Moreover, partner determination for sales doc has been maintained. Customer & material have been maintained well as other standard analyses can be run, such as MCTA - customer.

    Dear Cathy,
    Please confirm:
    1. Have you created Sales Employee/ Personnel Records with T. Code: VPE1?
    2. Have you mainatined Partner Determination for the same?
    For Info-sake: [Sales Employee|Re: Sales Employee]
    3. Have yoy key-in Sales Employee/ Personnel in to Sales Document i.e. Sales Order at Header-Level (Go To --> Header --> Partner)?
    If, above-said configurations are done already, Have you maintained SIS and LIS related settings:
    [SIS Activation|Re: Sales Information System]
    Best Regards,
    Amit
    Note: Some more references -
    Re: MCTA & MCTC - no data available

Maybe you are looking for

  • DTP Request Error: "Overflow converting from ''" (Executing rule)

    Hi, I have an error for every dataset in my dtp: Anyone an idea? Error Ercords Display says: Runtime error while executing rule Longtext: Diagnosis      An error occurred while executing a transformati      The exact error message is:      Overflow c

  • Word wrap in Coldfusion Builder 3?

    Does anyone know where/how to turn on word wrap in CFBuilder 3? I'm on the Mac, OSX 10.9.2 Thanks, Rich

  • Modifying XML files with JDOM

    Hi: I've been trying to get up to speed with JDOM, and while it seems pretty intuitive, I've been having a problem w/ modifying XML documents. Namely, once I get a Document object from a (skeleton) XML file, do changes made to the Document object thr

  • Pagination help!!!!!!!

    Hi all, Any code for pagination or any refernce to get pagination will be so helpfull i have a table with 192 records i want to display it 5 records in a page Please !! could any body help me out?? thanks in advance bye Srikavi

  • Function Module to Execute the task backgroundly

    HI gurus     I need to execute the workitem programatically which is possible in the SAP_WAPI_SET_WORKITEM_STATUS but I need the wiresult as 001 or 002 or 003 because this workitem task as decision task. So how I have to handle either through any FM