Finding greatest value of date in a table
Hi experts,
I have many dates in an internal table.How to find min and max dates of these.
Is there any FM or i have to write logic.
Please help.
Krishan
Hi Krishan,
Adding to pavan ans....
SORT itab BY date.
DESCRIBE TABLE itab LINES l_lines. "Get total number of lines in itab.
READ TABLE itab INTO wa INDEX 1 TRANSPORTING date. "Read first entry
Here wa-date have Min date value.
READ TABLE itab INTO wa INDEX l_lines TRANSPORTING date. "Read last entry
Here wa-date Have Max date value.
Thanks,
Vinod.
Similar Messages
-
How to find the structure fields data in database tables?
how to find the structure fields data in database tables?
Your question doesn't appear to be Web Dynpro ABAP related. Please only post questions in this forum if they are directly Web Dynpro ABAP related. There are several other more general ABAP related forums.
-
Query to find the second maximum date in a table
please give me the query to find the second maximum date in a table
You can try with this
SELECT empno
,hiredate
FROM emp a
WHERE 2 = (SELECT COUNT(DISTINCT hiredate)
FROM emp b
WHERE b.hiredate >= a.hiredate
OR
SELECT empno
,hiredate
FROM (SELECT ROWNUM row_num
,empno
,hiredate
FROM emp a
ORDER BY hiredate ASC
WHERE row_num = 2;Regards
Arun -
Can not find product , sku attributes data in database table
Hi there,
I find it really strange to find data in database related to product and sku. I set up the commerce reference store and store is up and running fine. Catalog is fine too. I am not able to find data related to sku attributes in database.
I have a product_id xprod2511 which has 11 child skus such as xsku2511_1, xsku2511_2 and so on. sku xsku2511_1 is blue color and size 4. When I search for this two sku attributes (color and size) information in dcs_sku_attr table with sku_id as xsku2511_1, no rows returned. In fact, I looked into few other sku tables but I am not able to find the information about color and size of a sku in any database table.
this is the query I am running:
select * from dcs_sku_attr where sku_id = 'xsku2511_1'
Can someone please let me know the table name where this information regarding color and size resides in?
Thanks a lot.In dyn/admin If you try and view the definition file of ProductCatalog repository, then under sku item descriptor you would see the color and size property which would be under some table tag, that table tag table name should be the table holding these values.
the other question(may be silly) is that I hope that you are executing sql in correct schema, that is cata or catb schema (select * from catA.dcs_sku_attr) where the actual product catalog data resides. -
How to find the value of date char used as exception aggregation reference
Hi BI Gurus,
On a BEx report I need to list three things by material:
1) the open (not yet delivered) Purchase Order quantities
2) the PO quantity to be delivered next and
3) the date that belongs to the next delivery
The model supports these data i.e. for each material I can list all open quantities by Purchase Order / Item / Schedule line and the scheduled delivery dates are also available as a characteristic.
Determining 1) is easy as the drilldown is fixed (materials only) the open quantities get summarized for all PO-s belonging to the materials.
To determine 2) I used a Calculated KF simply including KF 1) =Open PO Qty in the definition and setting Exception Aggregation (first value) with a reference char of the delivery date. This gives back the Open PO Quantity to be delivered first.
My question is about how to determine the 3rd value (actually this is not a KPI but a characteristic value). In other words, for each materials I would need to determine the first among all of the possible delivery date char values of the open PO Items / schedule lines. This is the date the quantity shown in the 2nd KPI will be delivered on.
Does anybody have an idea how to approach this issue?
Thanks for you help in advance,
AttilaHi Olivier,
Thanks for your suggestion. I got a bit closer with the replacement path formula variable and the CKF. I tried to apply the same logic of KPI 2) but for some reason it did not work. Actually, it delivers the right value but only when 0SCL_DELDAT (Scheduled delivery date) is in the drilldown But what I need is the first delivery date by Material only, and without this 0SCL_DELDAT drilldown.
Any other ideas?
Thanks and bye,
Attila -
Bug: "Paste Special: Value" overwrites data hidden with Table filters
I've noticed the following....
Create a sheet with the values below and enable the "Filter" option on this table.
(I've added the row-numbers on the left, to later show the filter in action)
(1) col1
col2
(2) a 1
(3) a 2
(4) a 3
Using the filter option on the col2 column, unmark value "2".
This is an essential step, since the bug only appears when hiding rows -in between- of other rows.
Hiding 1 or 3 will not have the same result.
You table should now look like this. Notice row (3) is hidden, as it should be:
(1) col1
col2
(2) a 1
(4) a 3
Now type "b" in a random empty cell, select the cell (not the value), and copy it.
Now, and this is an essential step, click down on the "a" value on row (2), keeping your mouse pressed, drag to the "a" value on row (4), so that both cells are selected with one selection box, not two separate boxes.
Within this selection box, right-mouse click, and select "Paste Special -> Values" NOT "Paste Special -> Paste".
Now use the filter to unhide value "2". You table should/will look like this:
(1) col1
col2
(2) b 1
(3) b 2
(4) b 3
This is -not- the expected behavious, when using "Paste Special -> Paste", the result is
as expected:
(1) col1 col2
(2) b 1
(3) a 2
(4) b 3
This issue is also present in Excel 2010, and i've tested this on various computers.Tested in Excel 2013, it also happens there.
-
How to find out the NULL columns in the table?
Hi,
Please provide the query to find the null columns in the table. Here, all rows in the table have same column as null. It won't change.
Table
c1 c2 c3 c4
X C 10
T D 20
I wanna find out as C2 is the nullable column.
Thanks in advance !!
Regards,
Vissu....Below code might be solution for finding NULL valued in columns in a table and if it is solution .kindly give me points for the same.
declare
cursor col_cur is
select column_name
from user_tab_cols -- all_tables can also be used in case the table is present in own schema
where table_name = 'TABLE_NAME'; --provide the TABLE_NAME
stmt varchar2(1000):= '';
v_count number;
count_null number;
begin
execute immediate 'select count(*) from TABLE_NAME' into v_count; --provide the TABLE_NAME
for rec in col_cur loop
execute immediate 'select count(*) from TABLE_NAME' where --provide the TABLE_NAME
'||rec.column_name||' IS NULL' into count_null;
if count_null = v_count then
stmt :=stmt|| rec.column_name ||chr(13);
end if;
end loop;
dbms_output.put_line(stmt);
end ; -
Convert Creationtime column to date format in table cwsys.cw_workspaces_tab
How to convert the creationtime column value to date in the table cwsys.cw_workspaces_table using sql or otherwise.
-TarunI'm pretty interested in this one as several reports can be created using this field, any inside help??
-
Unable to find data in s677 table
Hi I had maintained planned data in md63 for month 1-5 of 2012 but unable to find it in table s677, help.
Hi Allen,
Referring to replies:
1. You entered values directly in MD63
2. No updates in table-S677 or PBIM.
Let me clarify few things.
SIS-S677 is custom info structure (Not a standard SIS) designed to your requirement. That means you're working on S&OP Flexible Planning module.
So as a prerequisite to this module you must maintain below mix of Config & master data:
1. Sales Info Structure i.e. S677 with update groups & rules. To capture any sales history.
2. Planning Type: It's config and Planning type defines the content and the layout of the lines in the planning table.
3. Planning hierarchy: It's a Master data and is a combination of characteristic values based on the characteristics of one information structure.
4. Planning Table: It's the place where a Planning is done.
After all above set-up, you would be able to enter in Planning Table for planning the products.
Steps for Planning/Forecasting:
1. Based on your SIS Update groups & Rules, a S677 will be updated with sales quantities with Version-00 and same will be used to calculate forecast.
2. Using forecast model setup, a forecasting can be run in Planning Table for a particular product.
3. Forecast/planning values then will be saved in Planning Table. Once you save these values & come out of Planning Table, these values will be updated in S677 with version-A00.
4. Then you need to transfer Forecast/Planning values to Demand Management from Planning Table.
5. Check if values can be seen in Demand Management (MD63). If yes, a seperate SAP standard table-PBIM, PBHI etc. will be updated. These values in MD63 are called as Planned Ind Requirement (PIR).
6. Once PIR can be seen in MD63, you can run MRP Run.
7. Once MRP finished, you can go-ahead with further processing.
This is how the complete scenario is. Check if it's okay and then revert if any further issue.
Regards,
Anup -
Numbers Question, Finding Values In Multiple Sheets and Tables
I would like for a cell to be looking at all sheets, and calculate the Debt 1 or Debt 2 allocated funds. It would need to find the word, Debt 1 and take the number two cells to the right...I have attached a document to my webpage...
http://web.me.com/chris.ducasse/Forum/ForumBlog/Entries/2010/1/12009_Bi-Weekly_Budgets_ForForums.htmlHello
Working on the OP's document, I discovered a surprising odd behaviour.
In a table I grab datas from other tables using VLOOKUP.
The formula is :
=IFERROR(VLOOKUP(A$1,INDIRECT("Outgo "&ROW()&" :: A:C"),3,FALSE),0)
The cell in B1 grabs a value from table Outgo 1
The cell in B2 grabs a value from table Outgo 2
As the OP named its first table Outgo, when I named it Outgo 1,
I decided to edit the formula in cell B1. It becomes ::
=IFERROR(VLOOKUP(A$1,INDIRECT("Outgo :: A:C"),3,FALSE),0)
The funny behaviour is that in a sheet where there is no Outgo table (I had the "Outgo 1" one),
the formula continue to return the value grabbed from the table "Outgo 1".
For see, I renamed "Outgo 1" as "Outgo 3" with a different numerical value.
The formula referencing "Outgo" continue to return the value which was in "Outgo 1"
Continuing to play with this problem.
I edited the formula as:
=IFERROR(VLOOKUP(A$1,INDIRECT("Outgo 3 :: A:C"),3,FALSE),0)
Bingo, it grabbed the value from the true Outgo 3 table.
One more time I edited the formula as:
=IFERROR(VLOOKUP(A$1,INDIRECT("Outgo :: A:C"),3,FALSE),0)
Son of a …, it gives again the value which was in the now unavailable table "Outgo 1".
I guess that it grabs it from the undo buffer but it's absolutely foolish.
Serious smelling of bug but I wish to know if you get the same behaviour in other machines (maybe something is odd on mine).
Happily, there is a way to get rid of this odd behaviour :
cut the entire formula
press return
The cell is now empty.
Select it then paste.
The pasted formula will have a correct behaviour.
Yvan KOENIG (VALLAURIS, France) samedi 2 janvier 2010 16:37:16 -
I don't even know if this is posible.
I'm using iwork '09
View PDFI hope I can clarify:
For our purposes here:
Table 1 = "Step 2 - Product Sizes"
Table 2 = "Option id Master"
Table 3 = "Export - Product Info"
Table 1:
The user would enter values for "productcode," "Horz," and "Vert"
"Size" would auto fill based on values in Horiz and Vert (I have this taken care of already).
Table 2: This is a completely static table that I want to search against. - Data from other tables in the doc does not alter or change the data in this doc.
We just want to look at table 2. Find the existing value in "table 2 : size" column that matches the "table 1 : size" column and then pull the "optionids" and "productprice" from that row.
Can the value from "Table 1 : Size" be used as a search term in "Table 2 : Size?"
Table 3: The user does not enter any values on this table.
"productcode" is pulled from table 1 - "Table 1 :: A5" = "Table 3 :: A5"
"optionids" and "productprice" are pulled from Table 2 columns "D" and "E" - however we do not know which Table 2 row it is pulling from until we enter data in Table 1.
As I'm writing this I'm realizing that
A. this is probably really confusing to you.
B. this may be impossible inside of numbers.
If you have some other method that would facilitate the same out come but be structured differently please let me know.
--- maybe to help you understand further what I am doing here is my current workflow:
I record the size of a piece of art.
Then I manually go to my "Option id Master" and find the same size.
I then copy the corresponding "optionids" and "productprice" cells. (these options control the prices displayed on my website)
I got to my "Export - Product Info" table and paste the values in the corresponding cells.
I was hoping to automate this as it takes a long time when you have hundreds of products.
Thanks for the help! -
Find gap between two dates from table
Hello All,
I want to find gap between two dates ,if there is no gap between two dates then it should return min(eff_dt) and max(end_dt) value
suppose below data in my item table
item_id eff_dt end_dt
10 20-jun-2012 25-jun-2012
10 26-jun-2012 28-jun-2012 There is no gap between two rows for item 10 then it should return rows like
item_id eff_dt end_dt
10 20-jun-2012 28-jun-2012
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012 There is gap between two rows for item 12 then it should return like
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012
I hv tried using below query but it giv null value for last row
SELECT item_id, eff_dt, end_dt, end_dt + 1 AS newd,
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id) AS LEAD,
(CASE
WHEN (end_dt + 1) =
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id, eff_dt)
THEN '1'
ELSE '2'
END
) AS new_num
FROM item
WHERE TRIM (item_id) = '802'
ORDER BY ctry_code, co_code, item_id, eff_dtI m using oracle 10g.
please any help is appreciate.
Thanks.Use start of group method:
with sample_table as (
select 10 item_id,date '2012-6-20' start_dt,date '2012-6-25' end_dt from dual union all
select 10,date '2012-6-26',date '2012-6-26' from dual
select item_id,
min(start_dt) start_dt,
max(end_dt) end_dt
from (
select item_id,
start_dt,
end_dt,
sum(start_of_group) over(partition by item_id order by start_dt) grp
from (
select item_id,
start_dt,
end_dt,
case lag(end_dt) over(partition by item_id order by start_dt)
when start_dt - 1 then 0
else 1
end start_of_group
from sample_table
group by item_id,
grp
order by item_id,
grp
ITEM_ID START_DT END_DT
10 20-JUN-12 26-JUN-12
SQL> SY. -
I wish to insert data into a table only when the value of the inserted data has changed. Thus, in a time series, if the value of the data at time, t-1, is 206 then if the data to be inserted at time t is 206, then it is skipped (not entered).
If the value of the data at time t+1 is 206, it is skipped also; until the value changes, so if the value at t+1 was 205, then that would be inserted, and if at time t+2 the data is 206, it would be inserted too.
What is the best way to do it without increasing overheads?This view works:
SELECT
i.IDNO,i.[Date],i.[Level]
FROM
mytable i
INNER
JOIN mytable
d
ON
d.IDNO
= i.IDNO-1
WHERE
i.[Level]
<> d.[Level]
on this mytable below. A trigger could be quite useful here although I am cautious using them. However I wish to avoid the overhead by not having a temp table (which could be sizable). mytable below
should give 3 lines. The IDNO is an identity column.
IDNO
Item
Date
Level
1
X24
12/23/13 10:41
22996
2
X24
12/23/13 10:41
22996
3
X24
12/23/13 9:21
23256
4
X24
12/23/13 9:21
23256
5
X24
12/23/13 9:22
23256
6
X24
12/23/13 9:22
23256
7
X24
12/23/13 9:22
22916 -
To stop Running the Report when we dont find data in the table
I am running a 6i report and this report fetches data from custom table.
I need to check whether data exists in the custom table in the After parameter form and if doesnt return any data then i need to Stop the report execution and write a message without raising any exceptions or errors
note: we tried with srw.program_abort ---- it stops the report but it returns an exception
ThanksHere the tricky is
if we don't have last month data we should not go the data model. The data model query will run regardless the previous month data.
we are trying to find the previous month data in after parameter form. if it is not there we want to stop the report there itself it should not go to layouut or data model.
how to achive this one?
we try to terminate the report through program_abort but it is raising an exception -
How to find data's from table whose sum=given input.
Hi all,
how to find values whose sum=given value.
i have a master. table
master table
name amount
a 1000
b 6000
c 2000
d 1500
input amount=4500 (may change);
how to get name from master table whose sum(amount)=4500;
i.e) a,c,d as output.Hi,
I realy like the approach you made.
But it is not realy scalable, as you probably know already.
I tried the following:
WITH
master_table as
select 'a' name, 1000 amount from dual union all
select 'b', 700 from dual union all
select 'c', 2000 from dual union all
select 'd', 300 from dual union all
select 'e', 1000 from dual union all
select 'f', 1200 from dual union all
select 'g', 2300 from dual union all
select 'h', 500 from dual union all
select 'i', 400 from dual union all
select 'j', 600 from dual union all
select 'k', 700 from dual union all
select 'l', 400 from dual union all
select 'm', 500 from dual union all
select 'n', 600 from dual union all
select 'o', 700 from dual union all
select 'p', 800 from dual union all
select 'q', 900 from dual union all
select 'r', 1000 from dual union all
select 's', 1700 from dual union all
select 't', 1400 from dual
,got_name_list AS
SELECT LTRIM ( SYS_CONNECT_BY_PATH (name, ',')
) AS name_list
, SYS_CONNECT_BY_PATH (amount, '+') AS amount_list
FROM master_table
CONNECT BY name > PRIOR name
AND amount < :target_amount
SELECT name_list, amount_list
FROM got_name_list
WHERE XMLQUERY ( (amount_list)
RETURNING CONTENT
).getnumberval () = :target_amount
;And indead I received a solution. But it toke 788 seconds.
I think that if you want to use this with more rows you have to find a PL/SQL solution.
Regards
Peter
Maybe you are looking for
-
Firefox Add-on won't uninstall
I'm on a Vista laptop using Firefox 3.5.3. The "HP Smart Web Printing 4.05" automatically installed(or I didn't uncheck the box) and is not compatible with my version of firefox, but the option to uninstall is greyed out and not clickable. Any sugges
-
Printer friendly PDF create error
Hi. I've got a problem with generating a PDF from large over 10000 rows request. BI throw me an error A fatal error occurred while processing the request. The server responded with: Error while executing PDFRpcCall.processMessage com.siebel.analytics
-
Hi our environment CM always going down then we have to start manually,2day morning users saying they are not able to connect and they are not able to print report what could be the reasons
-
Re-installation of CS6 Design & Web Premium
Nouméa, 20/08/2014 In 2013 I have bought the CS6 Design & Web Premium Student version, in Australia I have installed it on both my desktop and old laptop. All the emails exchanged with Adobe at the time of purchase containing my licence details are o
-
I am formatting a book that makes reference to the book title in several locations (headers, title page, copyright info, etc.) but the final title has not been finalized. Is there a way to create a text field (similar to a merge field, I guess) that