How to omit records based on a status code

I am trying to select records based on a status 'N' or 'A' by a certain date as long as by the chosen date there is not another status given to the same course like 'D' or 'X'.
Here are some sample data...
CREATE TABLE #TEST
(ID VARCHAR(7),
COURSE VARCHAR(10),
CURRENT_STATUS VARCHAR(1),
STATUS_DATE DATETIME)
INSERT INTO #TEST
(ID, COURSE, CURRENT_STATUS, STATUS_DATE)
VALUES
('0020541','AAAA-1000H', 'X', '2013-08-27 00:00:00.000'),
('0020541','AAAA-1000H', 'N', '2013-08-26 00:00:00.000'),
('0020541','BBBB-2000H', 'D', '2013-11-04 00:00:00.000'),
('0020541','BBBB-2000H', 'N', '2013-08-27 00:00:00.000'),
('0020541','CCCC-3000H', 'D', '2013-09-11 00:00:00.000'),
('0020541','CCCC-3000H', 'N', '2013-08-26 00:00:00.000'),
('0020541','DDDD-4000H', 'A', '2013-08-25 00:00:00.000'),
('0020541','EEEE-5000H', 'N', '2013-08-26 00:00:00.000')
SELECT * FROM #TEST
DROP TABLE #TEST
If the query is to determine how many records with a status of N or A up to and incl August 26, 2013, I should see 4 records... AAAA-1000H, CCCC-3000H, DDDD-4000H, EEEE-5000H
If the query is to determine how many records with a status of N or A up to and incl October 1, 2013, I should see 3 records... BBBB-2000H,  DDDD-4000H, EEEE-5000H
...and so on.
Any help is appreciated.

I am trying to select records based on a status 'N' or 'A' by a certain date as long as by the chosen date there is not another status given to the same course like 'D' or 'X'.
Here are some sample data...
CREATE TABLE #TEST
(ID VARCHAR(7),
COURSE VARCHAR(10),
CURRENT_STATUS VARCHAR(1),
STATUS_DATE DATETIME)
INSERT INTO #TEST
(ID, COURSE, CURRENT_STATUS, STATUS_DATE)
VALUES
('0020541','AAAA-1000H', 'X', '2013-08-27 00:00:00.000'),
('0020541','AAAA-1000H', 'N', '2013-08-26 00:00:00.000'),
('0020541','BBBB-2000H', 'D', '2013-11-04 00:00:00.000'),
('0020541','BBBB-2000H', 'N', '2013-08-27 00:00:00.000'),
('0020541','CCCC-3000H', 'D', '2013-09-11 00:00:00.000'),
('0020541','CCCC-3000H', 'N', '2013-08-26 00:00:00.000'),
('0020541','DDDD-4000H', 'A', '2013-08-25 00:00:00.000'),
('0020541','EEEE-5000H', 'N', '2013-08-26 00:00:00.000')
SELECT * FROM #TEST
DROP TABLE #TEST
If the query is to determine how many records with a status of N or A up to and incl August 26, 2013, I should see 4 records... AAAA-1000H, CCCC-3000H, DDDD-4000H, EEEE-5000H
If the query is to determine how many records with a status of N or A up to and incl October 1, 2013, I should see 3 records... BBBB-2000H,  DDDD-4000H, EEEE-5000H
...and so on.
Any help is appreciated.
I guess I didn't understand your problem. Not sure if this might help you.
SELECT * FROM #TEST
where CURRENT_STATUS IN ('N','A') AND STATUS_DATE<='2013-08-26'
AND STATUS_DATE NOT IN(Select STATUS_DATE from #test
where CURRENT_STATUS IN ('D','X'))
SELECT * FROM #TEST
where CURRENT_STATUS IN ('N','A')
AND STATUS_DATE<='2013-10-01'
AND STATUS_DATE NOT IN(Select STATUS_DATE from #test
where CURRENT_STATUS IN ('D','X'))
- please mark correct answers

