Customer received wrong transaction number

Hi all,
I encountered a strange problem with our shopping cart today.  We had two transactions that occured around the same time.  Let's say, customer A was assigned transaction number 100 and customer B transaction number 101.  Both transactions were saved into the database correctly.  However, customer B received an email confirmation stating that his transaction number is 100.  The details of his transaction in the email are correct, only the transaction number is mixed up.
Here's roughly the code:
// get transaction number
transNum = salesCFC.createTransactionNumber()
// save shopping cart into db
salesCFC.saveTransaction( transNum, session.shoppingBagObj)
// email customer
<cfmail from="" to="" subject="Transaction Number #transNum#">
     // shopping bag printout
</cfmail>
transNum is a local-scoped variable.
I have been scratching my head to understand how this happened.  We only discovered this issue because customer B wanted to cancel his transaction and he gave the transaction number belonging to customer A.  We checked our sent mail folder and sure enough both customers received confirmation emails with the same transaction number.
Is it possible that customer B's transNum variable got corrupted and crossed with customer A's transNum?

Here's roughly the code:
Can you post the actual code.  Including the code for createTransactionNumber().  Snip out anything that's not relevant (so code that does not use or influence the transaction number in any way... and excise any mark-up ;-), but include any branching and looping logic, and the relationship between any different files involved, incuding how each is called from other files.
It sounds like the transaction number is correct when you call saveTransaction(), but it gets overwritten between there and the CFMAIL call.  To state what is probably obvious.
Perhaps at some point you are inadvertantly putting the transaction number in some shared-scope variable which is being accessed by reference rather than value, eg one can have two requests doing this:
variables.myStruct = application.myStruct;
Which might look like variables.myStruct is local, but all it is is a reference to the shared scope variable.  So if one then does this:
variables.myStruct.someVariable = "some request-specific value";
Then all requests accessing variables.myStruct.someVariable will be accessing the same variable (the one in the application scope), and that variable will have a request-specific value.  Bad.  This will be the case for any complex objects in CF, except for arrays.  I only mention this because we've quite often been caught out by this.
Adam

