Query Related findout the Monday's date
Hi All,
can you suggest me, any standard FM to findout the weekly Monday date.
Means as importing parameter i will pass any date. so i want passing parameter date week's Monday date.
Example: i pass the date 01.08.2007 then FM will return Monday date(30.07.2007).
Thanks
Amit
hi,
interested, one sulotion is you can set a reference date, for example, 30.07.2007, then you check the day intervals between this with the date you import, let it be 22.08.2007, then the day intervals is 22.08.2007 - 30.07.2007 = 23, since
23 mod 7 = 2, you know the monday is 22.08.2007 - 2 = 20.08.2007.
so all you need is to develop a form that calculate the day intervals.
Similar Messages
-
Query related to the transfer of the control to the other controller.
Hi all,
I have a query related to the transfer of the control to the other controller.
I have components A and B .From a view of component A I neeed to open a window which belong to component B.Problem is that ,if I use create_window_for_cmp_usage( ) and the open( ) method and after that there is some code,then that code is getting executed before the window is opening.
I want that the control should be back to the these code after the window is poped up and after clossing the window.
Eg
method ONACTIONOPEN_WINDOW .
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window_for_cmp_usage(
interface_view_name = 'ZHELLO_WORLD'
component_usage_name = 'USAGE_HELLO'
title =
close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
lo_window->open( ).
data a type i.
data b type i.
a = 2.
b = 3.
a = a + b.
endmethod.
In this case I am calling ONACTIONOPEN_WINDOW method.But before opening the window the a iscalculated here.I want that after popuping the window the calculations should be done .
How will I achieve this.
Thanks in advance.
Edited by: vaibhav nirmal on Nov 25, 2008 6:42 AMHi,
You will have to do your calculation as an event in your new window, or capture the closing of the new window as an event in your currenbt view and do your calculations in the event.
Regards,
Shruthi R -
Query relating to the creation of Managed Service Accounts
Hi Folks
I am studying for my 70-411 exam and have a query relating to the creation of Managed Service Accounts.
I have successfully created an MSA account named 'MSATest' on a DC using:
new-adserviceaccount -name msatest –dnshostname home-dc-01 -passthru
and
add-AdcomputerServiceAccount -identity home-ap-01 -serviceaccount msatest -passthru
However the guide that I am using now says that I now need to run: Install-ADServiceAccount on the host computer in the domain to install the MSA in order to make available it available for use by services.
So on my member server (home-ap-01) I have installed the Active Directory Module for powershell and ran:
PS C:\Users\administrator.PCECORP> Install-ADServiceAccount -Identity msatest
Install-ADServiceAccount : Cannot install service account. Error Message: 'An
unspecified error has occurred'.
At line:1 char:1
+ Install-ADServiceAccount -Identity msatest
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (msatest:String) [Install-ADServiceA
ccount], ADException
+ FullyQualifiedErrorId : InstallADServiceAccount:PerformOperation:Install
ServiceAcccountFailure,Microsoft.ActiveDirectory.Management.Commands.Insta
llADServiceAccount
PS C:\Users\administrator.PCECORP>
However this errors, Have I misunderstood the purpose of the Install-ADServiceAccount ? or am I doing something wrong?
Thanks in advance for you help.Try using -RestrictToSingleComputer parameter when creating service account with New-ADServiceAccount.
Gleb.
Hi Gleb
Thank you for your help, it is appreciated. That did the trick.
All the best. -
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 -
SQL query for making the horizontally stored data to vertical format
HI i have a table named table1 and columns and data as below like below
table1
Main sub1 sub2 sub3 sub4 sub5 sub6
A L1 T1
B L1 T1
C L2 T2 K1 T1
D L2 T2 K1 T1
Basically the data is stored in horizontal above.i want a query to make the data in vertical like below
A T1
A L1
B T1
B L1
C T1
C K1
C T2
C L2
D T1
D K1
D T2
D L2
Aslo even if the values come in sub5 and sub6 the query should handle and populate the values vertically and also if a new row added also.
Thanks a lot in advanceHi,
As usual, Hoek is absolutely correct.
There are a gazillion examples out there, but someone (I) will give you a specific answer.
Search for "pivot" or "rows to columns" and you will indeed get a gazillion hits. Unfortunately, all but a hemi-semi-demi-gazillion of them will say "There are already lots of examples out there: do a search". Perhaps [this one|http://forums.oracle.com/forums/message.jspa?messageID=3227388#3227388] can get you started.
The essential form of a pivot is:
SELECT r_val
, MIN (CASE WHEN c_val = 1 THEN d END) AS col_1
, MIN (CASE WHEN c_val = 2 THEN d END) AS col_2
, MIN (CASE WHEN c_val = n THEN d END) AS col_n
FROM table_x
GROUP BY r_val;Instead of MIN (which is probably what want) any aggregate function can be used.
This assumes you have a column r_val that indicates what row of output will contain each value. In your example, that's your first column,
It also assumes you have a column c_val that indicates what column will contain each value. In your example, what is that? Looking at the raw data, how can you tell that 'L2' will wind up in the 2nd column of 'D L2 T2 K1 T1', and not the 3rd, 4th or 5th? You may need to assign a c_val to each row (using the aggregate ROW_NUMBER function, perhaps). -
Query to get the current DB date, not server date
Hi,
We have few DB in one server, but each DB have different timezone.
How can I get the query to generate the current date in each DB?
ThanksHi,
Try this query:
SELECT DB_NAME() AS DataBaseName,getdate()
Thanks & Regards,
Nagarajan -
One record in the master Query, many in the child. Data Template Woes
Hi Folks.
Can't get my head around this and I wonder if anyone could shed some light.
I have the following simple data template set up.
<dataTemplate name="Invoice" description="Default Invoice" version="1.0">
<parameters>
<parameter name="P_INVOICE_ID" dataType="character"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[select invoice_id
from vw_invoice_summary
where invoice_id IN (:P_INVOICE_ID)]]>
</sqlStatement>
<sqlStatement name="Q2">
<![CDATA[Select invoice_line_item_id
from invoice_line_item
where invoice_id = :invoice_id]]>
</sqlStatement>
</dataQuery>
</dataTemplate>
When I set the Parameter to a valid invoice ID, I only get the following result. There should be two sets of data being returned. One set with the single parent record and the second set with roughly thirty records.
<?xml version="1.0" encoding="UTF-8" ?>
- <INVOICE>
<P_INVOICE_ID>16946</P_INVOICE_ID>
- <LIST_Q1>
- <Q1>
<INVOICE_ID>16946</INVOICE_ID>
</Q1>
</LIST_Q1>
</INVOICE>
Where is the Q2 data set? Can anyone see what I'm doing wrong? Can anyone point me to the right section of the documentation? I have read and re-read the BIP Users Guide (Section 4) but I guess I must be missing something.
Any help gratefully received.
Many thanks.
SimonHi Ike.
Quick question for you.
I have the Groups defined and my template is working well with them.
My final sticking point is the incorporation of a parameter.
My template starts like this...
<dataTemplate name="Invoice" description="Invoice">
<parameters>
<parameter name="invoiceid"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[select * from vw_invoice
where invoice_id IN(:invoiceid)]]>
</sqlStatement>
<sqlStatement name="Q2">
<![CDATA[Select.................
I am trying to call it using a SOAP Envelope containing this...
<parameterNameValues>
<item>
<name>invoiceid</name>
<multiValuesAllowed>true</multiValuesAllowed>
<values>
<item>18421,16946,19178</item>
</values>
</item>
</parameterNameValues>
The result being recorded in BIP Schedules is "Data not defined".
What am I doing wrong? Any thoughts?
Kind regards.
Simon. -
Query related to the all_tab_partitions
Hey experts ,
When I am excuting the query
{code}
SELECT partition_name, high_value
FROM all_tab_partitions
WHERE table_name = XXXXX
{code}
in the result set i can see then entry like
partition_name high_value
XXXXX_PCURRENT MAXVALUE
what is the mening of this entry ?See the Range Partitioning section of the VLDB and Partitioning guide
http://docs.oracle.com/cd/B28359_01/server.111/b32024/partition.htm
Range Partitioning
Range partitioning maps data to partitions based on ranges of values of the partitioning key that you establish for each partition. It is the most common type of partitioning and is often used with dates. For a table with a date column as the partitioning key, the January-2005 partition would contain rows with partitioning key values from 01-Jan-2005 to 31-Jan-2005.
Each partition has a VALUES LESS THAN clause, which specifies a non-inclusive upper bound for the partitions. Any values of the partitioning key equal to or higher than this literal are added to the next higher partition. All partitions, except the first, have an implicit lower bound specified by the VALUES LESS THAN clause of the previous partition.
A MAXVALUE literal can be defined for the highest partition. MAXVALUE represents a virtual infinite value that sorts higher than any other possible value for the partitioning key, including the NULL value. -
Query related to the group by rollup,cube
Hello experts,
I am not getting how the below query gets excuted ,
{code}
SELECT department_id, job_id, manager_id, SUM(salary) FROM employess GROUP BY department_id, ROLLUP(job_id), CUBE(manager_id)
{code}
can anybody simplified this plz ?
Thanks in advanceHi,
SShubhangi wrote:
Hello experts,
I am not getting how the below query gets excuted ,
{code}
SELECT department_id, job_id, manager_id, SUM(salary) FROM employess GROUP BY department_id, ROLLUP(job_id), CUBE(manager_id)
{code}
can anybody simplified this plz ?
Thanks in advance
Here's how it works.
Since the GROUP BY clause includes department_id (not modified by ROLLUP or CUBE), every row of the result set will be limited to a specific department_id.
Since the GROUP BY clause includes ROLLUP (job_id). some rows of the result set will represent a specific job_id, and some rows will be Super-Aggregate rows, representing all job_ids at the same time.
Since the GROUP BY clause includes CUBE (manager_id). some rows of the result set will represent a specific manage_id, and some rows will be super-aggregates, representing all manager_ids at the same time. (When there is only 1 expression inside the parentheses, CUBE means the same thing as ROLLUP).
Here's how it can be simplified:
GROUP BY department_id
, CUBE (job_id, manager_id)
Here's why:
Since ROLLUP (x) means the same thing as CUBE (x) - when x is a single expression - then what you posted is equivalent to
GROUP BY department_id
, CUBE (job_id)
, CUBE (manager_id)
and
GROUP BY ...
CUBE (x)
, CUBE (y)
is just a longer way of saying
GROUP BY ...
CUBE (x, y)
To understand this better, do some experiments yourself. Try different combinations of ROLLUP and CUBE, and see what results they produce.
DO NOT use the hr.employees table for your experiments; it has far too many groups for anyone to understand. Also, department_id and manager_id can be NULL, so it's hard to tell super-aggregate rows from normal aggregate rows. Even scott.emp is more complicated than necessary. I suggest you make your own table, like this:
CREATE TABLE simp_emp AS
SELECT ename
, deptno
, job
, CASE
WHEN job IN ('MANAGER', 'PRESIDENT')
THEN 'NO'
ELSE 'YES'
END AS unionized
, EXTRACT (YEAR FROM hiredate) AS hireyear
, sal
FROM scott.emp
In this table, there are only 2 possible values for unionized, 3 values for deptno, and 4 values for hireyear, and none of those colums are ever NULL. -
Findout the table name,date and time
Hi friends,
In a database i create a table, but i forgot the table name. I know the date. How can i find out the table in database?select object_name, created, status
from all_objects
where object_type = 'TABLE'
and owner = <user_name_who_created_the_table>
order by created desc;
Hope this helps.
Raman -
Query to get the max of date wrt to name
i want to retrive the maximum of the ACT_START_TM column with respect to the name
SQL> SELECT c.NAME NAME,
2 d.INAME INAME,
3 d.M MNAME,
4 d.PNAME PNAME,
5 (TO_CHAR(d.ACT_START_DT_TM,'YYYY-MM-DD HH24:MI:SS')) ACT_START_TM
6 from INS d, INSDETAIL c
7 where C.TNAME IN('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4'
8 ) AND
9 c.NAME = d.INSTRCTN_NAME AND d.TYP || '' = 'I'
10 AND d.ACT_START_DT is not null
11 AND d.ACT_START_DT < sysdate-2
12 ORDER BY ACT_START_TM DESC,TNAME DESC, INAME DESC;
NAME INAME MNAME PNAME ACT_START_TM
NULLTEST4 OI-TEST-1LEV1-0012 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 17:52:00
NULLTEST3 OI-TEST-1LEV1-0012 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 17:52:00
NULLTEST2 OI-TEST-1LEV1-0012 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 17:52:00
NULLTEST1 OI-TEST-1LEV1-0012 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 17:52:00
NULLTEST4 OI-TEST-1LEV1-0011 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 13:52:00
NULLTEST3 OI-TEST-1LEV1-0011 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 13:52:00
NULLTEST2 OI-TEST-1LEV1-0011 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 13:52:00
NULLTEST1 OI-TEST-1LEV1-0011 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-11-19 13:52:00
NULLTEST4 OI-TEST-1LEV1-0009 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-09-17 12:43:00
NULLTEST3 OI-TEST-1LEV1-0009 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-09-17 12:43:00
NULLTEST2 OI-TEST-1LEV1-0009 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-09-17 12:43:00
NULLTEST1 OI-TEST-1LEV1-0009 MODE-1-OF-1-LEVEL-EQUIPMENT-OF-1O-LVL-HI HYDROGEN 2011-09-17 12:43:00
12 rows selected.hi
iam using the ran function inside a cursor,
iam getting the below error while compilation.
procedure fetchinstrinfo ( mindate in varchar2,instrinfo in out RefCursor_fetchinstrinfo)
as
begin
open instrinfo
for
(select name,iname,mname,pname,act_start_tm
from (
select c.name name,
d.iname iname,
d.m mname,
d.pname pname,
(to_char(d.act_start_dt_tm,'yyyy-mm-dd hh24:mi:ss')) act_start_tm,
row_number() over(partition by c.name order by d.act_start_dt_tm desc) rno
from ins d, insdetail c
where c.tname in('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4')
and c.name = d.instrctn_name and d.typ || '' = 'I'
and d.act_start_dt is not null
and d.act_start_dt < mindate
where rno = 1
UNION
( select c.name name,
d.iname iname,
d.m mname,
d.pname pname,
(to_char(d.act_start_dt_tm,'yyyy-mm-dd hh24:mi:ss')) act_start_tm,
row_number() over(partition by c.name order by d.act_start_dt_tm desc) rno
from ins d, insdetail c
where c.tname in('NULLTEST1','NULLTEST2','NULLTEST3','NULLTEST4')
and c.name = d.instrctn_name and d.typ || '' = 'I'
and d.act_start_dt is not null
and d.act_start_dt <mindate)
ORDER BY ACT_START_DT_TM DESC,TRGT_NAME DESC, INSTRCTN_NAME DESC;
end fetchinstrinfo;
errors:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
continue
PLS-00103: Encountered the symbol "(" when expecting one of the following:
, from -
Need to update the actual start date & time of a operation in workorder
Hi Experts,
I need to update the Actual Start date and Actual start time of a Operation of a WorkOrder through a Function Module.
I was looking into the BAPI_ALM_ORDER_MAINTAIN FM, but i couldn't find any field relating to the actual start date and start time of a operation.
Kindly Suggest me which Function module i can use to complete my task.
Thanks in Advance
byeHi,
It is system's standard behavior and no other MRP type will help you in moving the start date outside the planning time fence. With MRP type P3 new requirements are covered at the end of the fixing period, the end date is set and planed order is scheduled backword. Hence the start date will lie within the planning time fence.
Rgds, -
Difficult Hibernate Query related to dates
Hello All,
I need help with writing a query in Hibernate.
The DDL for the table i am using is given below :-
CREATE TABLE FRENCH_BATCH_DETAILS
BATCH_ID NUMBER PK,
BATCH_STARTDATE DATE NOT NULL,
BATCH_ENDDATE DATE,
BATCH_NAME NVARCHAR2(150),
The above table stores Details of French Batches for a particular Institute.
Sample Data is given below :-
BATCH_ID BATCH_STARTDATE BATCH_ENDDATE BATCH_NAME
1 9/25/2008 10/2/2008 BATCH_1
2 9/29/2008 10/10/2008 BATCH_2
3 10/5/2008 10/15/2008 BATCH_3
4 10/10/2008 10/25/2008 BATCH_4
5 10/20/2008 10/30/2008 BATCH_5
6 10/25/2008 11/5/2008 BATCH_6
7 11/1/2008 11/10/2008 BATCH_7
8 11/11/2008 11/21/2008 BATCH_8
-> The Batch End Date will always be greater than Batch Start Date
-> Batches are not added into the table in any particular ascending order.
-> Two batches may or may not be overlapping.
The functional query to be written is as below :-
If I have student_start_date = 10/10/2008
I need to search for the first Batch_StartDate >= Student_START_DATE
For 10/10/2008, batch_4 is the current batch we need.
Now we need to fetch start date and end date of two batches above this and two batches below this.
I need to display on page in a JSF datatable the start date and end date of 5 batches in total - current batch, prev two batches and next two batches.
Hibernate version: 3.2.2
Name and version of the database you are using: Oracle 10gHow is this related to JSF?
Try a Hibernate forum. -
Hierarchical query To find the relation between the tables
Hi,
In my database schema i have hundreds of tables and dont have data model to understand the relation between them.
I heared that there will be heirarchical query which can be written by using meta tables, is this query will really help me to understand the relations.
Can anybody please help to get this query.
Thanks,
Vinod>
Hi Vinod,
I heared that there will be heirarchical query which can be written
by using meta tables, is this query will really help me to understand the relations.You could also download Data Modeler - it should be of assistance - free from
Oracle.
HTH,
Paul...
Vinod -
Tables related to the Query Manager
I have been looking for the table that hold the data on preformatted queries.
I found the OUQR table which shows the basics of every query in teh Query Manager.
What other table(s) have data related to the queries in teh Query Manager.Great, is there any other tables.
When I run a query it states I have 255 charactors but shows no table info.
Other then the OUQR and OQCN, is there another table(s) that contain more data on the queries?
Thanks
Maybe you are looking for
-
Windows 8.1 won't wake up from sleep
I seem to have the same problem that many have already expressed, the difference is that my laptop (HP ENVY) just started sleeping in, permanently and not waking up. I prefer to have my computer sleep, rather than hibernate (although I'm not clear as
-
Search Help Exit : Table appears sorted in Search Help!
Hi All, I have implemented a search help exit to show a custom list of objects. Unfortunately, the list gets sorted somewhere in between the search help exit and the actual F4 display. Any ideas what I can do tp prevent the sorting? It's very import
-
OiD and Portal Integration (WWC-41400)
Outside of the steps below what can be done to integrate Portal and OiD ? Thanks in Advance ! This is a new install of Oid and Portal. Portal is installed using ias10221 in a 8.1.7.2 database on Sun Solaris 2.7 w/patches. Used Configuring Oracle 9iAS
-
QM_QCERT_01 - DISPLAY MODE to CHANGE MODE
Dear Experts, I had make a copy of SAPScript form-QM_QCERT_01 in to ZQM_QCERT_01 and does some changes, the changes/enhamncements are working fine but i want to add a new window of footer for which it is not allowing since all its attributes are in d
-
Advantages of netweaver(webdynpro abap) comparing to sap(abap
plz tell me the advantages of netweaver(webdynpro abap)comparing sap