Query for Alert - Document saved as Draft

Hi,
I have no idea how a query is written to activate the alert. My requirement is in 2005B PL 27. I have give an alert to a particular user when a GRPO is saved as Draft. Is that possible? If yes, what is the query that does the same?
Regards
Sudatt

Sorry Object Code for GRPO is 20,It is corrected in query.
SELECT T0.DocEntry,T0.DocDate,T0.CardName, T0.DocTotal FROM ODRF T0
WHERE DateDiff(dd, T0.DocDate,GETDATE()) = 0 AND T0.ObjType = 20
Edited by: Jeyakanthan A on May 26, 2009 12:41 PM

Similar Messages

  • Query for Alert

    Hi,
    Wondering if someone could please help me out with query required for Alert.
    Alert to notify user of any Sales Order entry added for items belonging to Item group code "171".
    The resulted Alert needs to give the alerted user the ability to drill down into listed orders.
    I appreaciate any help given.
    thks
    Kelly

    Hi,Guys
    Generally, you can use the SP named by SBO_SP_TransactionNotification,
    for example
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO
    ALTER  proc SBO_SP_TransactionNotification
    @object_type nvarchar(25),                     -- SBO Object Type
    @transaction_type nchar(1),               -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
    @num_of_cols_in_key int,
    @list_of_key_cols_tab_del nvarchar(255),
    @list_of_cols_val_tab_del nvarchar(255)
    AS
    begin
    -- Return values
    declare @error  int                    -- Result (0 for no error)
    declare @error_message nvarchar (200)           -- Error string to be displayed
    select @error = 0
    select @error_message = N'Ok'
    --     ADD     YOUR     CODE     HERE
    declare @bbb nvarchar(200)
    declare @aaa int
    if  @object_type='17'--sale order
    begin
        if ((@transaction_type='A') or   ( @transaction_type='U'))
        begin
         select @aaa=count(itemcode) from rdr1 where docentry =@list_of_cols_val_tab_del and itemcode not  in (select itemcode from oitm where itmsgrpcod = '171')
          if @aaa>0
          begin
          set @error=1
          set @error_message='Item group should belong in  171'
          end
        end
    end
    select @error, @error_message
    end
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO
    also you can use some approval procedures.
    Please try it
    Best regards
    Eric Wang

  • Query for Alert on production order to be released

    Dear all users and experts,
    I need a query for getting an alert on production orders to be released (from planned status to release status) by whether reading the release date of production orders created from 'order recommendation window' or by reading the due date of production order and substract the lead time(days) of the item from its due date or by any means you know best.
    Thanks and best regards,
    Farhan Sufi

    Hi Gordon and Joseph,
    Thanks to both of you for giving me queries.
    Gordon, I made 3 production orders for testing from MRP order recommendation window from which 2 production orders has release date of today 9th July, 2010 (due date 12th July monday) and the 3rd one has release date of after weekend i.e. 12th July 2010 (due date is 13th July). release dates are calculated by MRP acording to the items' lead time and due date.
    Gordon, when I applied your query It gave me msg 'no data was found as a result of this selection criteria' Can you explain what your query will give me in result?
    where as Joseph, when I applied your query on alert, it gave me all 3 production orders as an alert to be released. I was expecting it will give me alert for 2 production order for today as their release date in MRP is today(9th July, 2010) and the alert for 3rd production order should come on 12th July and not today.
    what I understood your query is displaying all production orders which have status 'planned' regardless of their release date.is it?
    Joseph can you edit this query in such a way that It should consider the release date (calculated from due date and lead time in MRP order recommendation window) and display only those production orders which should be released today and exclude those which have release date in future. so that I can get alert for only those production orders which should be released today.
    I hope good response from both of you
    Thanks and best regards,
    Farhan

  • Rewrite draft document batch query for live document

    Hello Experts,
    I have written a query that returns data from DRAFT A/P Credit Memos.  It returns all line items and includes all linked batch numbers if any.
    I want to run the same query against A/P Credit memos once the document is 'added'.  Here's the current query...
    select odrf.docentry, DRF1.itemcode, DRF1.dscription, odrf.cardcode, obtn.distnumber, odrf.Docdate as 'Date Opened'
    from odrf
    join DRF1 on odrf.docentry = DRF1.docentry
    left join DRF16 on DRF1.docentry = DRF16.absentry AND DRF1.linenum = drf16.linenum
    left join obtn on DRF16.objabs = obtn.absentry
    where DRF1.dscription IS NOT NULL
    AND odrf.objtype = 19
    I'm having a difficult time translating this logic over to live documents.  It seems there is no equivalent table to DRF16 on live documents? 

    Yes I tried that.  However my RPC16 table is empty.  Which is odd because you would think after adding a draft document into a live document the data from DRF16 would show up in RPC16.  This appears to be the case for DRF1 to RPC1 tables at least...

  • Error for Billing Document- saved(Error in account determination)

    Dear all,
    When i am trying to creat the billing document , it is saving with error in account  .
    Can any body tell me the reason for this error.Actually i have maintained the required GL accounts in VKOA.
    9011000024 000000 Document 9011000024 saved (error in account determination)
        Technical data
        Tech. data details
         Client
         Group Number
         Sales Document Number                  9011000024
         Item Number of the SD Document      000000
         Schedule Line Number                      0051
         Counter in Control Tables                  00
         Message Identification                      VF
         System Message Number                 051
         Output Type                                     E
         Message Variable 01                    9011000024
         Message Variable 02
         Message Variable 03
         Message Variable 04
         Group Type
    Thanks In Advance
    Parag

    Hi
    Put the billing doc in change mode and then enter
    From the top menu bar-environment-account determination analysis---revenue account determination
    If you explore that system will give some hint of what is missing?
    Check in CMR whether account assignment category is mainatained in Billing tab of sales area data
    Check in MMR whether account assignment category is mainatained in sales org data2 tab
    Ensure that VKOA settings are correct?
    Then go VF02 and click on the green flag in the initial screen or shift+F4
    All the best
    Regards
    raja

  • Creating a conditional query for alert

    Hope someone can help with this, I am trying get an SQL query to work in an alert that returns a sales quotation number based on UDF's in the record. The basic query is:
    SELECT     DocNum, CardCode, CardName
    FROM         OQUT
    WHERE     (U_PLApr = 'I') AND (CANCELED = 'N') AND (DocStatus = 'O')
    AND
    IF (U_CableCk = 'Y') AND (U_CAApr = 'C') AND
    IF (U_Electrical = 'Y') AND (U_ELApr = 'C') AND so on...
    In this example, if U_cableck = 'N' I want to ignore that part, and check U_Electricalck = 'Y' and U_elapr='C'.
    To put it more simply, if the first condition is Y, then check to see if the second is 'C'. If all cases are true, then return the data fields.
    There are about 8 conditions within the OQUT record like this. I could write a large number of selects with AND and OR statements to cover all possible combinations, but am looking for a better way.
    I have tried writing case statements into my query, but nothing is working.
    Any help is much appreciated

    Suda, tried the query this way:
    SELECT docnum, CardCode, Cardname from OQUT where  U_PLApr = 'I'  and canceled = 'N' and docstatus = 'O'  and ((U_cableck = 'Y') and (U_CAApr = 'C')) and ((U_electricalck='Y') and (U_ELApr='C'))
    If U_cableck <> Y, or U_electricalck <> Y, the query returns no results, when it should show results. Only when all the vales are Y and C does the query give results. Which is not always the case.
    The possible data here is:
    U_Cableck    U_CAApr     U_Electrical      U_ELApr        Should have Result
    Y                      C                   Y                     C             Yes
    Y                      I                     Y                     I               No
    Y                      C                   N                     I              Yes
    Y                      I                     N                     I               No
    N                      I                     Y                     C             Yes
    N                      I                     Y                     I               No
    N                      I                     N                     I               No
    Y and N represent Yes and No - whether or not the user needs to approve
    C and I represent Complete and Incomplete - the user changes incomplete to complete if they are Yes in the first UDF.
    Hope this helps it make sense, may not be possble to test the data this way. Thanks

  • Query for Purchase Document

    Hello
    I am doing a Query. I need to add this field with the complete name of the person who did a Purchase document order.
    I found this field with this information througt transacction SU01.
    Full Name of Person
    ADDR3_DATA
    NAME_TEXT
    That field contains the information that I need. But the problem is, this table in not allowed to be used as a join table.
    I have been looking with the tables conected to this field but they do not load the data that I need.
    If someone know something about it,

    Irma, como estás?
                                  Probá con la tabla USER_ADDR o la USR03.
    Saludos

  • How to Search for Collab Documents from Specific Collab Projects

    I am looking for some sample code that will use the portal Remote Search API to query for documents in Collaboration Server Only.
    I have a specific group of projects that I need to query. I can gather these in an Array --> IProjects[].
    The Collaboration Server Search portlet appears to have this capability already but I have to do it in a custom portlet.
    Thanks in advance.
    Phil Orion
    Orion like the constellation, not the Irish guy..

    Bump- Any takers --on this question?
    How about does anyone have any sample code to simply query for collab documents...
    Edited by: PhilOrion on Jul 3, 2010 5:28 PM

  • Alert message(Query) for a Production order?

    Hi Experts,
    I want to get an alert message for the production order doucument based on the due date of it. The user must get the alert a  one day before the duedate of the document. How to write the Query for it? Urgent ,waiting for earliest reply.
    Regards ,
    Magesh.

    Create a Formatted Seach with the following Query
    SELECT T0.DocNum AS 'Document Number', T0.CreateDate AS 'Creation Date', T0.DueDate AS 'Due Date'
    FROM  [dbo].[OWOR] T0  WHERE DATEDIFF(Day,GetDate(),T0.DueDate) = 1
    Then, Create an Alert from Adminis..> Alerts Management and Give a Name, Click Open Saved Query, Select the query you saved, Tick the Int. check box against the user who gets the Alert.  Check Active. Select Frequency.
    Good luck
    Suda

  • Saving a document as a draft automatically

    Hi
    It is required in our system that a credit note needs to be authorised using our own method before it can be added. A check is carried out when the user clicks on the Add button on the credit note and if it has not been approved they are currently asked to save it as a draft. What is the best method to automate this process so that the user doesn't have to manually go to File and then click on Save as Draft.
    Also another requirement is that when the document is saved as a draft it needs to also write to a User Defined Table, which is used to log all changes to the draft. The problem I currently have with this is getting a unique key into the table to relate to the draft such as the DocEntry, however I am not sure how to catch the DocEntry of the draft credit note as it is being saved as a draft. Does anyone know how this can be done?
    I guess I could use a UDF that gets populated with a unique value and then once the draft has been added run a query searching the drafts for this number and then get the DocEntry from this but this seems a little messy.
    Thanks
    Steve

    Hi Steve,
    For writing to the UDT when the draft is created, you can put a SQL statement in the SBO_SP_TransactionNotification stored procedure to trap the event of the draft being created and insert the DocEntry in to your UDT (note: writing directly to non-object UDTs is allowed but writing to UDFs on system tables or to UDOs isn't).
    if @object_type = '112' and @transaction_type = 'A' -- Draft being added
         begin
              -- Check to see if the draft being added is a credit note
              if exists(select * from ODRF where ObjType = 14 and DocEntry = cast(@list_of_cols_val_tab_del as int))
                   begin
                        -- Insert record in to UDT here
                        insert into [@MYTABLE] values (......)
                   end
         end
    You could use a similar method to trap changes made to the draft (ie where @transaction_type = 'U') and write information to your log table.
    How does your approval/authorisation method work? I was thinking that you could set up a standard SBO approval for credit notes based on a UDF that had Y/N valid values. If your authorisation check ran before the document was added then you could set this UDF to N and the SBO approval procedure would then get triggered and save the document as a draft.
    Kind Regards,
    Owen

  • Query Through Alerts Managments For Due AMount

    Dear All
    Hoew to create Query through Alerts Managments for due amount after completion of Due date of AR Invoice
    Edited by: tjoshi1982 on Aug 26, 2010 2:16 PM

    Dear tjoshi1982,
    May I ask you why you need this query?
    In SAP Business One there is the opportunity to use the Dunning Wizard. If the information regarding the dunning information for every customer are set, when the Dunning Wizard runs it will tell inform which customer is late and which document s/he has not paid yet.
    Please, let me know if this alternative is interesting for you and if not, please let me know why you need this query.
    Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • Query for an ALERT to give items that haven't sold in 60 days

    To the Experts.
    Can someone help me with a query for an ALERT. I need items that haven't sold in the last 60 days?

    Try this query.
    select max(t1.docdate) as [Last Inv Date], t0.itemcode, t0.dscription
    from inv1 t0 inner join oinv t1 on t0.docentry = t1.docentry
    where t1.doctype = 'I'
    group by t0.itemcode, t0.dscription
    having max(t1.docdate) <= getdate() - 60
    order by t0.itemcode
    The value getdate() is today, so getdate() - 60 will move the filter date back 60 days.  This looks at A/R Invoices and only Items type documents.
    I hope this helps.
    Ross Unger - Third Wave Business Systems

  • FMS Query for Document Header UDF

    Hi,
    I have created an UDF in the header level of Marketing Document. I want to add FMS on it. UDF Value will be 4% of DocTotal Value and auto Refresh on DocTotal.
    What will be the query for Sales Order.

    I am saving this query
    Select ($[$29.0.number]) * 0.04
    and setting this query in the udf by.
    now when i am creating an order and pressing shift+f2 on it it's giving an error msg : internal error(3006) occured.
    Edited by: Sibasish Sengupta on Dec 8, 2008 1:11 PM

  • SCCM QUERY or VB SCRIPT to find Free Diskspace/ No of documents saved/last logon details (who and when)

    Can we please get a report showing all company laptops and the following information
    1. Disk space in use/Free and number of files/documents saved (doesn't matter if its Word or PDF, just give me the numbers)
    2. Whether they have any PST files stored on them
    3. The last login details (who and when)<o:p></o:p>
    I don't mind if its a VBscript or .batch file (but that should also extract the result in excel file) or i have SCCM 2012 server in place, and i can
    utilize this to get the result via querying.
    <o:p>I am Fairly new to SCCM2012 so please be nice if i ask any silly questions.</o:p>
    Thanks in advance,<o:p></o:p>

    1a: Disk space in use/Free: there are some default reports on your ConfigMgr 2012 site in the folder "Hardware - Disk"; those may be what you want.
    1b: number of files/documents saved: by default out of the box (unless you've changed it), "file inventory", also known as software inventory, is not enabled. This is for various technical and practical reasons.  However, if for your specific
    company you are required to scan for *.doc, *.xls, *.docx, *.xlsx, *.pdf, etc--you can certainly enable that feature.  Once enabled, you will be able to create custom reports to "count" the number of files on each computer.
    2: similar to 1b above, you could enable scanning for files which happen to be named *.pst.  This link is more advanced; but it's a more granular way of detecting who is using pst files, and where they are--whether or not they are local-->
    http://www.mnscug.org/blogs/sherry-kissinger/249-pstfinder
    3: "last login details who and when"--that is "sort of" recorded and available.  But I want to be cautious about telling you that it's available--because really it's your Active Directory domain controllers that *really* know when
    a username last logged in.  Remember, ConfigMgr is NOT meant to be an up-to-the-second reporting mechanism.  The reason last login details are recorded from a configMgr point of view is simply to assist in determining who the primary user of a machine
    is.  It's not, and is never meant to be, to help you see the exact time Bob logged into ComputerX.  It's more so that over weeks, the ConfigMgr Client can determine "hey, Bob is the one with the most console minutes on ComputerX, he's probably
    the primary user of ComputerX".
    Standardize. Simplify. Automate.

  • Script for Save Options- Save Query Results with document

    Hi,
    Is there any javascript for Save query results with document in save options? If so where can i find that?
    Thanks
    Kalai

    hi guys,
    I found the answer.The following example shows you how to save the results with the query
    section named “SalesQuery”.
    ActiveDocument.Sections["SalesQuery"].SaveResults=true

Maybe you are looking for