Similar Messages

  • How to select records based on Max/Min on different columns and group by

    I have a table with 5 columns(a,b,c,d,e), i need to select records based on MAX(c),Max(D) and Min(e) group by a,b. i am trying using : select max(c),max(d),min(e) from table group by a,b. this is not working. its giving me 1 6 1
    a b c d e
    1 1 1 2 1
    1 1 1 6 4
    1 1 1 6 3
    when i group by a,b i am expecting the record 1 6 3
    Please help me with this.. Thanks in advance....

    Hi,
    Welcome to the forum!
    962163 wrote:
    I have a table with 5 columns(a,b,c,d,e), i need to select records based on MAX(c),Max(D) and Min(e) group by a,b. i am trying using : select max(c),max(d),min(e) from table group by a,b. this is not working. its giving me 1 6 1
    a b c d e
    1 1 1 2 1
    1 1 1 6 4
    1 1 1 6 3
    when i group by a,b i am expecting the record 1 6 3It looks to me like "1 6 1" is the correct answer. You're asking for the lowest value of e, and 1 is lower than 3.
    Maybe you don't want MIN (e). Explain why you want 3 (that is, how you decided that 3 is the correct value for the last column) and someone will help you code it.
    Edited by: Frank Kulash on Sep 28, 2012 6:17 PM
    Whenever you have a problem, you should psot CREATE TABLE and INSERT statements for your sample data. That way, the people who want to help you can re-create the problem and test their ideas. It often helps to clarify the problem, too. since this is your first message, I'll do it for you:
    CREATE TABLE     table_x
    (       a     NUMBER
    ,     b     NUMBER
    ,     c     NUMBER
    ,     d     NUMBER
    ,     e     NUMBER
    INSERT INTO table_x (a, b, c, d, e) VALUES (1, 1, 1, 2, 1);
    INSERT INTO table_x (a, b, c, d, e) VALUES (1, 1, 1, 6, 4);
    INSERT INTO table_x (a, b, c, d, e) VALUES (1, 1, 1, 6, 3);
    COMMIT;

  • How to display records based on current month and last month???

    i have a query that want to display the data for current month and last month. when i try to view the reports, all the data/key figures is return all in 0.00.
    i modify the variables for this current month and last month but still the results is the same. i could not see the data. any advise on how to modify the variables for this current month and last month? i am thinking my variables is wrong.
    for the current month variable:
    the type of variable is characteristic value, processing by customer exit, reference characteristic is calendar year/month.
    thanks for all who are kind to help me here....

    Hi,
       If you install the variables from BC correctly and they are in active state, you can use them directly use them. check for this month the total values at info cube is ZERO or some value. as you told you are getting ZEROS for your input.and check the data at cube level based on your query design, apply all restrictions, fileters and see do you get any data at cube level and compare with report.

  • How to get Records based on time period?

    Hi,
    Iam having a Table which consists of two columns named "ID" (number datatype) and "JoinDate" (Varchar datatype). I would like to retrive the records whose join date is 3 months before. Any one pls give SQL for this scenario?
    Thanks in Advance...

    Why your joindate is varchar type? Which the sample data looks like? Is the format consistent?

  • Select records based on the closest given time

    Dear SQL gurus,
    I have a table T1:
    Name Null? Type
    ID NOT NULL NUMBER(5)
    MOMENT NOT NULL DATE [DD.MM.YYYY HH24:MI]
    MEASUREMENT NOT NULL NUMBER(8,3)
    Example (ID, MOMENT, MEASUREMENT)
    -- START OF EXAMPLE --
    9380 18.11.2000 03:45 17.6
    9380 18.11.2000 04:30 17.3
    9380 18.11.2000 05:45 16.8
    9380 18.11.2000 06:15 16.8
    9380 18.11.2000 07:00 16.2
    9380 18.11.2000 07:30 16.2
    9380 18.11.2000 08:15 16
    9380 18.11.2000 08:45 15.7
    9380 18.11.2000 09:30 15.4
    9380 18.11.2000 10:00 15.4
    9380 18.11.2000 11:15 15.4
    9380 18.11.2000 11:45 15.4
    9380 18.11.2000 12:30 15.4
    9380 18.11.2000 13:00 15.4
    9380 18.11.2000 13:45 15.4
    --- END OF EXAMPLE --
    How to select records based on the:
    - time period specified by the day only [DD.MM.YYYY] - CONDITION 1
    - with values for 6AM only, and if not available, with values closest to 6AM - CONDITION 2
    (if the time gap in MOMENT field is too big, lets say > 5h then choose the average between the value before 6AM (ex. 4:15AM) and the value after the 6AM (ex. 9:45AM))
    CONDITION 1 (something like): moment between '01.01.2005' and '31.12.2004' - this is OK
    CONDITION 2: I do not know how to formulate, especially if 6AM value is not availabe, and I have to find the closest available value, or get the avergae from the two adjacent values.
    Maybe cursor magic??? Thanks a lot for your help.
    Rado

    About condition two, would the following select be of use to you? Picking the first record could be achived by rownum, analytic function, etc.
    WITH t1 AS (SELECT 9380 id, TO_DATE('18.11.2000 03:45', 'dd.mm.yyyy hh24:mi') moment,  17.6 measurement
                  FROM dual
                 UNION 
                SELECT 9380 id, TO_DATE('18.11.2000 04:30', 'dd.mm.yyyy hh24:mi') moment,  17.3 measurement
                  FROM dual
                 UNION
                SELECT 9380 id, TO_DATE('18.11.2000 05:45', 'dd.mm.yyyy hh24:mi') moment,  16.8 measurement
                  FROM dual
                 UNION
                SELECT 9380 id, TO_DATE('18.11.2000 06:15', 'dd.mm.yyyy hh24:mi') moment,  16.8 measurement
                  FROM dual
    SELECT id, moment, measurement, diff
      FROM (SELECT id, moment, measurement,
                   moment - TO_DATE(TO_CHAR(moment, 'dd.mm.yyyy ') || '06:00', 'dd.mm.yyyy hh24:mi') diff
              FROM t1
    ORDER BY abs(diff) asc, SIGN(diff) desc;
      C.

  • Outbound IDoc Error: Status Code 37  'Sender Port' is invalid

    Hi
    I have an Error when the Outbound IDoc is triggered.
    It shows that 'Sender Port in Control Record is invalid'.
    Status Code: 37.
    I know that there are some issues with the Sender Port Definition.
    Please help me out to solve this problem using some checkpoints at each and every step.
    Reward Points Assured.
    Regards,
    Baburaj

    Hi Baburaj Manickam
    Good
    Follow this simple procedure
    1) Send an outbound IDOC data(MATMAS) to a flat file on client1(SENDER).
    -  Create File Port (WE21) for outbound file.
    -  Maintain Distribution Model (BD64) for sender ->receiver system.
    -  Create Partner Profile (WE20) for logical system.
    -  You can use this program RBDSEMAT (t/code BD10) to generate IDoc MATMAS file(s). 
    _  Then you can FTP the file(s) to receiver system.
    2) Upload the flat file as an IDOC on the inbound sytem
    which is Client2(RECIEVER).
    -  Create File Port (WE21) for inbound file.
    -  Maintain Distribution Model (BD64) for receiver -> sender system.
    -  Create Partner Profile (WE20) for logical system.
    -  You can use this program RSEINB00 to upload IDoc MATMAS file(s). 
    INBOUND IDOC PROCESSING:
    Firstly attach your idoc to a process code.
    In the process cod you can tell the system that the specified program should be triggered whenever an idoc of that type comes to the system.
    Then you want to have a Z-function module for your idoc processing, if I understand correctly.The steps should be:
    1. Create a z function module for idoc inbound posting (copy from a function module idoc_input_*).
    2. Set Function Modules as Inbound: - Transaction BD51
    3. Assign Function Modules to Logical Messages and Idoc types:- Transaction WE57
    4. Create process codes : Transaction WE42, and link the z-function module.
    5. Create partner profile: transaction WE20 and attach the message type and process code.
    6. In the Z- function module, extract data from the idoc segments, do whatever processing you want to do, and then call BAPI_CREATE_SALES_ORDER_FROMDAT2.
    Try the Trasaction WE19 for testing your inbound and outbound IDOCs
    Good Luck and Reward me for the same
    Thanks
    Ashok.N

  • GL Interface status code of "P"

    I noticed that on our GL_INTERFACE table several records which had the status code of "P" instead of "NEW". Since we have no Oracle documentation (especially the Techinical Reference Manuals),does anybody know or can find out what that code means?
    Normally, I would though it means pending. When you import the records, if the transactions have a problem or does not balance, these records remain on the interface. I never though that it will set these records as pending. We were trying to import records from two sources at the same time. One set of records from a source had an invalid flexfield combo. After we fixed the problem, all the transaction processed without an problems and the GL_INTERFACE table cleared.
    Is this a new function to 11i? I came from a 10.7.4 NCA enviroment and never seen this before. Thanks for your assistance.
    David Correia
    System Analysis
    NECMSC

    hi david,
    this feature is also there in 10.7. If any one record contains any problem, then all the records in that batch will be stopped. And once the same is corrected the whole batch will be imported. until then the records will be in status 'P', ie pending. This feature is there in 10.7 also.

  • How to create a record based on the name of a file in the file-system?

    Hi,
    With a lot of pictures I want to have a database to gather some information about these pictures.
    First question is how to generate a record based on a file in the file system?
    e.g. the pictures are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg" .
    now i want to create records with as one of the attributes the name of the picture (not the picture itself). how to create these records (based on the information of the file-ssytem). i.e. the number of records should be the same as the number of pictures.
    any suggestions?
    any reaction will be appreciated.
    Leo

    Link to Create directory
    http://www.adp-gmbh.ch/ora/sql/create_directory.html
    You can create a list of files in the directory and read the list files from that directory.
    [UTL_FILE Documentation |http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]
    [Solution using Java|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584]
    SS

  • How to add extra per day records based on maximum occurances in the week.

    Hello,
    I need to add extra records based on maximum occurances on a day in a week.
    For example, the result of the query shows that maximum occuances in a week 0 is 3 on so I need to add empty records in each day in that week.
    SQL QUERY:
    with  numbers as (
    SELECT ROWNUM N FROM dual 
      CONNECT BY LEVEL <=35
    ),months as (
    SELECT     ADD_MONTHS('01-JUN-10',n-1) AS current_month,
         TO_CHAR(ADD_MONTHS('01-JUN-10',n-1),'fmMonth-YYYY') AS current_month_label
    FROM numbers
    WHERE ADD_MONTHS('01-JUN-10',n-1) <= NVL(add_months('01-JUN-10', :monthcount-1),:p_month)
    ORDER BY n ASC
    ) , dates as (
    select     trunc(trunc(m.current_month, 'MM'), 'D') + n - 1 calendar_date,
         trunc((n - 1) / 7) AS week_num,
                    m.current_month as current_month
    from     numbers, months m
    where trunc(dom.schedule.calendar_begin(m.current_month) + n - 1, 'd') <= last_day(m.current_month)
    Order By week_num, calendar_date
    select dates.week_num, edate, name from (
    --week 0
    select '30-MAY-10' as edate, 'JJ' as name from dual union
    select  '31-MAY-10' as edate, 'MK' as name from dual union
    select  '01-JUN-10' as edate, 'MK' as name from dual union
    select  '01-JUN-10' as edate, 'BK' as name from dual union
    select  '01-JUN-10' as edate, 'JJ' as name from dual union
    select  '04-JUN-10' as edate, 'KK' as name from dual union
    select  '04-JUN-10' as edate, 'LA' as name from dual      union
    -- week 1
    select  '06-JUN-10' as edate, 'BK' as name from dual union
    select  '06-JUN-10' as edate, 'JJ' as name from dual union
    select  '07-JUN-10' as edate, 'KK' as name from dual union
    select  '11-JUN-10' as edate, 'LA' as name from dual      
    ) a  join dates on dates.calendar_date = a.edate   
    order by week_num, to_date(edate);CURRENT RESULT :
    WEEK_NUM             EDATE                NAME
    0                   30-MAY-10            JJ
    0                   31-MAY-10             MK
    0                   01-JUN-10             MK
    0                   01-JUN-10             JJ
    0                   01-JUN-10             BK
    0                   04-JUN-10             KK
    0                   04-JUN-10             LA
    1                   06-JUN-10             BK
    1                   06-JUN-10             JJ
    1                   07-JUN-10             KK
    1                   11-JUN-10             LAREQUIRED RESULT:
    WEEK_NUM             EDATE                NAME
    0                   30-MAY-10             JJ
    0                   30-MAY-10            null
    0                   30-MAY-10            null
    0                   31-MAY-10            MK
    0                   31-MAY-10            null
    0                   31-MAY-10            null
    0                   01-JUN-10             BK
    0                   01-JUN-10              JJ
    0                   01-JUN-10             MK
    0                   02-JUN-10             null
    0                   02-JUN-10             null
    0                   02-JUN-10             null
    0                   03-JUN-10             null
    0                   03-JUN-10             null
    0                   03-JUN-10             null
    0                   04-JUN-10             KK
    0                   04-JUN-10             LA
    0                   04-JUN-10             null
    0                   05-JUN-10             null
    0                   05-JUN-10             null
    0                   05-JUN-10             null
    --Number of Week 1 records should be 14 = (max occurances on 06-JUN-10)  * 7
    1                   06-JUN-10             BK
    1                   06-JUN-10             JJ
    1                   07-JUN-10             KK
    1                   07-JUN-10             null
    1                   08-JUN-10             null
    1                   08-JUN-10             null
    1                   09-JUN-10             null
    1                   09-JUN-10             null
    1                   10-JUN-10             null
    1                   10-JUN-10             null
    1                   11-JUN-10             LA
    1                   11-JUN-10             null
    1                   12-JUN-10             null
    1                   12-JUN-10             nullI would appreciate it if you could help me to find efficient way to achieve this?
    Thanks,
    GM
    Edited by: user12068331 on Sep 28, 2010 2:17 PM
    Edited by: user12068331 on Sep 28, 2010 2:48 PM

    Ok,
    Few things to clarify first :
    1 - How do you define week number ?
    Oracle has 2 different way for week number : normal week number (WW) and isoweek (IW).
    is your weeknumber one of those, or is it something else ?
    2 - Depending on the country the week doesn't start on the same day : in France (as most of Europe I think) first day is monday, where in the USA (as far as I know) first day is sunday.
    the to_char builtin function can display weeknumber :with a as (
    --week 0
    select 0 as weeknum, to_date('30-MAY-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 0 as weeknum, to_date('31-MAY-2010','DD-MON-YYYY') as edate, 'MK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'MK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'BK' as name from dual union all
    select 0 as weeknum, to_date('01-JUN-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 0 as weeknum, to_date('04-JUN-2010','DD-MON-YYYY') as edate, 'KK' as name from dual union all
    select 0 as weeknum, to_date('04-JUN-2010','DD-MON-YYYY') as edate, 'LA' as name from dual union all
    -- week 1
    select 1 as weeknum, to_date('06-JUN-2010','DD-MON-YYYY') as edate, 'BK' as name from dual union all
    select 1 as weeknum, to_date('06-JUN-2010','DD-MON-YYYY') as edate, 'JJ' as name from dual union all
    select 1 as weeknum, to_date('07-JUN-2010','DD-MON-YYYY') as edate, 'KK' as name from dual union all
    select 1 as weeknum, to_date('11-JUN-2010','DD-MON-YYYY') as edate, 'LA' as name from dual
    select to_char(a.edate,'IW') isoweek, to_char(a.edate,'WW') numweek, a.*
    from a;
    IS NU    WEEKNUM EDATE                          NA
    21 22          0 Sunday    30/05/2010 00:00:00  JJ
    22 22          0 Monday    31/05/2010 00:00:00  MK
    22 22          0 Tuesday   01/06/2010 00:00:00  MK
    22 22          0 Tuesday   01/06/2010 00:00:00  BK
    22 22          0 Tuesday   01/06/2010 00:00:00  JJ
    22 23          0 Friday    04/06/2010 00:00:00  KK
    22 23          0 Friday    04/06/2010 00:00:00  LA
    22 23          1 Sunday    06/06/2010 00:00:00  BK
    22 23          1 Sunday    06/06/2010 00:00:00  JJ
    23 23          1 Monday    07/06/2010 00:00:00  KK
    23 24          1 Friday    11/06/2010 00:00:00  LA
    11 rows selected.

  • How to create Form based on a table to display multiple record

    Hello All,
    Would somebody please tell me how to create a Form based on a single table ,
    to view and insert multi record based on a single table.In other words I would like
    to have a form as shown below ,where the users can Insert,update,delete,query and so on
    Item Id PArt Number List Price
    100 Item-1 $120.oo
    200 Item-2 $150.00
    300 Item-3 $50.00
    I know I can do it as Single Record block using Tabular Format,but multiple record ?????
    Thanks in Anticipation
    Babu

    Try this method,
    1. Creat a Master Detail Form (Custom Layout and not tabular)
    and in the master block select one field.
    2. In the HTML layout for master remove the reference for
    that field(so that nothing will appear in the master block
    of the form).
    3. Before the update (in the Pl/SQL event handler select the 'Save' event and write the following code to avoid updating master block).
    p_session.set_value(p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'MASTER_ACTION',
    p_value => 'None');
    doSave;
    For eg, let's say
    Master is from 'Dept' table and Detail is from 'Emp' table(with join condition Dept.dept_id = Emp.dept_id). In the master remove everything except dept_id field and in the HTML layout for master remove the reference of the dept_id field(you cannot remove this field physically from the master layout). Now the form will look like multirow form rather than master detail form but only problem with this workaround is 'Detail Action' will be present in the detail block.
    I hope this will help you.
    Thanks
    -Krishnamurthy

  • How do you apply rules based on read status?

    I migrated to Mail.app from PowerMail, and one of the powerful options available when creating a filter/rule in PowerMail was the ability to check the status of the message (message is/is not read) before applying the rest of the rule.
    Is there a way to apply this same check within a rule in Mail.app?
    This option is used to create rules that file mail ONLY AFTER it has been read.
    Obviously, the user must apply the rule manually since rules are only fired off when mail comes in, or when one highlights one or more message(s) and then selects the "Apply Rules" option from the contextual menu or from the Message menu.
    What makes this so powerful is that rather than having to manually file every message after you read it you can create rules that check status for read, if it is check to see if it matches other criteria, and if it does, put it in a folder with other like messages.
    Like many people, I have a large number of folders and subfolders into which I file my messages. By creating such a rule, I only have to file a message that matches other criteria once, use that to set up the criteria for the rule, and on subsequent messages that match that criteria, I only have to apply the rule after I have read it.
    I could just file all the messages directly into their appropriate folders, but then I have to keep watch on the subfolders for new mail, rather than just watching the inbox, reading the new mail, then using the Apply Rules item to have the read message checked and then filed based on the criteria that it matches.
    The logic might look like this.
    Is Read status true
    AND
    The subject contains "Intranet"
    THEN
    Move message to /On My Mac/Work Mail/Current Projects/Intranet Project/ mail folder
    THEN
    Stop processing rules.
    Without the ability to test the message's "read status" I have to select the message, right click to select "Move To>" from the contextual menu, then mouse through four sub panes to put the read message in the folder where I want to store it.
    I also cannot select a number of read messages and use the Apply Rules option to allow my filing rules to move any number of read messages to their proper storage folders.
    If anyone has a method for doing this, please let me know. It is the one thing I miss most about PowerMail.
    Message was edited by: rnsyderpsu

    I have been doing some of this, and while it does provide some of the functionality that is lost without the ability to apply rules only to read messages, it is not a complete solution. One of the biggest drawbacks is that it is not easy to selectively limit what new mail shows up the smart mailbox. One approach that works, sort of, is to limit the smart mailbox to only messages from people in my address book. However, not all relevant messages are from people already in my mailbox, so it requires constantly double checking to make sure that things are slipping through the cracks.
    The best thing about being able to apply rules, after receiving them, based on the status of a message is that it puts the control in the users hands. It allows you to selectively apply rules, only when you want to apply them. Rather than always/never, you have the ability to apply rules "sometimes/as needed." It allows for fuzzy logic, rather than hard conditions.

  • Search based on UnApproved status in HRMS

    Hi All
    I have search page which shows records based on search
    that page has one dropdown list which contain many options like
    Approved,Closed,Rejected,Unapproved,etc
    when I select Approved status then It shows all records that are approved
    and when I select unapproved then it doesnt shows any records which are un approved
    now I want show all records which are unapproved after selecting unapproved status
    that page sows records in form of table at the bottom side of page
    How can I do it?

    I am getting confused plz use this Query
    SELECT Vac.VACANCY_ID, Vac.DATE_FROM, Vac.NAME, Vac.DATE_TO, Vac.DESCRIPTION, Vac.NUMBER_OF_OPENINGS, Vac.LAST_UPDATE_DATE, Vac.CREATION_DATE, Job.NAME AS JobName, Job.JOB_ID, Grade.NAME AS GradeName, Grade.GRADE_ID, Org.NAME AS OrgName, Org.ORGANIZATION_ID, Loc.LOCATION_CODE, Loc.LOCATION_ID, Recruiter.FULL_NAME AS RECRUITER_NAME, Recruiter.PERSON_ID AS RECRUITER_ID, Recruiter.EFFECTIVE_START_DATE, Recruiter.EFFECTIVE_END_DATE, Recruiter.EMAIL_ADDRESS, Manager.FULL_NAME AS MANAGER_NAME, Manager.PERSON_ID AS MANAGER_ID, Manager.EFFECTIVE_START_DATE AS MAN_EFFECTIVE_START_DATE, Manager.EFFECTIVE_END_DATE AS MAN_EFFECTIVE_END_DATE, Manager.EMAIL_ADDRESS AS EMAIL_ADDRESS1, Status.MEANING, Status.LOOKUP_TYPE, Status.LOOKUP_CODE, Vac.REQUISITION_ID, (select count(assignment_type) from per_all_assignments_f paaf where paaf.vacancy_id = Vac.vacancy_id and paaf.assignment_type = 'A' and :1 between PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE AND NOT EXISTS (SELECT NULL FROM per_all_assignments_f paf3 WHERE paf3.vacancy_id = paaf.vacancy_id AND paf3.person_id = paaf.person_id AND paf3.assignment_type ='E' ) and exists ( select null from per_all_assignments_f paf4 where paf4.assignment_id = paaf.assignment_id and paf4.effective_end_date = to_date('31/12/4712','DD/MM/RRRR') and paf4.assignment_type = 'A' ) and (fnd_profile.value('IRC_AGENCY_NAME') is null or exists (select 1 from irc_agency_vacancies iav1 ,per_all_people_f per1 ,irc_notification_preferences inp1 where iav1.vacancy_id=vac.vacancy_id and iav1.agency_id=fnd_profile.value('IRC_AGENCY_NAME') and per1.person_id=paaf.person_id and per1.party_id=inp1.party_id and (inp1.agency_id=iav1.agency_id or iav1.manage_applicants_allowed='Y')) ) ) AS APPLICANTS, (select count(distinct assignment_id) from per_all_assignments_f paaf where paaf.vacancy_id = Vac.vacancy_id and assignment_type = 'E' ) AS FILLED, decode(vac.manager_id,:2,'Y','N') AS MY_VACANCIES, Vac.BUDGET_MEASUREMENT_TYPE, Vac.BUDGET_MEASUREMENT_VALUE, posEO.NAME AS NAME1, posEO.POSITION_ID, posEO.EFFECTIVE_START_DATE AS EFFECTIVE_START_DATE2, posEO.EFFECTIVE_END_DATE AS EFFECTIVE_END_DATE2, NULL AS ACCESS_FLAGS, Vac.STATUS AS VACANCY_STATUS, Bg.NAME AS NAME2, Bg.ORGANIZATION_ID AS ORGANIZATION_ID1, Vac.BUSINESS_GROUP_ID, VSC.EMPLOYEE, VSC.CONTRACTOR, VSC.EMPLOYMENT_CATEGORY, VSC.TRAVEL_PERCENTAGE, VSC.MIN_SALARY, VSC.MAX_SALARY, VSC.SALARY_CURRENCY, VSC.PROFESSIONAL_AREA, VSC.WORK_AT_HOME, VSC.MIN_QUAL_LEVEL, VSC.MAX_QUAL_LEVEL, VSC.ATTRIBUTE_CATEGORY, VSC.ATTRIBUTE1, VSC.ATTRIBUTE2, VSC.ATTRIBUTE3, VSC.ATTRIBUTE4, VSC.ATTRIBUTE5, VSC.ATTRIBUTE6, VSC.ATTRIBUTE7, VSC.ATTRIBUTE8, VSC.ATTRIBUTE9, VSC.ATTRIBUTE10, VSC.ATTRIBUTE11, VSC.ATTRIBUTE12, VSC.ATTRIBUTE13, VSC.ATTRIBUTE14, VSC.ATTRIBUTE15, VSC.ATTRIBUTE16, VSC.ATTRIBUTE17, VSC.ATTRIBUTE18, VSC.ATTRIBUTE19, VSC.ATTRIBUTE20, VSC.ATTRIBUTE21, VSC.ATTRIBUTE22, VSC.ATTRIBUTE23, VSC.ATTRIBUTE24, VSC.ATTRIBUTE25, VSC.ATTRIBUTE26, VSC.ATTRIBUTE27, VSC.ATTRIBUTE28, VSC.ATTRIBUTE29, VSC.ATTRIBUTE30, VSC.SEARCH_CRITERIA_ID, Vac.ATTRIBUTE_CATEGORY AS VAC_ATTRIBUTE_CATEGORY, Vac.ATTRIBUTE1 AS VAC_ATTRIBUTE1, Vac.ATTRIBUTE2 AS VAC_ATTRIBUTE2, Vac.ATTRIBUTE3 AS VAC_ATTRIBUTE3, Vac.ATTRIBUTE4 AS VAC_ATTRIBUTE4, Vac.ATTRIBUTE5 AS VAC_ATTRIBUTE5, Vac.ATTRIBUTE6 AS VAC_ATTRIBUTE6, Vac.ATTRIBUTE7 AS VAC_ATTRIBUTE7, Vac.ATTRIBUTE8 AS VAC_ATTRIBUTE8, Vac.ATTRIBUTE9 AS VAC_ATTRIBUTE9, Vac.ATTRIBUTE10 AS VAC_ATTRIBUTE10, Vac.ATTRIBUTE11 AS VAC_ATTRIBUTE11, Vac.ATTRIBUTE12 AS VAC_ATTRIBUTE12, Vac.ATTRIBUTE13 AS VAC_ATTRIBUTE13, Vac.ATTRIBUTE14 AS VAC_ATTRIBUTE14, Vac.ATTRIBUTE15 AS VAC_ATTRIBUTE15, Vac.ATTRIBUTE16 AS VAC_ATTRIBUTE16, Vac.ATTRIBUTE17 AS VAC_ATTRIBUTE17, Vac.ATTRIBUTE18 AS VAC_ATTRIBUTE18, Vac.ATTRIBUTE19 AS VAC_ATTRIBUTE19, Vac.ATTRIBUTE20 AS VAC_ATTRIBUTE20, decode((select update_allowed||delete_allowed from irc_rec_team_members rec where rec.vacancy_id = VAC.vacancy_id and rec.person_id = :3), 'NN', 'VIEW', 'UPDATE') AS TEAM_ACCESS, (select count() from hr_api_transactions where transaction_ref_table = 'PER_ALL_VACANCIES' and transaction_ref_id = Vac.vacancy_id and creator_person_id = :4 and status = 'S') AS SaveForLaterLocks, (select count(*) from hr_api_transactions where transaction_ref_table = 'PER_ALL_VACANCIES' and transaction_ref_id = Vac.vacancy_id and status != 'D' and (creator_person_id != :5 or transaction_state != null or status != 'S' )) AS TRANSACTION_LOCKS, (select decode((SELECT count(pav1.vacancy_id) FROM per_all_vacancies pav1 WHERE pav1.vacancy_id =vac.VACANCY_ID AND(pav1.status ='CLOSED' OR (pav1.date_to is not null and NOT :18 BETWEEN pav1.date_from AND pav1.date_to))),0,'Y','N') from dual) AS APPLY_FLAG, PSA.LOOKUP_TYPE AS LOOKUP_TYPE1, PSA.LOOKUP_TYPE AS LOOKUP_TYPE2, Grade.OBJECT_VERSION_NUMBER AS OBJECT_VERSION_NUMBER1, PSA.LOOKUP_CODE AS LOOKUP_CODE1, Loc.OBJECT_VERSION_NUMBER AS OBJECT_VERSION_NUMBER2, PSA.MEANING AS MEANING1, Recruiter.OBJECT_VERSION_NUMBER AS OBJECT_VERSION_NUMBER3, decode ((SELECT count(1) FROM PER_RECRUITMENT_ACTIVITIES PRA,PER_ALL_VACANCIES PAV, IRC_ALL_RECRUITING_SITES ias,PER_RECRUITMENT_ACTIVITY_FOR PRAE WHERE vac.vacancy_id=PRAE.vacancy_id AND pra.recruiting_site_id = ias.recruiting_site_id AND PRAE.RECRUITMENT_ACTIVITY_ID = PRA.RECRUITMENT_ACTIVITY_ID AND ias.EXTERNAL = 'R' AND sysdate BETWEEN pra.date_start AND NVL (pra.date_end, sysdate) ), 0,'N','Y') AS REFERRALS FROM PER_ALL_VACANCIES Vac, PER_JOBS_VL Job, PER_GRADES_VL Grade, HR_ALL_ORGANIZATION_UNITS_VL Org, HR_LOCATIONS_ALL_VL Loc, PER_ALL_PEOPLE_F Recruiter, PER_ALL_PEOPLE_F Manager, HR_LOOKUPS Status, HR_ALL_POSITIONS_F_VL posEO, HR_ALL_ORGANIZATION_UNITS_VL Bg, IRC_SEARCH_CRITERIA VSC, HR_LOOKUPS PSA WHERE VAC.vacancy_id = VSC.object_ID(+) AND VSC.object_type(+) = 'VACANCY' and Vac.Job_id = Job.JOB_ID(+) and Vac.Grade_id = Grade.GRADE_ID(+) and Vac.Organization_id = Org.ORGANIZATION_ID(+) and Vac.Location_id = Loc.LOCATION_ID(+) and Vac.Recruiter_id = Recruiter.PERSON_ID(+) and :6 between nvl(Recruiter.EFFECTIVE_START_DATE,:7) and nvl(Recruiter.EFFECTIVE_END_DATE, :8) and Vac.Manager_id = Manager.PERSON_ID(+) and :9 between nvl(Manager.EFFECTIVE_START_DATE,:10) and nvl(Manager.EFFECTIVE_END_DATE,:11) and Status.LOOKUP_TYPE(+) = 'VACANCY_STATUS' and Vac.Status = Status.LOOKUP_CODE(+) AND vac.position_id = posEO.position_id(+) AND :12 between nvl(posEO.EFFECTIVE_START_DATE, :13) AND nvl(posEO.EFFECTIVE_END_DATE, :14) AND VAC.business_group_id = BG.Organization_id and EXISTS (select null from PER_VACANCIES PV where PV.vacancy_id = VAC.vacancy_id) AND (exists (select null from irc_agency_vacancies iav where iav.agency_id = FND_PROFILE.VALUE('IRC_AGENCY_NAME') and iav.vacancy_id = vac.vacancy_id AND :15 between nvl(START_DATE,:16) AND nvl(END_DATE, :17)) or FND_PROFILE.VALUE('IRC_AGENCY_NAME') is null) AND PSA.LOOKUP_TYPE(+) = 'IRC_PROFESSIONAL_AREA' AND VSC.PROFESSIONAL_AREA = PSA.LOOKUP_CODE(+) ORDER BY Vac.NAME*

  • How  to   find  article based  support  for  ipad  or  technical notes

    how  to   find  article based  support  for  ipad  or  technical notes

    The problem comes from VBUK/VBUP which are the control tables for most of SD tables (from VBAK/P to LIKP/PS and VBRK/P) and manage uniqueness of id in the module (and stores statuses). Even item tables don't refer to their header but both refer to the same VBUK record.
    e.g.
    LIPS : VBELN/POSNR -> VBUK/VBUP -> but you will only find LIKP/PS itself and no record in VBAK/VBAP
    LIPS : VBELV/POSNV -> VBUK/VBUP -> you should find VBAK/VBAP
    The table VBFA "Sales Document Flow" manages the relations from/to between two different SD documents which exist in VBUL/P and in only one other table depending on type of document. (Also note that the exact relationship may sometimes be modified to some extent by Customizing SD.)
    As Katan wrote, look for views defined in ddic, look also at logical databases (SE36) like VLV.
    You can also find valuable information in OSS notes/documents like 185530 - Performance: Customer developments in SD.
    Regards,
    Raymond

  • IP Job in BW finished, but how can I check the IDoc receive status in BW ?

    Hi,experts
    After I execute a Infopackage with loading more than 200000 records data, the infopackage monitor show me yellow light, 186020 from 200000 records. this infomation still show me till now, seaval hours,it looks pause here.
    And I check the request in the R/3, the Job has finished. as you know it means the R/3 push the IDoc already finished.
    and how can I do now ? or how can I check the IDoc receive status in BW side?

    Hi,
    I too had the same problem, i executed the following to solve the proble, may be this will help you:
    1) Go to T-code SM58 and select TRFC and press F6,
    2) For manual push of I-Docs, GO to T-COde BD87 select perticular idoc and see the status if it is not executed properly then do the manual push by pressing Execute option,
    Thanks,

  • How to set the message in the status bar...

    hai,
    how to set the message in the status bar...
    let us say "inserted data successfully, or opening page followed  by the link clicked on the screen....."
    kindly help me out

    sunil,
    do not use advise by Ashutosh with WebDynpro.
    Instead of placing message into browser status bar (and browser is not the only WD UI agent), use IWDMessageManager API to post messages of such kind:
    wdComponentAPI.getMessageManager().reportSucces("Record inserted"); 
    VS

Maybe you are looking for