Similar Messages

  • RECEIVED WRONG SERIAL NUMBER FROM ADOBE

    I have just purchased Photoshop Elements on line.
    I received an email with the serial number but when I enter the serial number to license my trial copy, I get an error message saying that this is not a valid license number.
    Please advise.

    Go here:
    Find your serial number quickly
    and scroll down to Still need help? Contact us. Keep working your way through the various screens, even when it looks like you're getting looped back to a page where you've already been (you aren't; it's just that the page looks identical) and eventually you can start a chat session and hopefully get it straightened out.

  • How to fix when wrong serial number is sent to a customer

    Hi,
    We are using SAP Business One 9.  We have some items managed by serial number.  Occasionally, someone will ship a customer the wrong serial number (vs. the serial number they have picked for the Invoice).  What is the best way to fix this?  Do we need to do a credit memo to get the incorrect serial number showing back in stock, and then a new Invoice with the correct serial number that they were shipped - or is there a better way to fix this? 

    HI Theresa,
    how about updating the serial numbers directly?
    http://help.sap.com/saphelp_sbo900/helpdata/en/45/2364f39e152b31e10000000a1553f7/content.htm
    "You can update the details of existing serial numbers with reference to specific items, subsequent to the definition or use of the serial numbers in documents."
    Best

  • Error while calling Receipt Un-application :Customer Transaction Identifier has taken a precedence over the transaction number

    Hi All,
    While calling the receipt Un-application API, I am getting a error like' Customer Transaction Identifier has taken a precedence over the transaction number'
    Kindly suggest as to how can I troubleshoot this?
    Appreciate your valuable Inputss

    Hi,
    i recommend having a Service request logged for this issue, as from related documentations in metalink most of them seemed to be a bug where oracle suggested patches (code Fixes) ... hence reaching oracle support would be a better approach ...
    Regards,
    Ivruksha

  • I am NOT a Verizon Customer nor is my number a Verizon number. So why am I receiving automated spam for them saying "Verizon we care about you. Thank you. And have a nice day"??? Who do I contact to get them to stop? Most everywhere I've looked required m

    I am NOT a Verizon Customer nor is my number a Verizon number. So why am I receiving automated spam for them saying "Verizon we care about you. Thank you. And have a nice day"??? Who do I contact to get them to stop? Most everywhere I've looked required me to be a Verizon Customer in order to contact them....Even calling the number back tells me to enter my number and then tells me I'm not a Verizon Customer. Dial 611. Then hangs up on me...

    This is one of the drawbacks with cellular numbers. The device number at one time was used by a Verizon customer. They may have changed it or more than likely ported to the service you are on then either gave it up, or changed it. You as a customer then get it.
    The only solution I can recommend is have your service change the number. However depending on who had it previously you may have more texts and spam calls. Or may get lucky and get none.
    Good Luck

  • Receivables: Diferrence between "transaction number" and "document number"

    Hi!
    What is the difference between "transaction number" and "document number" as shown in the transactions window?
    Where are they used?
    thanks!

    Transaction number is the Invoice number. It can be a manually entered number in case of manual invoices. Even in case of imported invoices, it can be a manually assigned number if the trx_number field is populated in the ra_interface_lines_all table. If you Invoice batch source setup indicates automatic transaction numbering, the transaction (invoice) number will be automatically generated sequentially. The starting number is mentioned in the Trx batch source.
    The document number is a number which is generated by Document sequencing. To have the document number generated, you have to do few Doc sequencing setups like setting the 'Sequencial Numbering' profile options, creating document sequences and assigning the sequence to the Categories. The trx types are created as categories.
    The Transaction number can be the same as the document number if you enable the option 'Copy Document number to Transaction number' in the Invoice batch source.
    Hope that helps.
    Thanks,
    Anil

  • I still didn't receive my online number after rece...

    I ordered the 3months period of the online number for Germany and I received the notice that 'We've delivered your order' confirmatioin from Skype, however till today I still haven't received any online-number and in my account page no online-number is given/activated. 
    Could you check what was going wrong? 
    Transaction date: Apr 23, 2012
    Order number: redacted to protect privacy
    Order status: Delivered
    Thanks.

    Dear Readers,
    We here in the Community do not have access to Skype accountholder files or records, so the best recommendation we can give you - which is also the correct action to take - is to contact Skype Customer Service directly.
    Here is a link to the instruction on how to contact Skype Customer Service via their secure portal: Contact Customer Service
    As you know you intend to contact Customer Service, skip past Step 2 of the instruction where several articles from the FAQ library will appear for you to review, and proceed to Step 3, Continue Support Request (the "button" appears at the lower right corner of the website page). You may also skip past in Step 4 where you will be referred back here to the Community; no need to do this as the Community is where you started.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Post Goods Issued Quantity vs Customer received Quantity.

    Dear All,
    I am having a requirement where there is always a difference between dispatched goods quantity to customer received quantity.
    For Example:
    Frozen Material of 100 Kg dispatched to customer, while customer is receiving delivery weight is reduced to 95 Kg.
    For this we need to capture both quantities and as actual dispatch was 100 Kg so delivered quantity cannot be changed, but we need to bill customer only for 95 Kg. Please help on this.
    Looking forward for your kind solutions.
    Regards,
    Yogesh Singh

    Please find developed solution.
    1). User goes to pricing screen and changed the actual and missing quantity.
    2). First program flow goes to ENHANCEMENT XYZ***3.
    2.1). If pricing condition type is Z***, Z***, Z*** or Z*** then  insert the value of KOMV-KUMZA and
             KOMV-KUMNE in to Z**_QTY table for KNUMV and KPOSN.
    2.2). If same key value already exist then modify the values else insert new values. Use KOMV and KOMP
             Structure data to insert or modify values in Z**_QTY.
    2.3) Z**_QTY table is used to hold actual and missing quantity.
    3). After this program flow goes to ENHANCEMENT XYZ***4. Here its changes the basic unit of
         Measure for division **. If RV61A-MEINS = 'EA' then change it to 'KG'.
    4). After this program flow goes to ENHANCEMENT XYZ***3 1. All pricing calculation takes place
         here.
    5). Check division is ** and transaction is VF01, VF02, VF03, VFX3.
    6). If account posting is initiated then check PGI is done for the invoice.
      6.1). Select data from VBFA table for delivery number where document type (VBTYP_N) is 'R' or 'h'.
      6.2). If total of 'R' mines total of 'h' is less than 1 then display error message for PGI not done.
    7). If division is ** then use KOMV-NTGEW for quantity else use KOMV-MGAME for quantity.
    8). For division ** check if material is catch weight material or not. If not then treat division ** as **.
    9). XKONV is main table, which is passed to enhancement through standard program.
    10). Loop at XKONV for basic and actual conditions. Divide quantity of step 7 at decimal place and insert
           into KUMZA and KUMNE fields of XKOMV.
      10.1). Change actual and basic quantity and amount .Multiplying quantity with rate to get amount.
    11). Now get the actual (Z***, Z***) and missing (Z***, Z***) from Z**_QTY table (check step 2).
      11.1). If values found then modify XKONV else insert relevant XKONV data into Z**_QTY table.
    12). Now loop at XKONV and calculate amount for every pricing condition.
      12.1). Basic and actual price is already calculated in step 10.
      12.2). For actual and missing pricing condition, If value found in step 11 then use XKOMV-KUMZA,
                XKONV-KUMNE and XKOMV-KBETR to get amount.
      12.3). If condition type is ZD** or Z**V then get discount using XKONV-KBETR and actual amount.
                If ZD** then (XKONV-KBETR * actual amount) / 100000 is discount amount.
                If Z**V then multiply actual quantity with XKONV-KBETR to get discount amount.
      12.4). If condition type is Tax condition types then get amount  as calculated for discount.
      12.5). Get VPRS (Internal Price) rate by dividing material document amount with material doc quantity.
                Get all 'R' records from VBFA table for delivery number and use most recent document.
    13). Calculated amount for all other conditions same as step 12.
    14). If basic quantity - actual quantity - missing quantity is less than 0 then give message and clear missing
            Quantity fields.
    15). Now calculated values for fields where KSCHL (condition type) is blank (Like: Price after Tax).
      15.1). for price after discount and price after tax rows add actual amount and discount/tax amount.
    16). Coinage is also calculated by this enhancement. first add total value of all items and then get the
            round off  value. Divide this round off value equally in all items.
    17). After this program flow goes to ENHANCEMENT Z***_****1.
      17.1). Here program calculate the net value of every line item. Net value is actual value + discount +
                freight + coinage.
    Regards,
    Yogesh Singh

  • Invoice Date needs to be date when Customer receives goods

    Client when shipping by sea would like the Invoice Date to be the same day the customer received the goods, basically the Pick Up Date even though the delivery might have been 'shipped' from the jetty.
    How can this be done? Would the Invoice Date be the Pick Up date?
    Sanjib

    Hi,
    I guess you're asking about OM shipping and AR invoices. If you have invoicing at line level, as soon as you ship a line, OM insert a line into AR interface and this line is ready to be imported into AR. If you ship from USA to Europe by sea it will take about 10-15 days to goods be delivered. As invoice date is defined when you import it into AR, in order to achieve your requirement, you will not be able to import your invoice into AR and will not have info on Receivables. Or do you want to import your invoice into AR as soon as goods are shiped and change the invoice date when customer receives them?
    In the first option, you could do the following: define two AR batch sources: AIR and OTHER, for example. The first one will be used to sea shipping and the second one to ground or air shipping. In the first AR batch source, uncheck derive date. In OM, define two order types: OT_AIR and OT_OTHER, one to sea shipping and other one to ground/air shipping. In order type AIR, define AIR as batch source, and in OT_OTHER define OTHER as batch source.
    Normally import your transaction with batch source OTHER into AR. For the orders shipped by sea, you will have to import them one by one. As soon as you receive the customer acks, go to ar autoinvoice and import the order received by the customer and define as default transaction date the date informed by the customer.
    I know it is not a good solution, so I think you will need some custom to have it done.
    Hope it helps,
    Ketter Ohnes

  • SAP B1 crystal report: Customer Receivable Aging report

    Hi All, I want to write a Customer Receivable Aging report  in crystal report. I was using query to union open AR crdit memo and AR invoice.   but, I foggot to add incomming payment ORCT.   I really have trouble to get Customer Receivable Aging report . Can anyone help me? thanks    Is that I did in wrong direction? 
    SELECT OINV.DocEntry,OINV.DocNum,OINV.ObjType,OINV.CardCode,OCRD.CntctPrsn,OCRD.fax,OINV.NumAtCard,OINV.Address,OCTG.PymntGroup
           ,OINV.CardName,OINV.DocDate,OINV.DocDueDate,OINV.DocCur,OINV.DocTotalFC,
           OINV.DocTotal, (OINV.DocTotal-OINV.PaidToDate) as AmountAUD
      FROM SAPLIVE.dbo.OINV OINV join SAPLIVE.dbo.OCTG OCTG
      On OINV.GroupNum=OCTG.GroupNum 
             join SAPLIVE.dbo.OCRD OCRD
             On OINV.CardCode=OCRD.CardCode
      WHERE OINV.CANCELED='N' AND OINV.DocStatus='O' AND (OINV.DocTotal-OINV.PaidToDate)>0
    union
    SELECT ORIN.DocEntry,ORIN.DocNum,ORIN.ObjType,ORIN.CardCode,OCRD.CntctPrsn,OCRD.fax,ORIN.NumAtCard,ORIN.Address,OCTG.PymntGroup
           ,ORIN.CardName,ORIN.DocDate,ORIN.DocDueDate,ORIN.DocCur,ORIN.DocTotalFC,
           ORIN.DocTotal,(ORIN.DocTotal-ORIN.PaidToDate)as AmountAUD
      FROM SAPLIVE.dbo.ORIN ORIN join SAPLIVE.dbo.OCTG OCTG
      On ORIN.GroupNum=OCTG.GroupNum
       join SAPLIVE.dbo.OCRD OCRD
             On ORIN.CardCode=OCRD.CardCode
      WHERE ORIN.CANCELED='N' AND ORIN.DocStatus='O' AND (ORIN.DocTotal-ORIN.PaidToDate)

    Hello Julian - maybe you can start with the JDT1 table which contains all of the General Ledger Journal Entries...
    Hope this helps...
    Regards - Zal
    --F-BP AR Aging Report Detail Ver 1 ZP 2011 04 16
    --DESCRIPTION:  SQL uses General Ledger Detail to create an Aging Report which shows
    actual invoices, credit memos, and payments by reference date in the JDT1 table.
    --AUTHOR(s):
    --Version 1 Zal Parchem 16 April 2011
    SELECT
    T1.CardCode AS 'Cust Num',
    T1.CardName AS 'Cust Name',
    T0.SysDeb AS 'Debit Amt',
    T0.SysCred * -1 AS 'Credit Amt',
    CASE
    WHEN T0.TransType = 13 THEN 'AR Invoice'
    WHEN T0.TransType = 14 THEN 'AR Cred Memo'
    WHEN T0.TransType = 24 THEN 'Payment'
    ELSE 'Other'
    END AS 'Trans Type',
    T0.Ref1 AS 'Reference',
    FcCurrency AS 'Currency',
    CONVERT(VARCHAR(10), RefDate, 103) 'Posting Date',
    CONVERT(VARCHAR(10), DueDate, 103) 'Due Date',
    CONVERT(VARCHAR(10), TaxDate, 103) 'Doc Date' ,
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 <  31 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '0-30 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 30
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 61 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '31 to 60 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 60
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 91 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '61 to 90 days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 90
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 121 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '90 to 120 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 120
    THEN
    CASE
    WHEN SysCred != 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '120 Plus Days'
    FROM JDT1 T0
    INNER JOIN OCRD T1
    ON T0.ShortName = T1.CardCode
    AND T1.CardType = 'C'
    WHERE
    T0.IntrnMatch = '0'
    AND T0.BalDueDeb !=  T0.BalDueCred
    ORDER BY
    T1.CardCode,
    T0.TaxDate
    FOR BROWSE

  • Multi-Currency Customer Receivables Aging Query

    Hello Everyone,
    SAP B1 2005 SP 01 PL 42
    We cannot produce customer statements for multi-currency accounts (CND & USD) through the Customer Receivables Aging report.  The report converts all FC to LC which is not useful to the customer.
    The statement must show the open invoices in USD and open invoices in CND so that the customer can pay in the appropriate currency.
    We are attempting to create a query to solve this issue and assign a PLD to execute the calculations, but cannot see the best way to execute the task.
    The customer account balance (displaying only unreconciled tans.) would be the most reliable data set (form 809), but it is not available as a table in the query manager.  Any other table suggestions?
    We would like to avoid building the query from scratch (collecting all open invoices, credits, payments etc...) to avoid error.  We would also like to avoid exporting the data as this is very time consuming.  Any suggestions?
    Thanks in advance,
    Tamara

    We have found it better to set up two customers where different currencies are transacted - one in each currency. That way you can produce a statement in each currency.
    I know it's not a perfect solution, but a good work around?
    The only way to get the data you need would be to use OJDT and JDT1 tables, but you would need to join to the reconciliation table as well (OITR?) to get open transactions.

  • Customer Receivables Ageing Report

    Hi experts,
    Our SAP version is 2005B PL 43.
    The Customer receivable Ageing Report has two tabs- By Journal entries tab and By sales Documents tab.
    1. We find that all Payments, Credit notes and Invoices appear in the Customer Ageing Report By Journal Postings.
    This happens in case where an invoice has been partly paid alongwith few other invoices which have been fully paid which we are unable to knock off, limitation in this version of SAP.As a result the Incoming payment and The Invoices both are seen as open in the Ageing Report - By jounal Postings whereas the Ageing Report by Sales Documents shows the net values.
    There are cases where if an incoming payment is cancelled, the cancelled entry is not knocked off,again a limitation in this version,as a result the Ageing Report by Jounal postings shows both the wrong payment received as well as the cancelled entry.This does not appear in the Ageing Report by Sales documents.
    2. The customer Statement Report if printed from the Customer Receivable Ageing Report - By Jounal Postings displays the payment entries alongwith the Credit notes and Invoices, which is very difficult for the customer to understand.
    Instead can we use the Ageing Report by Sales Documents to print the Customer Statement Report?
    3. Lastly The Ageing Report by Journal Postings can match the Ageing Report by Sales documents only if partly paid invoices, advance payments and cancelled payments are knocked off.
    We are currently not planning to upgrade to 2007B as we are waiting for the 8.8 version which will be rolled out in end of Dec, as informed to us by the SAP regional office.
    Our question is which settings will give us the correct Ageing for a customer?
    Regards,

    Hi Vishal,
    SAP always recommends to go with the ageing report by journal postings in the old versions. What happens there is that there are 2 separate reconciliation engines at work, one at document level which supports partial reconciliation & one at journal entry level, which only supports full reconciliation. Please have a look at this YEC presentation:
    https://psd.sap-ag.de/PEC/calendar/html/recording.php?hck=ee2c7bfa07c3f6523f8846e14428985172efeb4545d14ed4757dfc29be3732557a8abf7a1e89fc7e357cd90b6c39b9123e5cf0f6c4b1ab283171b31ede9ba278
    One of the most significant changes in version 2007 & 8.8 is that these reconciliation engines are now unified in that partial reconciliation is also fully supported on journal entry level.
    You will find a lot of info on this landing page:
    English: http://service.sap.com/~sapidb/011000358700000380562007E
    I would highly recommend you upgrade to 2007, it is much, much more advanced than 2005.
    All the best,
    Kerstin

  • Customer Receivables Aging_Query

    Hi, I have a query for Customer Receivables Aging, I found it in the next link [] I customize it for specific needs. It gives the correct total of Balance Due for all our customers, but it doesn't give the right age of the debt. Every time I Think I solve it, the next day is wrong again (Compare it with System's Standard Aging), The amounts for 0_7, 8_14 and so on are not correct. ¿What is wrong?
    DECLARE @Documents Table (DocNum Numeric(19,0), CardCode VarChar(15), CardName VarChar(100), DocDate DateTime, DocDueDate DateTime, DueDate DateTime, DayPastDue Numeric(19,2), Balance Numeric(19,2), Unapplied Numeric(19,2), Source VarChar(5))
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, (T0.DocTotal-T0.PaidToDate) AS Balance, (T0.DocTotal-T0.PaidToDate) AS Unapplied, 'RF' AS Source
    FROM OINV T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
    WHERE T0.DocDate<GetDate ()+1 AND T0.DocStatus='O' AND (T0.DocTotal-T0.PaidToDate)<>0 AND (T0.DocTotal-T0.PaidToDate)=T1.BalDueDeb + (- T1.BalDueCred)
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.DocTotal, T0.PaidToDate
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate ()-T0.DocDueDate AS NUMERIC) AS DayPastDue, -T0.OpenBal AS Balance,   T0.DocTotal AS Unapplied, 'PR' AS Source
    FROM ORCT T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
    WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[Canceled] ='N' AND T0.OpenBal<>0 AND -T0.OpenBal=T1.BalDueDeb + (- T1.BalDueCred)
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PP' AS Source
    FROM OVPM T0
    WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[OpenBal]<>0 AND T0.[Canceled] ='N' AND T0.DocTotal<>-T0.OpenBal
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
    ORDER BY CardCode
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], CAST(GetDate()-T0.DueDate AS NUMERIC) AS DayPastDue, T0.BalDueDeb +  (- T0.BalDueCred) AS 'Balance', CASE WHEN T0.Debit>0 THEN T0.Debit else T0.Credit*-1 END Unapplied, 'AS' AS Source
    FROM OJDT t2 INNER JOIN JDT1 T0 on T2.TransId=T0.TransId INNER JOIN ocrd t1 on T0.ShortName=T1.CardCode
    WHERE T1.cardtype='C' AND T2.transtype=30 AND T2.REFdate < GetDate ()+1 AND T0.[LineType]=' ' AND (T0.[BalDueDeb]>0 or  T0.[BalDueCred]>0)
    GROUP BY T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], T0.Debit, T0.Credit, T0.[Line_ID], T0.BalDueDeb, T0.BalDueCred
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, CAST(GetDate()-DocDueDate AS NUMERIC) AS DayPastDue, (-1)*DocTotal AS Balance, (-1)*(DocTotal-PaidToDate) AS Unapplied, 'RC' AS Src
    FROM ORIN T0 INNER JOIN (SELECT distinct DocEntry, bASeentry FROM rin1 WHERE DocDate < GetDate ()+1 ) T1 on T0.DocEntry=T1.DocEntry
    WHERE T0.DocStatus='O' AND T1.bASeentry is null AND T0.DocDate<GetDate ()+1 AND DocStatus='O'
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, DocTotal, PaidToDate
    SELECT B.CardCode AS 'SBO Code', B.CardName AS 'Customer', T2.GROUPName AS 'Group', B.Balance_Due AS 'Total_Debt',  (B.Future_Remit) AS 'Future_Remit', B.Days7 AS 'Due_on_7_Days', B.Days_0_7 AS '0_7', B.Days_8_14 AS '8_14', B.Days_15_30 AS '15_30', B.Days_31_45 AS '31_45', B.Days_46_60 AS '46_60', B.Days_61_90 AS '61_90', B.Days_91_120 AS '91_120', B.Days_120_Over AS '120+'
    FROM
    (SELECT A.CardCode, A.CardName, Sum(A.Balance)Balance_Due, Sum(A.Future_Remit)Future_Remit, Sum(A.Days_0_7)Days_0_7, Sum(A.Days_31_45)Days_31_45,
    Sum(A.Days_61_90)Days_61_90, Sum(A.Days_91_120)Days_91_120, Sum(A.Days_120_Over)Days_120_Over, Sum(Days7)Days7, Sum(Days_8_14)Days_8_14, Sum(Days_15_30)Days_15_30, Sum(Days_46_60)Days_46_60
    FROM
    (SELECT CardCode, CardName, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS CurrBal, Sum(Balance) Balance, Source, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS Future_Remit, Sum(CASE WHEN DayPastDue>=-7 AND DayPastDue<=0 THEN Balance else 0 END) AS Days7, Sum(CASE WHEN DayPastDue>=1 AND DayPastDue<8 THEN Balance else 0 END) AS Days_0_7, Sum(CASE WHEN DayPastDue>=8 AND DayPastDue<15 THEN Balance else 0 END) AS Days_8_14, Sum(CASE WHEN DayPastDue>=15 AND DayPastDue<31 THEN Balance else 0 END) AS Days_15_30, Sum(CASE WHEN DayPastDue>=31 AND DayPastDue<46 THEN Balance else 0 END) AS Days_31_45, Sum(CASE WHEN DayPastDue>=46 AND DayPastDue<61 THEN Balance else 0 END) AS Days_46_60, Sum(CASE WHEN DayPastDue>=61 AND DayPastDue<91 THEN Balance else 0 END) AS Days_61_90, Sum(CASE WHEN DayPastDue>=91 AND DayPastDue<121 THEN Balance else 0 END) AS Days_91_120, Sum(CASE WHEN DayPastDue>=121 THEN Balance else 0 END) AS Days_120_Over
    FROM @Documents GROUP BY CardCode, CardName, Source)A
    WHERE A.Balance<>0 GROUP BY A.CardCode, A.CardName)B
    LEFT OUTER JOIN [dbo].[OCRD] T1 ON T1.[CardCode] = B.CardCode AND T1.[CardType] = 'C' LEFT OUTER JOIN [dbo].[OCRG] T2 ON T1.[GroupCode] = T2.[GroupCode]
    WHERE B.Balance_Due<>0 ORDER BY B.CardCode
    Edited by: mariaem on Feb 17, 2011 4:03 PM
    Edited by: mariaem on Feb 17, 2011 4:05 PM

    Hi, I have a query for Customer Receivables Aging, I found it in the next link [] I customize it for specific needs. It gives the correct total of Balance Due for all our customers, but it doesn't give the right age of the debt. Every time I Think I solve it, the next day is wrong again (Compare it with System's Standard Aging), The amounts for 0_7, 8_14 and so on are not correct. ¿What is wrong?
    DECLARE @Documents Table (DocNum Numeric(19,0), CardCode VarChar(15), CardName VarChar(100), DocDate DateTime, DocDueDate DateTime, DueDate DateTime, DayPastDue Numeric(19,2), Balance Numeric(19,2), Unapplied Numeric(19,2), Source VarChar(5))
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, (T0.DocTotal-T0.PaidToDate) AS Balance, (T0.DocTotal-T0.PaidToDate) AS Unapplied, 'RF' AS Source
    FROM OINV T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
    WHERE T0.DocDate<GetDate ()+1 AND T0.DocStatus='O' AND (T0.DocTotal-T0.PaidToDate)<>0 AND (T0.DocTotal-T0.PaidToDate)=T1.BalDueDeb + (- T1.BalDueCred)
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.DocTotal, T0.PaidToDate
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate ()-T0.DocDueDate AS NUMERIC) AS DayPastDue, -T0.OpenBal AS Balance,   T0.DocTotal AS Unapplied, 'PR' AS Source
    FROM ORCT T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
    WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[Canceled] ='N' AND T0.OpenBal<>0 AND -T0.OpenBal=T1.BalDueDeb + (- T1.BalDueCred)
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PP' AS Source
    FROM OVPM T0
    WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[OpenBal]<>0 AND T0.[Canceled] ='N' AND T0.DocTotal<>-T0.OpenBal
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
    ORDER BY CardCode
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], CAST(GetDate()-T0.DueDate AS NUMERIC) AS DayPastDue, T0.BalDueDeb +  (- T0.BalDueCred) AS 'Balance', CASE WHEN T0.Debit>0 THEN T0.Debit else T0.Credit*-1 END Unapplied, 'AS' AS Source
    FROM OJDT t2 INNER JOIN JDT1 T0 on T2.TransId=T0.TransId INNER JOIN ocrd t1 on T0.ShortName=T1.CardCode
    WHERE T1.cardtype='C' AND T2.transtype=30 AND T2.REFdate < GetDate ()+1 AND T0.[LineType]=' ' AND (T0.[BalDueDeb]>0 or  T0.[BalDueCred]>0)
    GROUP BY T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], T0.Debit, T0.Credit, T0.[Line_ID], T0.BalDueDeb, T0.BalDueCred
    INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
    SELECT T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, CAST(GetDate()-DocDueDate AS NUMERIC) AS DayPastDue, (-1)*DocTotal AS Balance, (-1)*(DocTotal-PaidToDate) AS Unapplied, 'RC' AS Src
    FROM ORIN T0 INNER JOIN (SELECT distinct DocEntry, bASeentry FROM rin1 WHERE DocDate < GetDate ()+1 ) T1 on T0.DocEntry=T1.DocEntry
    WHERE T0.DocStatus='O' AND T1.bASeentry is null AND T0.DocDate<GetDate ()+1 AND DocStatus='O'
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, DocTotal, PaidToDate
    SELECT B.CardCode AS 'SBO Code', B.CardName AS 'Customer', T2.GROUPName AS 'Group', B.Balance_Due AS 'Total_Debt',  (B.Future_Remit) AS 'Future_Remit', B.Days7 AS 'Due_on_7_Days', B.Days_0_7 AS '0_7', B.Days_8_14 AS '8_14', B.Days_15_30 AS '15_30', B.Days_31_45 AS '31_45', B.Days_46_60 AS '46_60', B.Days_61_90 AS '61_90', B.Days_91_120 AS '91_120', B.Days_120_Over AS '120+'
    FROM
    (SELECT A.CardCode, A.CardName, Sum(A.Balance)Balance_Due, Sum(A.Future_Remit)Future_Remit, Sum(A.Days_0_7)Days_0_7, Sum(A.Days_31_45)Days_31_45,
    Sum(A.Days_61_90)Days_61_90, Sum(A.Days_91_120)Days_91_120, Sum(A.Days_120_Over)Days_120_Over, Sum(Days7)Days7, Sum(Days_8_14)Days_8_14, Sum(Days_15_30)Days_15_30, Sum(Days_46_60)Days_46_60
    FROM
    (SELECT CardCode, CardName, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS CurrBal, Sum(Balance) Balance, Source, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS Future_Remit, Sum(CASE WHEN DayPastDue>=-7 AND DayPastDue<=0 THEN Balance else 0 END) AS Days7, Sum(CASE WHEN DayPastDue>=1 AND DayPastDue<8 THEN Balance else 0 END) AS Days_0_7, Sum(CASE WHEN DayPastDue>=8 AND DayPastDue<15 THEN Balance else 0 END) AS Days_8_14, Sum(CASE WHEN DayPastDue>=15 AND DayPastDue<31 THEN Balance else 0 END) AS Days_15_30, Sum(CASE WHEN DayPastDue>=31 AND DayPastDue<46 THEN Balance else 0 END) AS Days_31_45, Sum(CASE WHEN DayPastDue>=46 AND DayPastDue<61 THEN Balance else 0 END) AS Days_46_60, Sum(CASE WHEN DayPastDue>=61 AND DayPastDue<91 THEN Balance else 0 END) AS Days_61_90, Sum(CASE WHEN DayPastDue>=91 AND DayPastDue<121 THEN Balance else 0 END) AS Days_91_120, Sum(CASE WHEN DayPastDue>=121 THEN Balance else 0 END) AS Days_120_Over
    FROM @Documents GROUP BY CardCode, CardName, Source)A
    WHERE A.Balance<>0 GROUP BY A.CardCode, A.CardName)B
    LEFT OUTER JOIN [dbo].[OCRD] T1 ON T1.[CardCode] = B.CardCode AND T1.[CardType] = 'C' LEFT OUTER JOIN [dbo].[OCRG] T2 ON T1.[GroupCode] = T2.[GroupCode]
    WHERE B.Balance_Due<>0 ORDER BY B.CardCode
    Edited by: mariaem on Feb 17, 2011 4:03 PM
    Edited by: mariaem on Feb 17, 2011 4:05 PM

  • FBL5N t code and BSEG table is showing wrong contract number

    Hi,
    The proces flow is contract number>sales order>DMR-->Invoice
    Now when I am checking the VBFA table it's showing correct contract number against invoices but FBL5N t code and BSEG table are showing wrong contract numbers.
    Why FBL5N and BSEG table is showing wrong contract number?
    Currently we are using one enhancement and user exit is used to incorporate one customized field as identifier for bill type.
    1. During the billing document release to accounting VFX3, The user exit triggering and it is update the customized fields and Net settlement indicator.
    2. Using the Invoice number, get the fields VGBEL(Document number of the reference document) and VGPOS (Item number of the reference item) from VBRP and read table VBAP with VBELN and POSNR, to get DMR number (Sales Document) that created for the Invoice.
    3. Use fields VGBEL and VGPOS on table VBAP to get the sale order number.
    4. By using the Sales order number, get the Distribution channel to update Net indicator field
    In accounting table BSEG-UZAWE = JF must be updated on the customer line.
    5. Retrieve the sale order number and item level to get customized field from table VBAP
    Any pointers.
    Thanks
    Ashu

    Hi Reazuddin,
    Thanks for your reply,
    I am concercerned about BSEG table and using user exit EXIT_SAPLV60B_008 to post the document in FI.
    Now in we have enhanced this user exit  for contracts and included in this way.
      SELECT SINGLE ZZ_CONTRACT FROM VBAK INTO (LC_CONTRACT) WHERE VBELN EQ cvbrp-vgbel.
    Endloop.
    *Moving the values to final accounting table
    loop at xaccit.
    xaccit-vertn = lc_contract.
    xaccit-VBEL2 = xaccit-AUBEL.
    xaccit-xref3 = lc_vbel2.
    MODIFY xaccit .
    ENDLOOP.
    Clear: lc_contract,lc_vgbel,lc_vgpos,lc_vbel2.
    But I am getting correct data when checked other clients( development and quality), this problem I am getting in production.
    Do I need to ask the ABAP'er to debug this enhancement in production?
    Thanks
    Ashutosh

  • I purchased Adobe Acrobat X Pro two days ago and cannot receive my serial number; your form will not allow me to select my State for address-I have spent four hours of frustration

    Acrobat X Pro has a flawed serial number application form at the point where it asks for your State, the first time. I will not allow me
    to complete the form and receive my Serial Number.@

    I purchased it from my University bookstore and the attending clerk was no better informed than was I.
    The form is required to be infilled in order to receive the serial number necessary for installation of the software
    After five hours of trying, I was able to overcome the flaw in the form, as it appeared on the Acrobat website, and
    complete the two pull-down menus indicating the State in which I live.
    I called Adobe Customer Care for assistance and had to wait two hours for a return call, and by the time the
    call came though I had found that the website form allowed me to pull-down for the State of location.
    Adobe is an uncaring vendor, once it has your money in hand.

Maybe you are looking for

  • How do i find a lost ipad

    i have ipad 1 and 2 and an iphone. I registered all items and i have idisk/me. Anyway, i the ipad 2 is lost. When i use the find my iphone software it only looks for my ipad1 and my iphones. I have the serial #, can i track it manually? What do i do.

  • Apps for macbook air?

    who can tell me good aps for macbook air... as app store is a little poor on free apps.. i would like apps, games or something entertaining to download from the web.

  • Hello, I'm trying to print a picture but it say's that i have no themes installed. How can i install themes?

    It's seemed that i don't have any themes in Iphoto, how can i get them? Thank you.

  • Error during Demo Application initialization

    After the proper installation of the Headstart 2.1.2 and the Patch 10 against Designer & Developer 6.0 I tried to start the Demo Application and I receive the following message : tProcedure QMS$INIT_APPLICATION is missing in your application library,

  • Flash or After Effects

    Hello everyone. I am new to CS3. What's the difference between Flash and After Effects? Sense I bought the Master collection, I want to use everything in this CS3. And I confused on the two. I want to create animation and still image reels for my cli