One query

hi,
      i have one query regarding one scenario which demands automatic deliver of mail to concerned person whenever there is no stock available for any material in the system..My interest is to notify the warehouse incharge about the status of items whether it is being totally utilised so that proper and immediate action could take place...As soon as the material Qty becomes zero,this should happen...Please guide me briefly for the same...
Thanks and Regards,
Gaurav

Gaurav,
Instead of starting the workflow and checking the start condition. If you can find a UserExit/Badi/Ench., use that to validate the stock and if it satisfies then go ahead and start the workflow.. If it only a mail to the concerned person, you can even send a mail using function modules(SO_NEW_DOCUMENT_SEND_API1 or similar one) .
Thanks,
Sudhir.

Similar Messages

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • Grouped and non-grouped SELECT in one query: help!

    look first at: Wrong result when I use CASE on this forum. Here I wanted to get the user who created and the user who solved a problem (Lets call it Validation Error from now on (VE)).
    The thing is: I already have a query who returns me lots of information about a VE.
    The query in the previous thread returned me additional info about that VE (that is the creating_user and the solving_user). The 1st query is no group select, but the second is! Still, I need to combine those two in one query.
    1st query:
    select ve.seq,
         max((case vah.action when 'C' then vah.ur_code else null end)) created,
         max((case vah.action when 'S' then vah.ur_code else null end)) solved
    from validation_errors ve
    left outer join ver_action_histories vah
    on (ve.seq = vah.ver_seq AND ve.log_date = vah.ver_log_date)
    where ve.seq = 12860687
    group by ve.seq;Result:
    seq       | created | solved
    12860687    Bob       Bobdont mind the "where"-clause, it is just to make the query go faster
    what I do is: I join the VE with the ver_action_histories table which contains the users and what action they performed on a VE.
    Now I just want to add that information to the results of an other query which also returns lots of information about a VE.
    2nd query:
    select ve.seq "VE seq", mh.seq "Counter seq",
              ve.log_date, ve.solve_date, ve.solved Status, ve.failure_code, ve.mde_code,
              mh.meter_type,
              iv.mr_type, iv.mr_reason,
              ih.mmr_seq
    from validation_errors ve
    inner join meter_histories mh
    on (ve.mhy_seq = mh.seq)
    left outer join index_values iv
    on (ve.mhy_seq = iv.mhy_seq AND ve.log_date =iv.timestamp)
    left outer join index_histories ih
    on (ve.mhy_seq = ih.ive_mhy_seq)
    where ve.seq = 8653936
    and sysdate >= mh.start_date
    and sysdate < mh.end_date;dont mind the "where" and "and"-clauses ... I hope the result of this query will simplify things ...
    Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABCNow the actual question: Is it possible to combine those queries in one query? I just want the results of the first query (creating_user and solving_user) to be added as columns to the second result. Performance is very important. Please tell me that its possible?
    Wanted Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | created  | solved  | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABC            Bob        BobIf anything I explained is unclear, please tell so I can try to explain it in an easier way.

    Try an in line view:
    select *
    from
    ( <your first query goes here > ) a
    , ( <your second query goes here > ) b
    where a.seq = b.seq

  • Convert data link between one query's group and another querys group to SQL

    Hi
    I have a report where there are 2 query Groups. These 2 query groups r linked by data link. How do i combine these queries to One query so i can use it as a SQL query.
    Thanks

    Hi,
    Assume that we have two queries Q1 and Q2 and the common column between the two queries is "comn".
    Now we can convert the datalink into SQL as follows:-
    SELECT *
    FROM
    (Query for Q1)a,
    (Query for Q2)b
    WHERE a.comn=b.comn(+)
    Note: "a" and "b" are alias names for Q1 and Q2.

  • Crystal Report Many to One Query Config error when using DataSet.ReadXML me

    When I build a dataset with this method numerous relations are automatically created. I then map these fields onto crystal reports with ADO.net data connection. However when I run the report the following error occurs:
    CrystalDecisions.CrystalReports.Engine.InternalException: Cannot determine the queries necessary to get data for this report.Details:
    This query cannot be performed. The link order requires many to one query configuration, which is not supported. Please rearrange the links.
    If I remove the links (relations) i get duplicate data on the report. Is there any way to resolve this or a patch for the error?

    Hello, Mervin;
    Since you are using ADO.NET dataset, is it possible to get all of the fields you need in one SQL Query outside of Crystal Reports?
    If that is possible, you can use that dataset to create an XML or XSD file to use as the structure for your report.
    VB
    'Using the full path to the .xml file, include the schema
    dataSet.WriteXml("C:\temp\test.xml", XmlWriteMode.WriteSchema)
    or
    dataSet.WriteXmlSchema("c:\temp\testXML.xsd")
    Now create a new report with the ADO.NET(XML) connection and point to either the XML or XSD you created. XML is useful because you can view data in the report designer for final formatting of the report.
    Now there is only one datasource and no linking is required in Crystal Reports. That should resolve the one to many issue.
    Another useful tool is to group on the many and place all the fields normally in the detail section into that group header. Suppress the Detail and Group footer sections. The Group Header will now look like a Detail section and each distinct value will only appear once. You can group on one field or a combination (using a formula field) to get the results you need. Test this to be sure you do not miss anything you want to see.
    Elaine

  • Running a  BEx report with more than one query in Background

    I am having a workbook with 2 queries .This workbook needs to be executed at a particular time every day and then save this file to a application server location .
    The file name has to dynamic, as everday a new file has to be created with some date stamp.
    Please let me know the steps/ ideas to achieve this

    Sudhakar,
    are you sure that it has to b a workbook ? running queries independently can be done .. am not sure if a workbook can be scheduled to run...
    One alternative is to use APD - have the queries run and populate two ODS and then have these ODS in a multiprovider and have one query output for the same - seems to be a very longworkaround...
    Another option is to have the queries executed in an ABAP programme and then have the results in an internal table and push both the result sets into an excel sheet ad save it in the application server.
    For reading queries in ABAP there is a functionmodule for the same .. something like RSDRI_INFOPROV_READ .. I am not too sure of the name but there is a function module for sure..
    Hope it helps..
    Arun
    Assign points if it helps..

  • How to use one query results in another query

    hi,
    in help.sap I have founded that using variable type replacement path I can use one query results in another query. It is wrote there that I have to choose query name results I want to get in variable definition but I do not know where.
    How I can do this?
    Result I want to get is:
    In one query I have material prices in another material quantities. I want to calculate inventory value (price * quantity). Moreover prices are on plant level, quantities on storage type level. Plant is atribute of storage type.
    Can I do this?
    Regards,
    Andrzej

    Hi Andrzej,
    please check out this thread: Set parameters values depending on other parameters
    I had a discussion about query results as input for another query in there.
    For creating a workbook, just click on the save button after you ran your query in the bex.
    Siggi
    Message was edited by: Siegfried Szameitat

  • How to use ONE query to find out tree structure?

    ID------------upperID----------Name------------------------isFolder
    1------------ 0---------- Folder
    1------------------------------------1
    2------------ 1------------ Folder 1- Sub
    Folder--------------------1
    3------------ 2------------
    Folder1-Item1-A--------------------------0
    4------------ 1------------ Folder 1- Sub
    Item-----------------------0
    Hi all, if I have a table like above to demonstrate the
    folders and item relationship. This structure allows the user to
    create unlimited folders and items.
    Now I would like to use one query to find out the tree
    structure of this table, how could I do the query.
    Any help on this will be highly appreciated!
    Thanks,
    ez

    Also, see this thread:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 55788&enterthread=y

  • BI 7.0 : Refresh of only one Query with VBA in  a MultiQueryWorkbook

    Does anyone know how to refresh only one query with VBA in a Workbook with several queries on different sheets?

    Hello together,
    thanks for your replies.
    In the backend EHP1 is installed and I think we don't need an extra update for the frontend. But in the VBA code of the frontend the code didn't changed.
    Our BEX Analyzer Addin version is:  7100.4.1100.34
    BEx Patch Level is: Support Package 11 Revision 1606
    The VBA code is:
    Public Function SAPBEXrefresh(allQueries As Boolean, Optional atCell As Range) As Integer
    'In the 7.0 Analyzer, ALL the items in the workbook can be refreshed, but refreshing
    'a query individually is not supported
    On Error Resume Next
      extErrorBegin ("3.x API SAPBEXRefresh called")
      If allQueries = True Then
        Common.MenuRefresh
        SAPBEXrefresh = 0
      Else
        SAPBEXrefresh = 700
        p_extErrorText = "With 7.0, this API is partly supported to refresh ALL items in the workbook, NOT an individual Query"
      End If
      extErrorEnd
    End Function
    As you can see a individually query with this VBA code is still not supported.
    Does anyone know how to change this code or if we need a special update?
    Daniel
    Edited by: Marc Schlipphak on Jan 19, 2010 7:35 PM

  • Retrieving spatial and non spatial data in one query

    Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
    (In spatialquery geom is a geometry column and city is simply the name of the city):
    try
    Geometry geom = null;
    String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
    GeometryAdapter sdoAdapter =
    OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
    String spatialquery = "SELECT a1.geom, a1.city \n" +
    "FROM cities a1";
    Statement stmt = con.createStatement();
    OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
    int i = 0;
    int noOfFeatures = 2;
    while (rs.next())
    for(i = 1; i <= noOfFeatures; i++)
    STRUCT dbObject = (STRUCT)rs.getObject(i);
    try
    geom = sdoAdapter.importGeometry(dbObject);
    catch(GeometryInputTypeNotSupportedException e)
    System.out.println("Input Type not supported");
    catch(InvalidGeometryException e)
    System.out.println("Invalid geometry");
    System.out.println(geom);
    }//end while loop
    This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joe

    Theresa A Radke
    Posts: 20
    OTN Member Since: Jul, 2001
    retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
    retrieving spatial and non spatial in same query.

  • Checking and inserting in one query

    Hi,
    I want to check for the existance of a record in a table. If the record is not present then I would like to insert the data.
    I have written a query for this but it is giving me error as ORA-01427: single-row subquery returns more than one row which is true.
    Please help me to rewrite this query. I do not want any procedures etc to apply. Just one query.
    insert into mif_type_temp (FLD_TYPE, FLD_VALUE) values ('SIN', (select b.empname from
    *(select empname from testing tes where not exists*
    *(select 1 from mif_type_temp where tes.empname = FLD_VALUE))b))*
    Thanks

    The VALUES clause can only accept scalar values. Maybe you could try something like this?
    INSERT INTO mif_type_temp
    ( fld_type
    , fld_value
    SELECT 'SIN'
         , empname
    FROM   testing test
    WHERE NOT EXISTS (
                       SELECT 1
                       FROM   mif_type_temp mtt
                       WHERE  test.empname = mtt.fld_value
    ;

  • EJB QL - removal from 2 tables in one query

    Hi All,
    I have a question - can I delete data from 2 tables in the one EJB 3 query ?
    For example:
    delete from AaaaaSaaaaRaaaaa a, AaaaaFaaaaaRaaaaa b where a.id = b.id and a.startTime < :STARTTIMEAaaaaSaaaaRaaaaa and AaaaaFaaaaaRaaaaa - two separated entities mapped on the different tables.
    In this case I got exception:
    ERROR [PARSER] line 1:76: unexpected token: ,Thanks !

    I think .. answer is - NO :(
    Another question - how to delete data from 2 tables in the one query in some other way (with condition above and with EJB QL)?
    Thanks

  • Multiple charts with one Query - how to?

    Hi Experts,
    I  wanted to display mulitple charts from the one query in Bex analyzer or WAD. Each chart should be constructed from the data of each column returned from the query. So if the no. of columns in the query is 5  then there should be 5 charts generated. No of columns will be variable. How to achieve it ?? Any idea?
    All kinds of suggestions are welcome.
    Thanks
    Regards
    AB

    Hi Priya,
    Thanks for your response. Actually the infomation is of technical in nature. Its about processes and the parts. Rows represents  parts and columns represent processes. The processes are variable and can be added any time in query.Based on the Query there should be automation of charts. So there is an analysis per process/parts with a single chart. So if the processes are increasing , the automation should also add a chart....thats what the requirement says. So if I have 10 process that I shd get 10 charts and if 15 afterwards then 15....
    I hope now its clear to you.Do suggest if u have any idea.
    Regards
    Atul

  • Update multiple UDF from one query generator

    Hi All,
    I have Form1 with multiple UDF1 which have been key in by users
    And another Form2 with multiple UDF2 which exactly same with Form1 UDF1
    Is there a way that I can copy multiple UDF at Form2UDF2 from Form1UDF1 instead of creating query for each individual UDF, where in query generator I can select more the one column but only first column will be insert to the single UDF.
    Thanks

    Hi Firos,
    I mean I have 7UDF in the Payment Form where the information to this UDF are come from 7UDF in the invoice form which already created previously so I would like to copy those UDF from invoice to UDF in payment by using single query to capture all the UDF information by doing:
    SELECT T0.[DocNum], T0.[UDF1], T0.[UDF2], T0.[UDF3], T0.[UDF4], T0.[UDF5], T0.[UDF6], T0.[UDF7]
    FROM OINV T0 WHERE T0.[CardCode] = $[ORCT.CardCode]
    From above query can I pass the result directly to UDF in Payment Form? or I need to create one query for each individual UDF.
    Thanks

  • Update SAME column name in two tables from ONE query

    Dear All Seniors
    Please tell me is it possible to update a same column name in two tables.
    I have two tables in same schema
    (1)table name
    pem.igp_parent
    column name
    igp_no.
    igp_type
    (2)table name
    pem.igp_child
    column name
    igp_no.
    igp_type
    i want to update igp_no column in one query please tell me how it would be possible.
    thanks
    yassen

    You want to update the data from what to what? Where is the new data coming from?
    If you are trying to put the same data in two different tables, that strongly implies that you have a normalization problem that needs to be addressed.
    Why do you want a single query rather than updating each table in turn? Can you join the two target tables to produce a key-preserved view?
    Justin

  • How can i write two ?DDL in one query

    how can i write two ?DDL statment in one query?

    Issuing two DDL statements requires two edxecutions. Getting around it is possible by creating a procedure that issues the two DDL statements. But they would still have to be issues one at a time, but you would only have to write one statement to invoke it.

Maybe you are looking for