Query for Group by & order by

Hi all,
I have a table name as angdata77 having attributes like asigno..
i want to retrieve data from angdata77 by using both group by & order by clauses.. for total count..
am using the query as
select asigno,count(*) from angdata77 group by asigno order by asigno;
Is there any other query for retrieving the data from angdata77
Thanks in Advance,
Venkatesh J.

885756 wrote:
Ya it's good.. Performance also good while retrieving data...
I want to know other Possibilities also sir...There will be no better alternative for this, because this is the most simple and straight forward way to get the output you are looking for..
Go ahead without any confusion... :)

Similar Messages

  • 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

  • How to write a query for grouping them the columns and give the sequence order to each group/

    Hi i have table that contains country columns .
    India,USA,UK like these when ever the group changed into the differt country i make a group and arrange them the sequence into those Countries
    like below
    1)India
    2)India
    1)USA
    2)USA
    like these to write a query ..........pls help me for this query

    Assuming you're using SQL Server you can ask here:
    http://www.sqlteam.com/forums/forum.asp?FORUM_ID=23
    Otherwise, please ask in the relevant forum for the type of technology you're using.
    Basically it's either:
    select *
    from [table name]
    order by country
    If you want to do something with groups do something like:
    select (max) income, country
    from [table name]
    group by country
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Query for a customer order backlog

    Hi,
    I'm looking for a sql query (customer order backlog) that list all open article from open orders and not complete supllies which are to be deliver. Who can help?
    Regards,
    Michael

    Hi Michael,
    SBO has its own report called 'Open Items List' that can be found under sales reports. This can be used to list out all open sales orders.
    Alternatively, you could write a query, filtering on the OpenQty field in the RDR1 table to tell you which rows were still open and awaiting delivery. Something like:
    select
         T1.DocNum,
         T1.CardCode,
         T1.CardName,
         T1.DocDate,
         T0.ItemCode,
         T0.OpenQty
    from
         RDR1 T0
         inner join ORDR T1 on T0.DocEntry = T1.DocEntry
    where
         T0.OpenQty > 0
    order by
         T1.DocNum
    Kind Regards,
    Owen

  • Querying for group/distribution list

    Hello,
    Currently we are trying to query the distribution or groups list from the GWWS, but the only thing we get is a huge list of users, which are from all groups.
    We are using this filter:
    Code:
    <getItemsRequest>
    <container>GroupWiseSystemAddressBook@52</container>
    <view>default members</view>
    <filter>
    <elements>
    <op>and</op>
    <element>
    <op>eq</op>
    <field>@type</field>
    <value>Group</value>
    </element>
    <element>
    <op>eq</op>
    <field>name</field>
    <value>Developers</value>
    </element>
    </elements>
    </filter>
    </getItemsRequest>
    Is there someone who can provide us with the right filter ?
    Thanks in advance,
    Eamon Woortman
    Developer at Maintainet AG

    Thanks for your response.
    We got it working using this filter:
    Code:
    <getItemsRequest>
    <container>GroupWiseSystemAddressBook@52</container>
    <view>default members</view>
    <filter>
    <elements>
    <op>and</op>
    <element type="FilterEntry">
    <op>eq</op>
    <field>@type</field>
    <value>Group</value>
    </element>
    <element type="FilterEntry">
    <op>eq</op>
    <field>username</field>
    <value>Developers</value>
    </element>
    </elements>
    </filter>
    </getItemsRequest>

  • Select query for grouping

    I need to create email and send it with all channels together the users are subscribed to,
    This is my source table:
    CREATE TABLE [dbo].[test_email]([email] [varchar](50) NOT NULL,[channel_id] [int] NOT NULL,CONSTRAINT [PK_test_email] PRIMARY KEY CLUSTERED ([email],[channel_id]))
    INSERT INTO test_email(email, channel_id)
    VALUES('[email protected]', 2), ('[email protected]', 15),
    ('[email protected]', 2),
    ('[email protected]', 2), ('[email protected]', 15), ('[email protected]', 19),
    ('[email protected]', 2), ('[email protected]', 15)
    For channel_id=2, there is only user with email: '[email protected]'
    For channel_id in(2,15) there are 2 users: '[email protected]' and '[email protected]'.
    For channel_id in(2,15,19) there is user with email:'[email protected]'
    And so on...
    The result should be(groupID is just for sake of clarity):
    groupID   emails                                                          channel_id        
    1              [email protected], [email protected]                 2
    1              [email protected], [email protected]                 15
    2              [email protected]                                              2
    3              [email protected]                                              2
    3              [email protected]                                              15
    3              [email protected]                                              19
    Emails column could have up to 50 emails. Maybe I should create some groupID table and move emails to separate table.

    The idea with power is cute, but is restricted to 63 channels. Here is a conventional solution, feature the good ol' Numbers table.
    CREATE TABLE [dbo].[test_email]([email] [varchar](50) NOT NULL,[channel_id] [int] NOT NULL,CONSTRAINT [PK_test_email] PRIMARY KEY CLUSTERED ([email],[channel_id]))
    INSERT INTO test_email(email, channel_id)
       VALUES('[email protected]', 2), ('[email protected]', 15),
       ('[email protected]', 2),
       ('[email protected]', 2), ('[email protected]', 15), ('[email protected]', 19),
       ('[email protected]', 2), ('[email protected]', 15)
    go
    CREATE TABLE #channels(email    varchar(50),
                           channels varchar(900) NOT NULL,
                           group_id int NOT NULL)
    INSERT #channels(email, channels, group_id)
       SELECT e.email, e2.channels, group_id = dense_rank() OVER (ORDER BY e2.channels)
       FROM   (SELECT DISTINCT email FROM test_email) AS e
       CROSS  APPLY (SELECT str(e2.channel_id)
                     FROM   test_email e2
                     WHERE  e.email = e2.email
                     ORDER  BY e2.channel_id
                     FOR XML PATH('')) AS e2 (channels)
    SELECT t1.group_id, substring(t2.emails, 1, len(t2.emails) - 1),
           convert(int, substring(t1.channels, (N.Number - 1) * 10 + 1, 10))
    FROM   (SELECT DISTINCT group_id, channels FROM #channels) AS t1
    CROSS  APPLY (SELECT t2.email + ','
                  FROM   #channels t2
                  WHERE  t1.group_id = t2.group_id
                  ORDER  BY t2.email
                  FOR XML PATH('')) AS t2(emails)
    JOIN   Numbers N ON N.Number BETWEEN 1 AND datalength(t1.channels) / 10
    go
    DROP TABLE test_email
    DROP TABLE #channels
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Need a query for grouping

    Hi,
    I have some data and need to group it based on date. please see the below data
    pkey--------from_date----------to_date------------amount-------------
    1 ---------8-aug-12 ----------31-aug-12---------120
    1 ---------31-aug-12 --------1-sep-12--------- 130
    1 ---------1-sep-12 ----------2-sep-12--------- 150
    1 ---------3-sep-12 ----------4-sep-12--------- 150
    1 ---------5-sep-12 ----------7-sep-12--------- 100
    1 ---------7-sep-12 ----------8-sep-12--------- 200
    1 ---------8-sep-12 ----------20-sep-12---------120
    1 ---------20-sep-12 --------1-oct-12--------- 130
    1 ---------1-oct-12 ----------8-oct-12--------- 150
    and so on.....
    I need to group the data when a month finished.. e.g row 1 from_date is 08-aug-12 row 6 to_date is 08-sep-12 means almost 1 month finished so it should group and show the sum of amount with min(from_date) and max(to_Date) and total amount monhtly basis.
    I am trying to make a query since many hours but no success.. the data is huge with many keys and dates ... please share your idea/tips/feedback.
    Thanks
    Edited by: hard_stone on Jan 18, 2013 11:38 AM

    Try this
    with t
    as
    select 1 pkey, to_date('08-aug-12', 'dd-mon-rr') from_date, to_date('31-aug-12', 'dd-mon-rr') to_date, 120 amount from dual
    union all
    select 2 pkey, to_date('31-aug-12', 'dd-mon-rr') from_date, to_date('01-sep-12', 'dd-mon-rr') to_date, 130 amount from dual
    union all
    select 3 pkey, to_date('01-sep-12', 'dd-mon-rr') from_date, to_date('02-sep-12', 'dd-mon-rr') to_date, 150 amount from dual
    union all
    select 4 pkey, to_date('03-sep-12', 'dd-mon-rr') from_date, to_date('04-sep-12', 'dd-mon-rr') to_date, 150 amount from dual
    union all
    select 5 pkey, to_date('05-sep-12', 'dd-mon-rr') from_date, to_date('07-sep-12', 'dd-mon-rr') to_date, 100 amount from dual
    union all
    select 6 pkey, to_date('07-sep-12', 'dd-mon-rr') from_date, to_date('08-sep-12', 'dd-mon-rr') to_date, 200 amount from dual
    union all
    select 7 pkey, to_date('08-sep-12', 'dd-mon-rr') from_date, to_date('20-sep-12', 'dd-mon-rr') to_date, 120 amount from dual
    union all
    select 8 pkey, to_date('20-sep-12', 'dd-mon-rr') from_date, to_date('01-oct-12', 'dd-mon-rr') to_date, 130 amount from dual
    union all
    select 9 pkey, to_date('01-oct-12', 'dd-mon-rr') from_date, to_date('08-oct-12', 'dd-mon-rr') to_date, 150 amount from dual
    select min(from_date) from_date, max(to_date) to_date, sum(amount) amount
      from (
            select pkey, from_date, to_date, amount, next_month
              from t
             model
             dimension by (pkey)
             measures (from_date, to_date, amount, to_date('19000101', 'yyyymmdd') next_month, add_months(from_date, 1) temp_month)
             rules upsert
               next_month[any] = case when next_month[cv(pkey)-1] >= to_date[cv(pkey)] then next_month[cv(pkey)-1]
                                      else temp_month[cv(pkey)] end
    group by next_month;
    FROM_DATE TO_DATE   AMOUNT
    08-AUG-12 08-SEP-12    850
    08-SEP-12 08-OCT-12    400

  • Wmi query for group policy deployed software version

    I am trying to query the version of a deployed application within a GPO from active directory using wmi.
    Anyone know if this is possible?
    Thanks.

    I don't think you can query GPO information using WMI, but you can use WMI to read Resultant Set of Policy settings. See
    RSoP WMI Classes for more information.
    Is there any particular reason for using WMI in your case? You can easily retrieve this information using powerShell. The code below will list name and ver of all software install entries of a particular GPO:
    $gpo = get-gpo -Name "My GPO Name"
    $report = [xml] $gpo.GenerateReport([Microsoft.GroupPolicy.ReportType]::Xml)
    $report.gpo.Computer.ExtensionData.Extension | `
    Where-Object{ $_.type.contains( "SoftwareInstall" ) } | `
    foreach-object{
    foreach( $item in $_.ChildNodes )
    "`"{0}`" Ver. {1}.{2}" -F $item.name, $item.MajorVersion, $item.MinorVersion
    Gleb.

  • Sqlserver query using Group by and Order by

    SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
    MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
    MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
    AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
    MIN(BILL_DETAIL.x_cost_rate) as COST_RATE,
    MIN(BILL_DETAIL.x_cost_total) as COST_TYPE,
    LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
    FROM table_x_gsa_bill_detail BILL_DETAIL
    WHERE (1=1)
    GROUP BY (DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS || ',' || COST_TYPE || ',' || BILL_RATE)
    ORDER BY DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS ||
    ) dt WHERE rn BETWEEN 0 AND 1
    Can any one pls help me using of Case Condition keyword instead of Decode in the above query ??? iam not able to convert above query for group by and order by..
    Actually i need to do group by the aggragate values which i got the values from the fields of BILLABLE_YN,BILLABLE_TO,DETAIL_CLASS, COST_TYPE, BILL_RATE.
    where as in oracle i can run above query using decode keyword where as in sqlserver iam not able to use BILLABLE_YN field alias of above query in group by .
    i tried like by using following way but it is wrong because here iam not using aggragate values of fields in group by funtion please help me in converting query in sqlserver. GROUP BY (case BILLABLE_YN when 1 then 'Billable' when 0 then 'Non-Billable' else
    'Non-Billable' End BILLABLE_YN + ',' + BILLABLE_TO + ',' + DETAIL_CLASS + ',' + COST_TYPE + ',' + BILL_RATE)
    Krishna

    CREATE TABLE DETAIL
    ([objid] int,[x_billable_to] varchar(19), [x_bill_quantity] int,
    [x_billable_yn] int, [x_bill_rate] int, [COST_TYPE] varchar(19) )
    INSERT INTO
    DETAIL
    ([objid], [x_billable_to], [x_bill_quantity], [x_billable_yn], [x_bill_rate],[COST_TYPE])
    VALUES
    (1, 'Customer', 3, 1, 20,'Parking'),
    (2, 'Customer', 1, 1, 25,'Toll'),
    (3, 'Customer', 2, 1, 20,'Parking') 
    Pls convert following query for executing query in sqlserver  ..for the column ID_List it should return data like 1,2,3
    SELECT * FROM (SELECT 1 rn,
            SUM(BILL_DETAIL.x_bill_quantity)      as BILL_QUANTITY,
            MIN(BILL_DETAIL.x_billable_to)        as BILLABLE_TO,
            MIN(BILL_DETAIL.x_billable_yn)        as BILLABLE_YN,
            AVG(BILL_DETAIL.x_bill_rate)          as BILL_RATE,
            LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
         FROM   BILL_DETAIL
          WHERE (1=1)
     GROUP BY (DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to  +  ',' + COST_TYPE + ',' + x_bill_rate)
          ORDER BY DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to  +  ',' + COST_TYPE + ',' + x_bill_rate
           )dt 
    WHERE rn BETWEEN 0 AND 1
    Krishna
    sounds like this
    SELECT *
    FROM
    SELECT 1 rn,
    SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
    MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
    MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
    AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1) AS ID_Listing
    FROM BILL_DETAIL bd
    CROSS APPLY (
    SELECT BILL_DETAIL.objid + ',' AS [text()]
    FROM BILL_DETAIL
    WHERE objid = bd.objid
    FOR XML PATH('')
    )bd1(ID_LIST)
    WHERE (1=1)
    GROUP BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
    ORDER BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
    )dt
    WHERE rn BETWEEN 0 AND 1
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Query for Sales order and corr.AR Invoice Info

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT
    ORDER_NUMBER
    CUSTOMER_NUM
    CUSTOMER_NAME
    ORDERED_DATE
    FLOW_STATUS_CODE
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    There are some issues that must be defined before you have the exact query.
    Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
    Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
    Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
    Hope it helps,
    Ketter Ohnes
    create or replace view order_summary as
    select oh.org_id,
    oh.ORDER_NUMBER,
    oh.header_id,
    ott.name tt_name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code,
    sum(ol.ordered_quantity*ol.unit_selling_price) total,
    sum(ol.tax_value) tax,
    (select sum(operand)
    from OE_PRICE_ADJUSTMENTS_v x
    where x.header_id = oh.header_id
    and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
    from oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts ca,
    hz_parties p,
    oe_transaction_types_tl ott
    where ol.header_id=oh.header_id
    and oh.sold_to_org_id = ca.cust_account_id
    and ca.party_id = p.party_id
    and oh.order_type_id = ott.transaction_type_id
    and ott.language =
    (select language_code
    from fnd_languages
    where installed_flag = 'B')
    group by oh.org_id,
    oh.header_id,
    oh.ORDER_NUMBER ,
    ott.name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code;
    create or replace view invoice_summary as
    select a.interface_header_context,
    a.trx_date,
    a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2 tt_name,
    a.customer_trx_id,
    sum(b.extended_amount) invoice_total
    from ra_customer_trx_all a,
    ra_customer_trx_lines_all b
    where a.customer_trx_id = b.customer_trx_id
    and b.interface_line_context = 'ORDER ENTRY'
    and b.line_type in ('LINE','FREIGHT')
    group by a.interface_header_context,
    a.trx_date, a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2,
    a.customer_trx_id;
    select *
    from order_summary o,
    invoice_summary i
    where o.order_number between :1 and :2
    and o.order_number = i.interface_line_attribute1
    and o.tt_name = i.tt_name;

  • Query for Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
    where U_Total_GP is a UDF for storing the GP of each order.
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
    Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
    Thank you
    Regards
    Elton

    Hi Elton,
    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    ORDER BY T0.[DocNum]
    Thanks,
    Gordon

  • Group by order by in same query

    Hi,
    I am wondering whether it is possible to use group by and order by in same query
    For example if i have a table like the one below
    Col1 Col2 col3
    C 36 2
    A 25 5
    B 12 8
    A 25 6
    B 12 9
    C 36 1
    A 25 7
    I need a result like below
    A 25 5
    A 25 6
    A 25 7
    B 12 8
    B 12 9
    C 36 1
    C 36 2
    can the select statement with group by and order by solve this? How?

    Yes you can - though I am not sure that it is what you want. In your example you do not need to group the data, you just need to order by the first column, then the third. If required, you could also throw in the second column;
    SQL> with t as  ( 
       select 'C' col1, 36 col2, 2 col3 from dual union all 
       select 'A', 25 ,5 from dual union all 
       select 'B', 12 ,8 from dual union all 
       select 'A', 25 ,6 from dual union all 
       select 'B', 12 ,9 from dual union all 
       select 'C', 36 ,1 from dual union all   
       select 'A', 25 ,7 from dual)  
    select col1,col2,col3  
    from t
    order by col1,col3
    COL1       COL2       COL3
    A            25          5
    A            25          6
    A            25          7
    B            12          8
    B            12          9
    C            36          1
    C            36          2

  • SQL Query for members of dynamic group - Need to include Name, Path and Type

    Hello,
    I built a custom dynamic group that has all my SQL databases in it using SCOM 2012 SP1.  The group works fine as I can see the Name(ie, Database name), Health State, Path (ie, hostname/instance) and Types (ie; SQL 2005).  Now I'm trying to
    build a custom report based off this same information using a SQL query.   I'm no DBA and could use some help.  So far this is what i have
    use
    select
    SourceObjectDisplayName as
    'Group Name',
    TargetObjectDisplayName,TargetObjectPath
    from RelationshipGenericView
    where isDeleted=0
    AND SourceObjectDisplayName
    like
    'SQL_Databases_All'
    ORDERBY TargetObjectDisplayName
    This gets me the Group Name (which i really don't care about), database name, and hostname/instance. What I am missing is the Health State and most importantly the Type (ie, SQL Server 2005 DB, SQL Server 2008DB).
    If someone could assist me here I would appreciate it. I believe I need to do some type of INNER JOIN but have no idea where the SQL type info lives or the proper structure to use. Thanks
    OperationsManager

    Here's the updated Query for OpsMan 2012 R2:
    To find all members of a given group (change the group name below):
    select SourceObjectDisplayName as 'Group Name', TargetObjectDisplayName as 'Group Members' 
    from RelationshipGenericView 
    where isDeleted=0 
    AND SourceObjectDisplayName = 'Agent Managed Computer
    Group' 
    ORDER BY TargetObjectDisplayName

  • Notification Query for Item Group

    Dear Experts,
    Please Guide me for a Notification Query for this Scenario :
    I want to put a Notification Query for a  Group i.e. when any user do transactions in any form or any Particular form using items
    of this Group than if the Item Quantity is in Decimal then he can not do that Transaction and Get Error Message.
    Thanks in Advance.
    Atul Chakraborty

    Hi Atul,
    to achieve this you have to write SPTN at the back end
    under databases node select your live database.
    Select programability
    select stored procedure
    select db.sbo.SP_Transactionnotification
    and paste your code into
    ADD YOUR CODE AREA
    If (@object_type = '17') and (@transaction_type in ('A', 'U'))
    BEGIN
         Declare @ItmGrpCode as int
         Declare @Qty as int
         set @ItmGrpcode = (select oitm.itmsgrpcod from oitm inner join rdr1 on oitm.itemcode = rdr1.itemcode inner join ordr on   
            rdr1.docentry = ordr.docentry where  ordr.docentry=@list_of_cols_val_tab_del)
            set @Qty = (select quantity from rdr1 inner join ordr on ordr.docentry = rdr1.docentry where ordr.docentry =
            @list_of_cols_val_tab_del)
         BEGIN
                        if @ItmGrpcode = 10 and @qty = 0
                        Begin
                             set @error = -1
                             set @error_message = 'Invalid Input'
                       End
           End
    END
    Like wise by capturing object type and dml mode you have to write code for every document that you want to check.
    For example I've given code for Sales Order.
    hope this will help you
    Thanking you
    Malhaar'

  • Query for quotes not converted to Sales Orders

    Hello,
    I am relatively new to SAP B1 (little over a year now) and I am trying to build a query but I have no idea how to approach this one.
    I am trying to find Sales Quotes not converted to a Sales Order.  Sounds simple but here is where they start getting complicated.  I need to specify a date range (normally a year but could be quarterly).  Need to specify one or more items, groups, or vendors.  Need to display our cost for each item on the quote(s).
    Any help on this would be great.  I have used the query wizard in the past with some success but this one is getting way out of my comfort zone. 
    Many thanks to all who have contributed to these discussions.  It is nice knowing that I am not the only newbie around.
    Keith H

    Hi Keith.
    Following a little query for your request.
    Take note that query return only the ROWS of sales quote which are never converted in a sales order.
    It means that if you have a sales quote whit 1 rows and 1000 unit, and you convert the quote in a order for 500 unit, the quote is considered converted in a order and not displayed
    The cost is the price set in PRICE LIST 23 as you say in a your previous post.
    SELECT
    a.DocDate ,
    a.DocNum,
    a.CardCode,
    b.ItemCode,
    b.Quantity,
    d.ItmsGrpNam,
    b.Price as 'QUOTE_PRICE',
    e.Price as 'COST'
    FROM
    inner join QUT1 b on a.DocEntry = b.DocEntry
    inner join OITM c on b.ItemCode = c.ItemCode
    inner join OITB d on c.ItmsGrpCod = d.ItmsGrpCod
    inner join ITM1 e on b.itemcode = e.ItemCode
    where
    a.DocDate between [%0] and[%1]
    and b.TargetType <> '17'
    and b.ItemCode Like '%[%2]%'
    and e.PriceList = '23'
    EDIT:
    In your first post you say
    Need to specify one or more items, groups, or vendors.
    Please explain what you means for
    => one or more items
    in this point you can have some problem with the query manager...
    Hope that help
    --LUCA

Maybe you are looking for