Approval query problem

Hi
Basically the problem is that my query is returning day instead of month...
Select MONTH($[OPOR.DocDueDate])
When I run this query on a PO with DocDueDate 22.05.14 (22nd of May) it will find that 22 is the month and give this error message:
Microsoft SQL Server - The conversion of a nvarchar data type to datetime data type resulted in an out-of-range-value
Any ideas?
BR
Kjetil Sandvik

Hi Kjetil,
Could you please test this syntax ?
SELECT DATEPART(MONTH, $[OPOR.DocDueDate])
Regards,
Johan

Similar Messages

  • Problem with user defined approval query

    Hi
    Sorry me for my english
    I have a problem with approval query
    DECLARE @DocDate DATETIME
    SET @DocDate = (SELECT $[OINV.DocDate])
    IF (DATEDIFF(DAY,@DocDate,GETDATE())) != 0
    BEGIN
    SELECT DISTINCT 'TRUE'
    END
    the query works with the previous invoices, but today's invoices show me a error colud not commit transaction
    Can Help me?
    Thanks
    Felipe Loyola

    Hi Felipe Loyola,
    Try this:
    SELECT DISTINCT 'TRUE' FROM OINV T0
    WHERE DATEDIFF(DD,T0.DocDate,GETDATE()) != 0 AND T0.DocNum = '$[$8.0.0\]'
    Thanks,
    Gordon

  • Rounding data on an approval query

    Hello everyone...
    As You know, taxes have increased in Mexico so we created new tax codes and accounts, and since I can't block any of the old taxcodes/acounts until all previous documents have ben closed/paid the only option I could think of was creating an approval process for all documents using the previous tax codes, since I can't create an approval query based on document lines/rows, I created it comparing the document's tax vs the document's total ($$). The old taxes were 10% and 15% these are the percentages I want to "block" using the approval process.
    Here's the query I created
    IF (($($27.0.number) = $($22.0.number).15) OR ($($27.0.number) = $($22.0.number).1) ) SELECT 'TRUE'
    The query/approval works, but there is a problem: SBO rounds to 2 decimals, so for a $ 124.15 sale the 15% tas would be 18.6225 but the tax ammount field would show 18.62 only which by being different in 0.0025 passes the criteria...
    How can I make this query work with rounded data?, I tried using round($($22.0.number)) but when then I always get a "Cannot comit transaction" error..
    Thanks in advance
    Hugo

    Hugo,
    I am glad my suggested solution worked.  I try to answer only questions that I know will work.
    It does not help in answering on a trail and error basis which unfortunately happens a lot of times as the enthusiasm in answering keeps away the focus.
    Depending on your decimal places definition in General Setting the numbers would be rounded.
    Using CAST to Varchar will also preserve the decimals but the numeric value will get converted.
    Best wishes
    Suda

  • Approval Query for a specific customer group

    Dear Experts,
                 Following is the scenario, customer deals with whole sale and retail customers group. The client wishes to ensure that If the whole sales customer group account balance greater than zero then while making a sales order or invoice it should trigger approval.
    Saravanan

    Hi Saravnan......
    Thy this Approval Query and just put the Group Code for your customer in this group code's inverted comma....
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[ORDR.CardCode.0]
    If above does not work then use below...
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[$4.0.0]
    Regards,
    Rahul

  • Designing LOV Query Problem

    Hello APEX people,
    I posted my problem here:
    Designing LOV Query Problem
    What I have is a sequence like this:
    CREATE SEQUENCE
    DR_SEQ_FIRST_SCHEDULE_GROUP
    MINVALUE 1 MAXVALUE 7 INCREMENT BY 1 START WITH 1
    CACHE 6 ORDER CYCLE ;
    What I need would be a SQL query returning all possible values oft my sequence like:
    1
    2
    3
    4
    5
    6
    7
    I want to use it as a source for a LOV...
    The reason why I use the cycling sequence is: My app uses it to cycle scheduling priorities every month to groups identified by this number (1-7).
    In the Admin Form, I want to restrict the assignment in a user friendly way - a LOV.
    Thanks
    Johann

    Here ist the solution (posted by michales in the PL/SQL forum):
    SQL> CREATE SEQUENCE
    dr_seq_first_schedule_group
    MINVALUE 1 MAXVALUE 7 INCREMENT BY 1 START WITH 1
    CACHE 6 ORDER CYCLE
    Sequence created.
    SQL> SELECT LEVEL sn
    FROM DUAL
    CONNECT BY LEVEL <= (SELECT max_value
    FROM user_sequences
    WHERE sequence_name = 'DR_SEQ_FIRST_SCHEDULE_GROUP')
    SN
    1
    2
    3
    4
    5
    6
    7
    7 rows selected.

  • SQL+-MULTI TABLE QUERY PROBLEM

    HAI ALL,
    ANY SUGGESTION PLEASE?
    SUB: SQL+-MULTI TABLE QUERY PROBLEM
    SQL+ QUERY GIVEN:
    SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
    HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
    DLC_POLYMORPHS_NORMAL_VALUE FROM PATIENTS_MASTER1, HAEMATOLOGY1,
    DIFFERENTIAL_LEUCOCYTE_COUNT1
    WHERE PATIENT_NUM = HMTLY_PATIENT_NUM AND PATIENT_NUM = DLC_PATIENT_NUM AND PATIENT_NUM
    = &PATIENT_NUM;
    RESULT GOT:
    &PATIENT_NUM =1
    no rows selected
    &PATIENT_NUM=2
    no rows selected
    &PATIENT_NUM=3
    PATIENT_NUM 3
    PATIENT_NAME KKKK
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 4
    HMTLY_RBC_NORMAL 4.6-6.0
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     60
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    ACTUAL WILL BE:
    &PATIENT_NUM=1
    PATIENT_NUM 1
    PATIENT_NAME BBBB
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 5
    HMTLY_RBC_NORMAL 4.6-6.0
    &PATIENT_NUM=2
    PATIENT_NUM 2
    PATIENT_NAME GGGG
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     42
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    &PATIENT_NUM=3
    PATIENT_NUM 3
    PATIENT_NAME KKKK
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 4
    HMTLY_RBC_NORMAL 4.6-6.0
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     60
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    4 TABLES FOR CLINICAL LAB FOR INPUT DATA AND GET REPORT ONLY FOR TESTS MADE FOR PARTICULAR
    PATIENT.
    TABLE1:PATIENTS_MASTER1
    COLUMNS:PATIENT_NUM, PATIENT_NAME,
    VALUES:
    PATIENT_NUM
    1
    2
    3
    4
    PATIENT_NAME
    BBBB
    GGGG
    KKKK
    PPPP
    TABLE2:TESTS_MASTER1
    COLUMNS:TEST_NUM, TEST_NAME
    VALUES:
    TEST_NUM
    1
    2
    TEST_NAME
    HAEMATOLOGY
    DIFFERENTIAL LEUCOCYTE COUNT
    TABLE3:HAEMATOLOGY1
    COLUMNS:
    HMTLY_NUM,HMTLY_PATIENT_NUM,HMTLY_TEST_NAME,HMTLY_RBC_VALUE,HMTLY_RBC_NORMAL_VALUE     
    VALUES:
    HMTLY_NUM
    1
    2
    HMTLY_PATIENT_NUM
    1
    3
    MTLY_TEST_NAME
    HAEMATOLOGY
    HAEMATOLOGY
    HMTLY_RBC_VALUE
    5
    4
    HMTLY_RBC_NORMAL_VALUE
    4.6-6.0
    4.6-6.0
    TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
    COLUMNS:DLC_NUM,DLC_PATIENT_NUM,DLC_TEST_NAME,DLC_POLYMORPHS_VALUE,DLC_POLYMORPHS_
    NORMAL_VALUE,
    VALUES:
    DLC_NUM
    1
    2
    DLC_PATIENT_NUM
    2
    3
    DLC_TEST_NAME
    DIFFERENTIAL LEUCOCYTE COUNT
    DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE
    42
    60
    DLC_POLYMORPHS_NORMAL_VALUE
    40-65
    40-65
    THANKS
    RCS
    E-MAIL:[email protected]
    --------

    I think you want an OUTER JOIN
    SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
    HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
    DLC_POLYMORPHS_NORMAL_VALUE
    FROM PATIENTS_MASTER1, HAEMATOLOGY1,  DIFFERENTIAL_LEUCOCYTE_COUNT1
    WHERE PATIENT_NUM = HMTLY_PATIENT_NUM (+)
    AND PATIENT_NUM = DLC_PATIENT_NUM (+)
    AND PATIENT_NUM = &PATIENT_NUM;Edited by: shoblock on Nov 5, 2008 12:17 PM
    outer join marks became stupid emoticons or something. attempting to fix

  • Approval Query to skip for one Vendor Group - Not working

    Dear All,
    I am trying to create an approval query wherein when a user creates a Purchase Order for a Particular Vendor Group then the approval check is not required and for other Vendor Group approval check is required. The query is as under :
    SELECT distinct 'true'  FROM OPOR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE T2.GroupName <> 'Supplier Own Group'
    I don't want that which vendors are in Supplier Own Group check go for an approval process. Means all vendors in this group should get skipped for approval.
    How to achieve this because this query seems not to be working in the approval process because when a user creates a PO whose Vendor group is under Supplier Own Group then also the approval checking is happening.
    Please help how to resolve this issue.
    Regards,
    Depika

    Hi,
    Try this
    SELECT distinct 'true'  FROM OPOR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode
    AND T2.GroupName <> 'Supplier Own Group' where T0.CardCode = $[$4.1.0]
    Hope this helps,
    Son.

  • Approval Query when a Sales Return Document is Created.

    Hi all,
    When i post a Sale Return Document , the following Approval Query is not working when i try to work out for Approval of a New Sales Return document is Created.
    Select 'TRUE' From ORDN T0 Where T0.DocStatus='O' And Datediff(dd,T0.DocDate,Getdate())=0
    Is there any wrong with this Query?

    Just Opened the Recently Added Return Document with all the other window closed.
    Then, Tools -->Queries --> User Queries --> Approval Procedure (Category where my above sales return query is placed in the Query Manager) --> Sales Return (Return Query)
    When clicking on it...the query Generator window opens with TRUE as the result.
    But When adding the Return Document the REMARKS Window which always Opens for all the Approval Documents isn't Opening

  • Approval Query for AP Invoices Containing Budget Related GL Account

    Hi Experts,
    I would like to create a approval template for all AP invoices that include a GL account that is related to the budget. Can you please help me with the approval query?
    Thank you!
    Jane

    Hello Gordon Du,
    "B1 approval will only apply to document level. If you want to check line level, only the first line can be subjected to."
    I was thinking to trigger the approval process based on a document (AP invoice) containing relevant cost centres on a line by line basis as entered via one of the enabled dim fields.
    Writing a trigger query for each cost centre effected? This does not appear to be a good solution, what is a better direction. Is there another way? (PO are not yet used via SAPB1)
    Currently my invoices add, but do not trigger the approval process based on my attempts thus far.
    Can the originator manually choose an approval pathway?
    If this is against posting etiquette delete and advise.
    I am a relative newbie to SAP B1, so am happy to be pointed to relevant help files. I arrived via  google searching and arrived here.
    Thankyou.

  • Approval Tempate Terms Query Problem

    I have a query that i've included in the Approval Tempate - Terms Tab, that checks to see if any order lines after discount price is less than a Item UDF minimum price for the item. It is as follows:
    SELECT DISTINCT 'True'
    FROM  [dbo].[ORDR] T0 (nolock)
    INNER  JOIN [dbo].[RDR1] T1 (nolock) ON  T1.[DocEntry] = T0.[DocEntry]  
    inner  join [dbo].[OITM] T3 (nolock) on T3.ItemCode = t1.itemCode
    where T0.[DocNum] = $[ORDR.DocNum]
    and T1.INMPrice <= T3.U_LBSiMinPrice
    My problem is that the Approval is not kicking off no matter the outcome of the query. Meaning if the price is < the minimum price or > the minimum price, the approval pop-up window does not appear.

    Hi Scott,
    B1 does not support approval queries on document lines. you can query only document header.
    you can either try to workaround it with all sorts of aggregate UDFs in the header, or alternatively take a look at:
    [http://www.beonesolutions.com/ip/Solutions/ap.html|http://www.beonesolutions.com/ip/Solutions/ap.html]
    all details, including the ability to query all document tables, are in:
    [http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf|http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf]
    Gilan

  • Approval Query  for Sale Delivery Problem

    Hello,
    I have to set approval procedure of Sale Delivery in following condition
    If i add sale order for Specific item for 10 Qty for example C01 customer & after that i add sale order for same item qty 10 for another customer ie C02 & i have stock for that item 50 but user give delivery first to C02 in staid of C01 but C01 give me first order
    on this condition i have to set approval user can't deliver second sale order first he have to take approval from manager to do this & he deliver first order first then then don't have to need approval.
    Can any one help me?

    Hi,
    Row level approval is not possible in SBO.
    You may check this for your reference: http://www.beonesolutions.com/ip/Solutions/ap.html
    Thanks,
    Joseph

  • Approval Query for Receipt from production

    Hi experts,
    I want to define an approval process for receipt from production.
    The condition is below:
    Only if it is " Receipt from production" then the goods receipt document should go to approval of quality.
    If is any unplanned direct goods receipt then system should allow to add it straightly.
    To do so, Please provide me the required query.
    regards
    Ravindran Srinivasan

    Hi Ravindran,
    I once encounter same problem like this. And I found out that, unfortunately, approval procedure can't work on receipt from production document.
    Yes, we all know that receipt from production and inventory goods receipt are actually same object type in SAP B1 and stored in same table. But, try it by yourself in your testing database, even if you apply the approval templates for goods receipt document, and you apply the condition as "always", you won't get prompted for approval if you try to add the receipt from production document.
    However, I said this based on my experience with version prior to 8.81 and 8.82. But somehow I have a strong feeling that this issue still not yet realized by SAP.
    Best Regards,
    Hendry Wijaya

  • Create a user defined approval query

    anybody can help me whitch syntax i have to use to create a user defined query for an approval template please?
    for Exp: i want to create a query to check if a the customer in an invoice ="C0001"
    so select distinct 'true' where ????(current invoice customercode)="C0001"
    10x

    Hi.......
    Try This......
    Select Distinct 'True' From OCRD T0 where T0.CardCode='C0001' and T0.CardCode=$[OINV.CardCode.0]
    Hope this will solve the problem......
    Reagards,
    Rahul

  • Reg: Query Problem for New Posting Period

    Hi Xperts,
    While I try to Map the A/P Invoices with their respective Outgoing Payment,
    I used the following Query and it's Query Printlayout
    SELECT T0.DocNum [Payment#], T0.DocDate [Payment Date],
    T0.CardCode, T0.CardName, T1.InvoiceId, T2.DocNum [AP Inv#],
    T2.NumatCard [Bill No.], T2.DocDate [Bill Date], T1.selfInv,
    T1.SumApplied, T1.WtAppld, T0.NoDocsum 
    FROM  [dbo].[OVPM] T0  INNER  JOIN
    [dbo].[VPM2] T1  ON  T1.[DocNum] = T0.DocNum
    INNER  JOIN [dbo].[OPCH] T2  ON  T2.[DocEntry] = T1.DocEntry
    WHERE T0.Cardname='[%0]' and T0.DocDate='[%1]' and
    T0.DocNum='[%2]'
    I got the above query from our Expert Mr.Sambath only.
    Now what is the problem is the query is retrieving the payment details of old Posting Period only and not the current posting period.
    In detail, I used 'Primary' Series for FY08-09, Period indicator 'Default'
    Now I'm using 'Primary1' Series for FY09-10, Period indicator '0910'
    Thanx in adv.
    Regards,
    Bala

    Hi Bala,
    Looking at your query, it is not query issue ,it is your data issue.
    Please check if you have data in  VPM2  table  which is bank transfer payment method
    Thank you
    Bishal
    Edited by: Bishal Adhikari on Apr 9, 2009 8:48 AM

  • VIEW Query Problem

    Hi Greg,
    I had created a view on a table which doesn't have Primary Key, but it has Unique and Not Null constraints on required columns.
    I had wrote a procedure to query the data on VIEW. I have experienced strange problem, very first call to procedure will take more time than succeeding requests. For example from second request onwards, it returns data in < 2 Sec, but first transaction is taking 12 Sec to 30 Sec.
    I thought that very first time VIEW is taking time to refresh it self. So, I added FORCE keyword in CREATE VIEW stattement. However, that doesn't helped out.
    In my further investigation I came to know that base table on which VIEW created, has to be loaded in to memory before querying on VIEW.
    So, I had executed a simple select statement on base table, before I execute VIEW query in procedure.
    With this change I got results consistently < 2 Sec all the times.
    My question is instead of executing the select statement on base table is there a way to load base tables data in memory before querying on VIEW?
    Thanks,
    Subbarao

    Hi,
    A view is nothing but parsed SQL statements stored in the database, a view may or may not run faster. If you execute the SQL used to define the view how much time is it taking. If you want try looking at MATERIALIZED VIEW , that may help you.
    thanks

Maybe you are looking for

  • WBS element for collective order

    Hello All, I have a production order with 5 subordinate production orders . For the order header there is a WBS element assigned . But for the subordinate orders, WBS should be the same as that of order header WBS. My problem here is , PO is created

  • Are movie ratings available for smart playlists

    I'm trying to make a playlist of movies by rating (not personal stars but G PG PG-13 etc...) I can't seem to find a column to filter on. Where is this meta data available?

  • EXCH2013: How to leave messages at ISP server?

    Using Exchange 2013 SP1 and it serves both roles. It is not in deployment yet as we are still testing. Currently we have a problem trying to receive mail (have not been able to since testing started) and we got to thinking we need a contingency plan

  • Where do i get an adobe reader software? I keep gettig a message to install this

    I keep getting messages I need to install adobe reader . In I tune store I cant find it ?

  • Check syntax of an SQL statement

    Hi everybody, I am wondering if there is a way to do an syntax check of a statement? Let's say I have an huge update statement with a lot of cases and so on. Now I could run a DML statement and if it is ok I won't get an error and do a rollback, but