Most recent date (UDATE) from CDHDR table based on CDPOS
Hi,
I am working on one object where i stuck with one issue. The requirement is I have to retrieve the most recent date from CDHDR table based on CHANGENR in CDPOS table. Where i am doing FOR ALL ENTRIES on CDPOS table to get the MAX( date )and i got the error, that aggregate functions are not allowed except COUNT( * ) with for all entries.
Any thread which can solve this issue would help aswel.
Please guide me how to achieve this. <removed>
Edited by: Thomas Zloch on Mar 13, 2010 9:10 PM
Hi Li,
Thats was really helpful information , infact my requirement is same as what you said. I even checked in the table entries there is only one changenumber.
You said we can take the first record, i even did the same. But for TABNAME I have to pass 3 table name 'LFA1', 'LFB1' and 'LFM1'. For FNAME 'LOEVM', 'SPERR'. I have written the code as below.
SELECT objectclas
objectid
changenr
FROM cdpos
INTO TABLE i_cdpos_a1
FOR ALL ENTRIES IN i_lfabm1
WHERE objectclas = c_kred "KRED
AND objectid EQ i_lfabm1-objectid "Lifnr
AND ( tabname EQ c_lfa1 OR tabname EQ c_lfb1 OR tabname EQ c_lfm1 ) "LFA1, LFB1 and LFM1
AND ( fname EQ c_loevm OR fname OR fname EQ c_sperr ) "LOEVM, SPERR
AND value_new EQ c_x.
IF sy-subrc EQ c_0.
IF i_cdpos_a1[] IS NOT INITIAL.
Select UDATE from CDHDR based on CHANGENR in CDPOS.
SELECT objectclas
objectid
changenr
udate
FROM cdhdr
INTO TABLE i_cdhdr_a1
FOR ALL ENTRIES IN i_cdpos_a1
WHERE objectclas = c_kred "KRED
AND objectid EQ i_lfabm1-objectid "Lifnr
AND changenr EQ i_cdpos_a1-changenr. "(this is coming from CDPOS above selection)
Here i got UDATE which have all the dates from 3 tables. I have to display in the output the field value (X) of LOEVM and UDATE for LFA1, SPERR value and UDATE for LFA1.Same way for other two tables, I have to display the UDATE and its field value (X). Where UDATE should be most recent date respectively.
How can I populate the Recent date (UDATE) from one interal table for indvidual field values and table names.
Similar Messages
-
How to fetch data from CDHDR Table based on Order Number
Hi,
I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
PARAMETER : S_OBJECT FOR /BEV1/RBVBAK-AUFNR OBLIGATORY.
DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
WA_CDHDR LIKE LINE OF IT_CDHDR,
S_OBJECT1 LIKE CDHDR-OBJECTID.
CONCATENATE sy-mandt '30' S_OBJECT INTO S_OBJECT1.
SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.P838355 wrote:>
> Hi,
> I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
>
> HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
>
>
> PARAMETER : S_OBJECT FOR /BEV1/RBVBAK-AUFNR OBLIGATORY.
>
> DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
> WA_CDHDR LIKE LINE OF IT_CDHDR,
> S_OBJECT1 LIKE CDHDR-OBJECTID.
>
> CONCATENATE sy-mandt '30' S_OBJECT INTO S_OBJECT1.
>
> SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.
You need to loop through the select option and concatenate with required data then select using 'in' instead of equal or select one by one.
or
select sales order numbers from VBAK for the selection into internal table then loop through the internal table and concatenate then select from CDHDR.
for better performance use objectclass in where clause. the value for sales order for objectclass is VERKBELEG.
in my system the object id is just an order number there is no other additions to it but in CDPOS the tabkey contains the order number with client and other information also.
the 30 may be your item number... check it
go ahead and change sales order and see what you can find in CDHDR
Good luck
Edited by: Sampath Kumar on Oct 21, 2009 9:02 AM -
Most recent data first in table view
I am adding values to a display table like in the example, but I want the top row to be the newest data for the user to see.
It keeps adding to the bottom, and then the user would have to scrolll down to see all the data. Can I select somehow the most recent data or get the table to auto scroll as data is applied? I have tried shift registers as well but no luck.
Here is my VI
Thanks
Mike
Solved!
Go to Solution.
Attachments:
BasicTableExample.vi 11 KBBe aware that if you populate the table with a lot of data, its performance will get very slow. You can work around this issue by only writing data to the table which the table is actually displaying. To do this, you will need to use a scroll bar separate from the main table and the event structure to capture events. If you run into this issue, let us know so we can provide some sample code.
This account is no longer active. Contact ShadesOfGray for current posts and information. -
How do I get the numbers ipad app to plot a graph of dates against values, where the most recent date is on the right of the graph, but the most recent date is at the top rather than bottom of the rows in the table?
Also how can it be a line graph without plotting a circle at each value?
Thanks this is very frustratingMake a copy of the table and produce your Line chart or Bar chart from the copy. Sort the copy into the order you want to see in your chart.
Alternately you could use a Scatter Chart...
Jerry -
Need to fetch value from a table based on data range
Hello there,
I was hoping that the community could give me a hand with this little puzzle I got.
I am currently creating a Time Dimension for a data wharehouse, and I have the requirement to populate a column named SEASON (e.g: Summer, Winter, Spring, Autumn) for each date row. So for the 20/Dec/2013, the Season column must say Winter.
Here is now my Time Dimension table looks like, without the Season information (which I yet have to load):
DimTime Table
TIMEID
FULLDATE
YEAR
SEASON
MONTH
MONTHDAY
WEEK
WEEKDAY
274
02-MAR-10
2010
3
2
9
2
275
03-MAR-10
2010
3
3
9
3
276
04-MAR-10
2010
3
4
9
4
277
05-MAR-10
2010
3
5
9
5
278
06-MAR-10
2010
3
6
9
6
279
07-MAR-10
2010
3
7
9
7
This entire table is being populated using Oracle functions to manipulate a date field from another table, named PDATE:
My ETL Code
INSERT INTO DimTime(timeid, fulldate, year, month, monthday, week, weekday)
SELECT tim_seq.NEXTVAL, pdate, year, month, monthday, week, weekday
FROM (SELECT DISTINCT pdate, EXTRACT(year from pdate) year, EXTRACT(month from pdate) month,
EXTRACT(day FROM pdate) monthday, to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
TO_CHAR(pdate, 'D') weekday
FROM Performance PER
ORDER BY pdate);
NOTE: Code considers the table DimTime to be truncated every time it loads (i.e.: I don't need to consider additional loads).
As you can see, Season wasn't populated. Since the solstices and equinoxes vary for each year, I can't just say that Summer start at a given date (e.g: 21 of June) because one year it could be the 19/Jun, another the 22/Jun, etc. So in order to solve this problem, I have a table named Season which defines the START and END dates for the seasons:
Season Table
SEASON#
SEASONNAME
YEAR
DATEFROM
DATETO
1
Spring
2010
01-MAR-10
30-MAY-10
2
Summer
2010
31-MAY-10
29-AUG-10
3
Autumn
2010
30-AUG-10
28-NOV-10
4
Winter
2010
29-NOV-10
27-FEB-11
5
Spring
2011
28-FEB-11
29-MAY-11
6
Summer
2011
30-MAY-11
28-AUG-11
7
Autumn
2011
29-AUG-11
27-NOV-11
8
Winter
2011
28-NOV-11
26-FEB-12
9
Winter
2009
30-NOV-09
28-FEB-10
This is the bit I don't know how to do. How can I make sure that I populate the correct Season in my DimTime table based on the season specified in the Season table?
Thanks in advance for your help!
Regards,
P.Just join to table Season:
INSERT
INTO DimTime(
timeid,
fulldate,
year,
month,
monthday,
week,
weekday,
seasonname
SELECT tim_seq.NEXTVAL,
pdate,
year,
month,
monthday,
week,
weekday
FROM (
SELECT DISTINCT pdate,
EXTRACT(year from pdate) year,
EXTRACT(month from pdate) month,
EXTRACT(day FROM pdate) monthday,
to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
TO_CHAR(pdate,'D') weekday,
seasonname
FROM Performance PER,
season
WHERE pdate between datefrom and dateto
SY. -
Deletion of bookmarks from RSWR_DATA table based on 'Last access' date
We want to delete the 7.X bookmarks from RSWR_DATA table based on Last accessed date. The program RSWR_BOOKMARK_REORG does not provide the selection criteria to delete the bookmarks based on last accessed date.
Is there any alternative program that deletes bookmarks from RSWR_DATA table based on last accessed date?
Please advice.We want to delete the 7.X bookmarks from RSWR_DATA table based on Last accessed date. The program RSWR_BOOKMARK_REORG does not provide the selection criteria to delete the bookmarks based on last accessed date.
Is there any alternative program that deletes bookmarks from RSWR_DATA table based on last accessed date?
Please advice. -
Hello!
I have an order header record with a order line detail table.
ORDERS
OrderID > 1
ORDER_LINES
orderID1, line1, item1, date_due
1,1,ITEM1,01-MAR-07
1,2,ITEM2,15-MAR-07
1,3,ITEM3,01-ARP-07
I want to select the single next most recent date from order_lines where the date_due is the next future date closest to sysdate. There could also be several lines with dates beyond that, but I'm only interested in the next most recent line.
For the example above, if sysdate = 03-MAR-07 the query would return order 1, line 2 (with the date of 15-mar-07).
I've seen example in the forum with max(), however as pointed out, there could be several future line dates out there, I'm only interested in the next one from the current sysdate.
In addition there could be no lines at all that map to the order id, requiring a NLV type of test output.
Thanks!Maybe like this?
SQL> select * from order_lines;
ORDERID1 LINE1 ITEM1 DATE_DUE
1 1 ITEM1 01-MAR-2007
1 2 ITEM2 15-MAR-2007
1 3 ITEM3 01-APR-2007
SQL> select *
2 from
3 (
4 select ol.*
5 ,dense_rank() over (partition by orderid1 order by date_due) dr
6 from order_lines ol
7 where date_due > trunc(sysdate)
8 )
9 where dr = 1;
ORDERID1 LINE1 ITEM1 DATE_DUE DR
1 2 ITEM2 15-MAR-2007 1 -
Performance Tunning- data extraction from FMGLFLEXA table
Hi,
Need to fetch data from FMGLFLEXA table based on below condtion.
WHERE rfund IN s_rfund
AND rgrant_nbr IN s_rgnbr
AND rbusa IN s_rbusa
AND budat LE v_hbudat.
Please tell me how can i optimize this extaraction b'coz in production system there are lacks of records.
Regards,
Shweta.create a index on these fields due to which data extraction from table will be fast.
-
Select most recent DATE for an ID.
Hi All,
I need to SELECT the records with the most recent DATE for each ID. A DATE range is part of the selection criteria.
My data.
MY_ID MY_DATE
1684662 26-JAN-09
1424097 27-JAN-09
1684663 27-JAN-09
1684664 27-JAN-09
1684672 28-JAN-09
0689073 28-JAN-09
1052476 21-JAN-09
1052476 21-JAN-09
1360828 23-JAN-09
1684661 23-JAN-09
1052476 30-JAN-09
1052476 30-JAN-09
1052476 30-JAN-09
1052476 30-JAN-09
The code below works fine when selecting 1 ID in the SUBSELECT, but with multiple ID it still selects rownum=1 (of course). This as far as my thinking takes me.
SELECT my_id,
my_date
FROM
(SELECT my_id,
my_date
FROM my_table
ORDER BY my_date DESC
WHERE rownum = 1
AND *{color:#ff0000}my_id = 1052476{color}*
AND TO_CHAR(my_date,'YYYY/MM/DD') BETWEEN '2009/01/01' AND '2009/01/31';
If I could somehow pass the SELECT ID into the SUBSELECT WHERE clause I should have this done.
Any suggestions?
Thank You in Advance for Your help,
LouOne of many possible soultions.
ME_XE?with data as
2 (
3 select 1684662 as id, to_date('26-JAN-09','dd-mon-yyyy') as the_date from dual union all
4 select 1424097 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
5 select 1684663 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
6 select 1684664 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
7 select 1684672 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
8 select 0689073 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
9 select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
10 select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
11 select 1360828 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
12 select 1684661 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
13 select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
14 select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
15 select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
16 select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual
17 )
18 select id, the_date
19 from
20 (
21 select id, the_date, max(the_date) over (partition by id) as max_the_date
22 from data
23 )
24 where the_date = max_the_date;
ID THE_DATE
689073 28-JAN-0009 12 00:00
1052476 30-JAN-0009 12 00:00
1052476 30-JAN-0009 12 00:00
1052476 30-JAN-0009 12 00:00
1052476 30-JAN-0009 12 00:00
1360828 23-JAN-0009 12 00:00
1424097 27-JAN-0009 12 00:00
1684661 23-JAN-0009 12 00:00
1684662 26-JAN-0009 12 00:00
1684663 27-JAN-0009 12 00:00
1684664 27-JAN-0009 12 00:00
ID THE_DATE
1684672 28-JAN-0009 12 00:00
12 rows selected.
Elapsed: 00:00:00.03 -
Most recent date with two other conditions met
Ok, so I'm sure somebody is going to suggest that I do a search first before posting on here. So let me assure you, that I have exhausted all search possibilities that I could possibly think of before registering to post on here. I've read a lot of good suggestions that got me just as far as I was getting on my own, because I couldn't find any posts of somebody asking exactly what I'm looking to do. I have tried quite close to 100 different formulas without achieving the desired results.
I'm a pilot, and I track all of my flights myself in a very well organized(I think so ) Numbers spreadsheet that I've been tweaking and perfecting over the past few years. I have created plenty of formulas in it, and they all work great...except ONE.
I've created a simplified version of the columns I am trying to match specific conditions with. Essentially, I need the formula to return the most recent date(column 1), that is completed during a night time flight status(column 2), that is equal to or greater than 1.0 flight hours(column 3).
As you can see, by evaluating the table below, the correct formula should return to me: 8-4-13
The closest I've come to getting the correct results was with a "LOOKUP" formula, but I could not figure out how to get it to properly assess whether it was equal to or greater than 1.0 hours of flight, thus returning me the wrong date EVERYTIME(the most recent night flight period).
I'm sure I've gotten close at least a few times, but I need some help getting this final formula figured out. I really appreciate anybody's input on this.
Date
Flight Status
Flight Hours
8-1-13
D
2.4
8-2-13
N
3.0
8-3-13
N
1.1
8-4-13
N
1.3
8-5-13
D
2.2
8-6-13
N
0.5
8-7-13
D
1.1This may work and requires and extra column in your Data entry table (the one you provided in your post). You can hide this new column.
D2=IF(AND(C2>=1, B2="N"), A2, "")
select D2 and fill down as needed.
The table on the right is a summary table and is set up as follows:
B2=MAX(Data :: D)
I hope this is helpful -
Most recent date query..
Hi All..
I have 2 tables note and sub_note and sample data is..
create table note(note_date date,pmry_id number,sub_id number not null)
insert into note(note_date,pmry_id,sub_id) values('12/30/2008 02:12:52',282,1)
insert into note(note_date,pmry_id,sub_id) values('12/23/2008 10:12:24',282,1)
insert into note(note_date,pmry_id,sub_id) values('12/22/2008 01:12:11',282,1)
insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:56',282,1)
insert into note(note_date,pmry_id,sub_id) values('12/19/2008 01:12:54',282,1)
insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:56',282,2)
insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:57',282,2)
create table sub_note(sub_id number not null,sub_name varchar2(100))
insert into sub_note(sub_id,sub_name) values(1,'Product')
insert into sub_note(sub_id,sub_name) values(2,'Expectations')how can select the most recent date for product and most recent date for expectations...joining these 2 tables..
Thanks in advance...user10280715 wrote:
Thanks for the reply...
that was only a sample data..so I kept 2 sub_names for a perticular pmry_id..my original data contains several sub_names(about 5) for a perticular pmry_id...
hope you gt my point..I'm not sure I understand.
If you have 5 sub_names that you're interested in, change the WHERE clause to have those 5 sub_names. The list after "IN" can have as few as 1 or as many as 1000 items. (I'm not too sure about the upper limit, and it may be version-dependent.)
If you want to include all sub_names, then omit the WHERE clause. -
Selecting row by most recent date
I'm attempting to select a row where the time ends in :00 and
date is the most recent date or just the last record where time
ends in :00, either will do.
Once I have that record selected I need to query that query
to pull in the previous 3 records which will be times ending in
:15, :30 and :45 to round out that full hour of data for
processing.
It seems to me that this should be pretty easy but my CF
books are not helping me here.
Any Ideas?Two things I do to make this sort of thing easier are:
1. Take baby steps. Start with one field and the date field.
Once you get that to work, add one or two fields at at time.
2. Comma control. This structure helps prevent extra commas
from slipping into your query.
select field1
, field2
, date
from yourtable join (
select field1 f1
, field2 f2
, max(datefield) maxdate)
from yourtable
where something
group by field1
, field2
) temp on field1 = f1 etc
where clause -
Value Set whose Data come from customize table with distinct record
Dear All,
I am new in Oracle EBS, currently i am creating value set whose data come from customize table which have 40 duplicate record in which distinct column return 27 record .
Table XX_ROUND_SET
Columns (Transactions_id,set_record)
Total Record (40)
Distinct Record (Set_Record --> 27)
I just want to show only 27 record in it.
Thanks
RehanHi Rehan,
PL.IGNORE MY EARLIER UPDATE AND TREAT THIS UPDATE AS YOUR SOLUTION.
Method 1
Create the VIEW based on DISTINCT values; use the VIEW for creates the VALUESET.
Method 2
Paste the QUERY in TABLE field with alias name, and give the column name (with alias name).
(in your case )
TABLE NAME : ( select distinct transactions_id, set_record from XX_ROUND_SET ) Y
VALUE : Y.transactions_id
HTH
Sanjay -
Removing the "sort by: most recent" default option from my purchased items.
Is there a way to remove the "sort by: most recent" default option from my purchased items? It annoys me to see items that are not ordered alphabetically or by release date so I do not want there to be a record of this.
See:
* https://support.mozilla.com/en-US/kb/Resetting%20preferences -
TS3899 iOS 7: sort email by most recent date? Beyond frustrating.
iOS 7: sort email by most recent date? Beyond frustrating.
Agree. Mail search results are nearly useless, sorted in effectively random order. Major Apple FAIL.
Removing the other search buttons (from, subject, etc.) is also frustrating. Went from one-click simplicity to having to type in 'from:'. Serious inconvenience. Completely failed the WWSS (What would Steve Say?) test.
Maybe you are looking for
-
I am on the road and in some cases have to pay for internet privileges. I can receive mail and surf the internet with Safari. But I cannot send any mail and get the error message. The clerk at the motel here says to change the outgoing mail server to
-
Two Mac's, Two iPods, one iTunes Library
I have a MacBook Pro with an extensive iTunes library that I like to call the master library. I also have an iMac that I use at home. My wife continually hounds me to update her iPod with new music and I have to do it because I keep the music library
-
Can at link my iPad to my computer like an apple tv?
Is there an application that will allow me to stream movies or music from my iTunes library on my computer to my iPad over WiFi? It would be like AppleTV for your iPad. Thanks
-
Can we make this query shorter....?
hi there Can any body help me in reducing the number of lines in this query ! I am using union to concat 3 queries. Select fields in every query are same and in where condition also most of the joins are same in every query. but in where clause only
-
After actualizing to 6.0.1 version; the start buttom no longer works; the only way I have to start the Ipad is to hook up the charging cable; How can I get the start buttom to work again to turn in or off mu Ipad 2 regards, Luis