User query - Average payment days

Hi,
I made a query to calculate the average number of days of payment for a customer using the journal transactions:
+SELECT AVG((DateDiff(DD, JDT1.DueDate, JDT1.MthDate)))
FROM OJDT INNER JOIN JDT1 ON OJDT.TransId = JDT1.TransId LEFT JOIN ORCT ON OJDT.TransId = ORCT.TransId
WHERE (JDT1.TransType = 13 OR JDT1.TransType = 203) AND JDT1.shortname='C0001' AND (JDT1.balduedeb-JDT1.balduecred) = 0 AND (ORCT.BoeSum = 0 OR ORCT.BoeSum IS NULL)+
But now I have a problem with payments made in the presence of Bill of Exchange because, in this case,  the reconciliation date coincides with that of incoming payment and not with the expiration date of the Bill of Exchange.
Do you have any suggestions to improve this query???
Thanks!

Hi,
I don't have BOE to try your query. To solve the problem, you need to separate your query to two to deal with different type first. After you got the correct result, you can combine them.
Thanks,
Gordon

Similar Messages

  • Average payment days for customer

    Hi to all,
    I need to calculate average payment days for customer in Crystal. Formula would be Accounts Receivables * Days in period / Invoiced Sales in Period. My main problem is in which tables can I find that data?
    Best regards,
    Duu0161ko

    I suggest posting to one of these forums. CR doesn't know the ERP data structure...
    http://forums.sdn.sap.com/index.jspa?categoryID=1#16

  • How to query which Tcodes specified user used with one day?

    Hi guys:
      How to query which Tcodes specified user used with one day?

    Hi
    You can use transaction code ST03N.
    1. Go to tx code - ST03N
    2. Under "Workload" you can select your "Instance or Total" so that it expands and shows you Days, Week, Month.
    3. If you want to look at the transactions executed for a particular day, lets say, then double click on any day.
    4. At the bottom left you get "Analysis Views"
    5. Select & expand "User and Settlement Statistics"
    6. Double click on "User Profile"
    7. On the right side of the window you get a list of all the users
    8. Double click on a particular user you want to view the details of.
    9. The new screen will display the "Transactions/Reports Utilized by User XXX"
    If you wanna track which users executed a particular transacation then follow this:
    10. In "Analysis Views" expand "Transaction Profile"
    11. Double click on "Standard"
    You can view the list of Transactions and Reports.
    12. Double click on the Tx Code or Report you wanna check and it will show the Use of it.
    This will help you.
    Regards
    Sumit Jain
    [reward with points if the answer is useful]

  • Approval Templates -Terms based on user query looks like cant work

    Dear all,
    How to use the "terms based on user query"? i try many time but it looks like cant work. do u have any example?
    good day...
    from
    grace

    I have found the way:
    A simple query to define a proper term in the approval stage:
    declare @var int
    set @var = 0
    Select case(@var) when 1 then 'true'  else 'false' end
    Returns 'true'--> Will not execute the approval procedure.
    @var = 1  Returns 'false'--> Will execute the approval procedure.

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • Error in User Query

    Hello, I have the following User Query:
    SELECT T.USERID As EmpID, OHEM.FIRSTNAME' 'OHEM.LASTNAME, OHEM.U_RATE AS GeneralRate, T.CARDCODE As CardCode, T.CARDNAME As CardName, SUM(ISNULL(T.APPROVED_HOURS,0)*ISNULL(T.RATE,0)) As BilledAmount, T.GENCHECK AS CheckNumber, OVPM.[CheckSum], OVPM.DOCDATE
    FROM SCCG_WB_TIME AS T LEFT JOIN OHEM ON OHEM.EMPID=T.USERID LEFT JOIN OVPM ON T.GENCHECK = OVPM.DOCNUM
    WHERE ISNULL(T.GENCHECK, 0)<>0 AND <b>T.USERID =[%0]</b>
    GROUP BY T.USERID, OHEM.FIRSTNAME' 'OHEM.LASTNAME, OHEM.U_RATE, T.CARDCODE, T.CARDNAME, T.GENCHECK, OVPM.[CheckSum], OVPM.DOCDATE
    I get an error because of the variable I have. When I press Execute I just get '' (SEWSY) error message in red. Without the variable is working fine. Please help me!
    Thank you,
    Irina

    Hi Irinca,
    I think (can't test it) the problem is the not-system-nor-usertable-but-yours table created in SBO that you're passing the variable (SCCG_WB_TIME, just in case).
    Try something like,
    DECLARE @UserId int
    SET @UserId = (SELECT TOP 1 T0.INTERNAL_K FROM [dbo].[OUSR] T0 WHERE T0.U_NAME = '[%0]')
    ...(your query....)... T.USERID = @UserId...
    HTH,
    Ian

  • Terms user query Changes in unit price in purchase order and a/p invoice

    Dear sir
         please give me a term user query for , if any changes in unit price in purchase order and a/p invoice

    Hi,
    Try this:
    SELECT  Distinct ' true'
    FROM adoc T2
    JOIN ado1 T0 ON T2.docentry = T0.docentry AND T2.Objtype = '22'
    JOIN por1 T1 ON T1.docentry = T0.docentry AND T1.Linenum=T0.Linenum
    WHERE  $[$38.14.number] != T0.Price
    Thanks & Regards,
    Nagarajan

  • How to allow a user to change Payment terms on A/R documents

    Hi All,
    I want to allow one of my user to change payment terms on A/R documents. I could'nt found it where to authorize a user for this purpose. Can anybody help me out with this?
    BR

    Dear Naveed,
    To enable users to change the Payment Terms in A/R, please give the user Full Authorization for Price Lists (Inventory -> Price Lists -> Price Lists).
    Hope this helps.
    Regards,
    Lorna

  • Find payment day of sales order

    Hi friends! I need some help!
    I'm trying to find the payment day of a sales order using a date and payment terms. I tryed function FI_FIND_PAYMENT_CONDITIONS and work well for payment terms with fixed day, but without this don't work. Anyone knows a function that works for all payment terms? (with and without fixed day).
    Thanks in advance for any help!

    Hello,
    You can use the FM "DETERMINE_DUE_DATE" for finding the Payment date of the SD document.
    Kindly check .
    Regards,
    Rinkesh Doshi

  • Is it possible to use parameter in a user query with subquery ?

    Hi ,
    i need to use parameter ( [%0] ) in user query using a subquery , but i have errors message when i execute the query 
    example :
    SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =N'[%0]'
    union all
    SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =N'[%0]'
    works fine
    but ( exactly the same query in the subquery )
    Select t2.Docnum ,t2.cde , t2.fact from
    SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =N'[%0]'
    union all
    SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =N'[%0]'
    ) t2
    return an error message
    the same query without parameter works fine too :
    Select Docnum ,cde , fact from
    SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  ='C1'
    union all
    SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  ='C1'
    ) t2
    Is it possible to use parameter in a subquery ?
    thanks

    Try this one:
    declare @cc nvarchar(20)
    set @cc=/*Select c.cardcode from OCRD c where c.cardcode=*/'[%0]'
    Select Docnum ,cde , fact from
    SELECT T0.[DocNum] as docnum, T0.[DocTotal] as cde , 0 as fact FROM ORDR T0 WHERE T0.[CardCode]  =@cc
    union all
    SELECT T0.[DocNum], 0 as cde,T0.[DocTotal] as fact FROM OINV T0 WHERE T0.[CardCode]  =@cc
    ) t2

  • Viewlink between Custom VO "Cannot set user query to view"

    We have an application where we have extended custom VO and EO’s to get data from flat files. It all looks fine till we create a viewlink for a LOV with two related VO’s. The viewlink VO fails we get message of the form -Cannot set user query to view "CustomVO1" because it is a destination in a view link”. Are there any methods to override in the custom VO/EO or any parameter to be added to configs. Has someone tried this out

    Thanks for the update and for sharing the solution!
    Regards,
    Hussein

  • How to create a parmetarized user query

    Hi all
    i want to create a user query with parameters so that when activated the user will have to fill those parmeters.
    question is how do i create these parameters by code?
    appreciate the help
    Yoav

    Hi Yoav,
    If you are running a query from within Query Generator then you can use the [%0], [%1] etc syntax and SBO will prompt the user when the query is run. If you are going to execute a query through code then you could create a little user form that contains fields for each of the parameters (ie write your own parameter window) and then run the query based on the values the user enters in your form.
    Kind Regards,
    Owen

  • User Exit for payment term

    Hi Friends
    how to write the User Exit for Payment terms at Item Level. Any Sample User Exits can help me if no exact User Exit Is there
    User Exit Name : USEREXIT_MOVE_FIELD_TO_VBKD
    Thanks in Advance.
    Regards
    sahiti

    Hi Amrish.
    thanks again.
    Hear is the complete ticket which i got from the client.
    1. User exit in Program MV45AFZZ
    User Exit Name : USEREXIT_MOVE_FIELD_TO_VBKD.
    create an include first - and then add the statements to that include..
    this way when there is a patch or an upgrade - we need to only type the include statement and not the extire userexit.
    2. External Table Specifications:
    the table is client dependent
    table name: zpaymentterm.
    client(keyfield)-mandt
    sales org(key)vkorg
    sales Doc-(key)auart
    material Grp-Matkl
    cust:kunnr
    Payment term (zterm) : ijput field in table maintenance
    3. select from the ztable using vbak-vkorg/vbak-auart/vbap-matkl/vbak-kunnr is equal to zztable fields.
    move corresponding zztable-zterm to vbkd-zterm.
    4. Validations: if no entry found in ztable then payment term from the customer master should be copied in the document.
    5. Create the maintenence view for the table and assigned with Transaction Code.
    Thanks in advance.
    Sahiti.

  • Clarification on Customer Payment days.

    Hi All,
    I have few basic Doubs in SAP SD,
    1) In our Business case , we are going to change the Paymnet days for the customer ( from 90 days billing to 120 days ). we changed in the master data   ( VD02). but if we creating Billing document for the old order ( which created at the time of 90 day billing in master data). for few customers if should be maintain as 90  and for few customers the New Payment days should get impact.
    please advise how can we incorporate thie cahnge?
    2) And also , the base currecny is INR and transaction currency is USD. when we process the Billing document , for fer customer system need to pick the Exchange rate from Order period and For few customer the Exchange rate from Billing period.
    Please advise how can we done this?
    Thanks
    Bala

    Hi Bala,
    1) In our Business case , we are going to change the Paymnet days for the customer ( from 90 days billing to 120 days ). we changed in the master data ( VD02). but if we creating Billing document for the old order ( which created at the time of 90 day billing in master data). for few customers if should be maintain as 90 and for few customers the New Payment days should get impact.
    For this you can specify additional days in sales order VA02-Go to header data>billing tab and specify the additional days for the field payment additional days.
    please advise how can we incorporate thie cahnge?
    2) And also , the base currecny is INR and transaction currency is USD. when we process the Billing document , for fer customer system need to pick the Exchange rate from Order period and For few customer the Exchange rate from Billing period.
    For this you can activate it at copy control from VTFL for the field exchange rate type.
    Thank you.

  • Link user query to required print layout

    Hi all,
    I tried linking my user query to a required print layout for user reports.
    I have followed the same procedure as given in  (Query PLD.pdf ) but when I try to save ,
    I get the following error
    Items were found with the same exclusive no [Message 101-19 ]
    Can anybody help me with this
    Thanks
    Nirmala B.

    finally got it

Maybe you are looking for

  • ITunes opens with no reason

    Since I got my new iMac, or since I upgraded to iTunes 10 (which happened at the same time), iTunes opens erratically with no iPod or iPhone attached. It even starts playing the first song/book in the list that was opened in the last session. What ca

  • Blank CDs not showing up in Finder

    When I insert a blank CD it will not show up in the Finder window so I can drag and drop things into it as a burn folder. I have the preference box for showing external media in the Finer checked so I don't understand why the media wouldn't be shown.

  • Not Like in Select Statement

    Hi All, My requirement is not to select the entries for the T024 table where the eknam is either starts with 'NOT VALID' or blank. For that, I have written the select statement using NOT LIKE, Will this negation in the select statement cause extra ex

  • Database link between Oracle Standard Edition and Oracle Enterprise Edition

    Hi, I am looking at setting up a data transfer process between an Oracle 11g Enterprise Edition database and an Oracle 11g Standard Edition database. Database links would be required each way. I heard once that this is not permitted as connecting Sta

  • Where has the extensions exchange gone?

    Where has the link to the exchange gone? It used to be available on the adobe website, but it's disappeared now, or it's not very obvious anymore! Mat