Creating Views using XSU PL/SQL API.Urgent please.
Folks,
I need some help in creating a View.
I am using XSU PL/SQL to generate an XML Document.
I have a table (SDI) with 2 cols CMPY_NUM and CPTY_BORG_NUM.
If the values in these 2 cols are equal then the xml
value to be returned is 'OURS' else return 'THEIRS'.
How do I Create this View please?
The XSU PL/SQL I am using to generate the XML is:
declare
queryCtx DBMS_XMLquery.ctxType;
xmlResult CLOB;
begin
queryCtx := DBMS_XMLQuery.newContext('select CMPY_NUM,CPTY_BORG_NUM from SDI');
xmlResult := DBMS_XMLQuery.getXML(queryCtx);
DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
end;
Output
<?xml version='1.0'?>
<ROWSET>
<ROW num="1">
<CMPY_NUM>1</CMPY_NUM>
<CPTY_BORG_NUM>2/CPTY_BORG_NUM>
</ROW>
<!-- additional rows ... -->
</ROWSET>
Please can any one tell me how to create a view that will be used in place
of the select statement,and returns back OURS or THEIRS
Create View XML AS
This is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
Lose ten culture points.
Regards, APC
Similar Messages
-
Creating Object views using XSU PL/SQL.Please SEE.
Hi,
I am presently using XSU PL/SQL utility with Oracle 9i and using the
DBMS_XMLQuery.newContext(<My Select clause goes here>,and the
DBMS_XMLQuery.getXML()which generates an XML document.
My query is:
I have 2 tables (One master and the other detail table.).
Table : DI_Master
di_num
00001
Table: DI_Details
di_num di_act
00001 ABCD
00001 ANCF
00001 IOPP
Now the XML I'd like is :
<di_num>00001</di_num>
<di_act>
<val>ABCD</val>
<val>ANCF</val>
<val>IOPP</val>
</di_act>
Do I need to create object tables for this,insert data into object tables
and then read this table? It will become an extremely tedious process
I guess an OBJECT view can do what I want.Can anyone please tell me how
to write an object view for the 2 tables please and the get the output as
desired.?Supposing you have further
nesting of the tables.Then how will you go about doing that.You can have multiple levels of CURSOR expressions (see an example below, not a real-life example, but illustrates the point).
SQL> set long 4000
SQL> select dbms_xmlquery.getXML('select deptno,' ||
2 'cursor(select empno, cursor(select losal, hisal from salgrade) salgrades '||
3 'from emp e where e.deptno = d.deptno and rownum < 3) EMPLOYEES ' ||
4 'from dept d where d.deptno = 10')
5 FROM DUAL;
DBMS_XMLQUERY.GETXML('SELECTDEPTNO,'||'CURSOR(SELECTEMPNO,CURSOR(SELECTLOSAL,HIS
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPTNO>10</DEPTNO>
<EMPLOYEES>
<EMPLOYEES_ROW num="1">
<EMPNO>7782</EMPNO>
<SALGRADES>
<SALGRADES_ROW num="1">
<LOSAL>700</LOSAL>
<HISAL>1200</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="2">
<LOSAL>1201</LOSAL>
<HISAL>1400</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="3">
<LOSAL>1401</LOSAL>
<HISAL>2000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="4">
<LOSAL>2001</LOSAL>
<HISAL>3000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="5">
<LOSAL>3001</LOSAL>
<HISAL>9999</HISAL>
</SALGRADES_ROW>
</SALGRADES>
</EMPLOYEES_ROW>
<EMPLOYEES_ROW num="2">
<EMPNO>7839</EMPNO>
<SALGRADES>
<SALGRADES_ROW num="1">
<LOSAL>700</LOSAL>
<HISAL>1200</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="2">
<LOSAL>1201</LOSAL>
<HISAL>1400</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="3">
<LOSAL>1401</LOSAL>
<HISAL>2000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="4">
<LOSAL>2001</LOSAL>
<HISAL>3000</HISAL>
</SALGRADES_ROW>
<SALGRADES_ROW num="5">
<LOSAL>3001</LOSAL>
<HISAL>9999</HISAL>
</SALGRADES_ROW>
</SALGRADES>
</EMPLOYEES_ROW>
</EMPLOYEES>
</ROW>
</ROWSET>
1 row selected.
SQL>
Also,isnt it a better option to create a VIEW of the
Select clause and pass a view to the select clause? At the end of the day, you could use whatever you feel comfortable with, provided that it produces your expected output and looks clean. We are just giving you the ideas, how you implement it actually in your situation, depends upon a lot of factors, that only you know about. -
Choosing particular columns using XSU PL/SQL API
Hi ya,
I have another query regarding XSU PL/SQL API please
If I dont want to choose all columns but choose particular columns
in my select clause,how shud I do this.??
I havent used XSU before,so please forgive my ignorance.
declare
queryCtx DBMS_XMLQuery.ctxType;
result CLOB;
begin
-- set the query context.
queryCtx := DBMS_XMLQuery.newContext('select CHOOSE CERTAIN COLS ONLY from <TABLE>');
result := DBMS_XMLQuery.getXML(queryCtx); -- get the result
DBMS_XMLQuery.closeContext(queryCtx); -- close the query handle;
end;
Can anyone tell me how to select particulat columnsor some one suggested(Mr Kishore) to use a view?
I dont want to use 'Select * from <Table>'
Help really appreciated.
RgdsThis is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
Lose ten culture points.
Regards, APC -
Error in creating GUID using com.sap.guid API's
Hi
i am trying to create GUID using com.sap.guid API's. I've included the guidgenerator.jar in the classpath. I ran the following code. i got the "Caused by: java.lang.NoClassDefFoundError: com/sap/guid/GUIDGeneratorFactory " error.
the code is
package com.portal;
import com.sapportals.portal.prt.component.;*
import com.sap.guid.GUIDGeneratorFactory;
import com.sap.guid.IGUID;
import com.sap.guid.IGUIDGenerator;
import com.sap.guid.IGUIDGeneratorFactory;
public class TestCompforGUID extends AbstractPortalComponent
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
* IGUIDGenerator generator = GUIDGeneratorFactory.getInstance().createGUIDGenerator();*
* String guid = generator.createGUID().toString();*
* String hexGuid = generator.createGUID().toHexString();*
* response.write(guid);*
* response.write(hexGuid);*
can anyone created the GUID's using com.sap.guid API's and help me here.
Do i need to specify any reference in Portalapp.xml ?
Thanks,
Saravanandifficult to reproduce. But it might be a data conversion problem.
e.g. try
to_char(a.num_tabs)If that's not the error comment out certain lines or xmltags and test which one is the reason for the error.
Edited by: Sven W. on Sep 9, 2011 3:13 PM - typo correction -
How to use DBFS PL/SQL API
Hi guys,
I'm re-posting this question to see if anyone can help me out. I am trying to use the DBFS PL/SQL API to manipulate files stored in DBFS.
Environment details:
Windows 7 or OEL 5.5 (I have tried both platforms)
Database: Oracle DB EE 11.2.0.2
IDE: SQLDeveloper on Windows 7
I have two users, DBFS_USER who owns the DBFS store and MYUSER who connects to the store to manipulate files using the DBFS PL/SQL API.
Creation scripts:
connect / as sysdba;
CREATE TABLESPACE dbfs_ts DATAFILE 'D:\oracle\oradata\orcl\dbfs01.dbf' SIZE 1M AUTOEXTEND ON NEXT 1M;
-- create users
create user dbfs_user identified by dbfs_user default tablespace dbfs_ts quota unlimited on dbfs_ts;
create myuser identified by myuser;
-- grant role
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, DBFS_ROLE, CREATE TABLE TO dbfs_user;
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, DBFS_ROLE, CREATE TABLE TO myuser;
-- create file system (as DBFS_USER)
connect dbfs_user/dbfs_user;
exec dbms_dbfs_sfs.createFilesystem('STAGING_AREA_FS');
exec dbms_dbfs_content.registerStore('STAGING_AREA_FS', 'posix', 'DBMS_DBFS_SFS');
exec dbms_dbfs_content.mountStore('STAGING_AREA_FS', 'staging_area');
commit;
-- export store STAGING_AREA_FS (as DBFS_USER)
exec dbms_dbfs_sfs.exportFilesystem('STAGING_AREA_FS');
-- check table names (as MYUSER)
connect myuser/myuser;
-- should see nothing (no mounts)
select * from table(dbms_dbfs_content.listMounts);
-- note down the table_name
select * from table(dbms_dbfs_sfs.listTables);
-- mount as MYUSER (example with table_name SFS$_FST_32)
exec dbms_dbfs_sfs.registerFilesystem('MYUSER_FS', 'DBFS_USER', 'SFS$_FST_32');
exec dbms_dbfs_content.registerStore('MYUSER_FS', 'posix', 'DBMS_DBFS_SFS');
exec dbms_dbfs_content.mountStore('MYUSER_FS', 'staging_area');
commit;
-- check mount (as MYUSER)
select * from table(dbms_dbfs_content.listMounts);
select pathname from dbfs_content;
CREATE STORED PROC (as MYUSER)
CREATE OR REPLACE PACKAGE MYUSER_PKG IS
Function CreateDirectory
(P_File_Path IN VARCHAR2,
P_ErrMsg OUT VARCHAR2)
return Number;
END MYUSER_PKG ;
CREATE OR REPLACE PACKAGE BODY MYUSER_PKG IS
Function CreateDirectory
(P_File_Path IN VARCHAR2,
P_ErrMsg OUT VARCHAR2)
return Number
IS
l_Return NUMBER;
l_props DBMS_DBFS_CONTENT.PROPERTIES_T;
BEGIN
l_Return := 0;
DBMS_DBFS_CONTENT.createDirectory (
path => P_File_Path,
properties => l_props);
RETURN l_Return;
EXCEPTION
WHEN OTHERS THEN
l_Return := NVL(SQLCODE, -1);
P_ErrMsg := SQLERRM;
RETURN l_Return;
END CreateDirectory;
END MYUSER_PKG ;
When compiling the package, I am getting this error:
Error(9,11): PLS-00201: identifier 'DBMS_DBFS_CONTENT' must be declared
Error(9,11): PL/SQL: Item ignored
Error(13,3): PL/SQL: Statement ignored
Error(15,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
How do I solve the problem in the error message? I'm not a DB expert. I used this reference documentation: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e18294/adlob_client.htm#CIHDEJAA
Thanks in advance.
CappaYou need to grant directly the privileges from DBFS_ROLE because roles are not enabled in stored PL/SQL:
SQL> select* from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> show user
USER is "SYS"
SQL>
SQL> create user myuser identified by myuser;
User created.
SQL> GRANT CREATE SESSION, RESOURCE, CREATE VIEW, DBFS_ROLE, CREATE TABLE TO myuser;
Grant succeeded.
SQL>
SQL> begin
2 for x in (select privilege, table_name
3 from dba_tab_privs
4 where grantee='DBFS_ROLE')
5 loop
6 execute immediate 'grant ' || x.privilege || ' on ' || x.table_name
7 || ' to myuser ';
8 end loop;
9 end;
10 /
begin
ERROR at line 1:
ORA-22812: cannot reference nested table column's storage table
ORA-06512: at line 6
SQL>
SQL> connect myuser/myuser
Connected.
SQL>
SQL> CREATE OR REPLACE PACKAGE MYUSER_PKG IS
2 Function CreateDirectory
3 (P_File_Path IN VARCHAR2,
4 P_ErrMsg OUT VARCHAR2)
5 return Number;
6 END MYUSER_PKG ;
7 /
Package created.
SQL> show errors
No errors.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY MYUSER_PKG IS
2 Function CreateDirectory
3 (P_File_Path IN VARCHAR2,
4 P_ErrMsg OUT VARCHAR2)
5 return Number
6 IS
7 l_Return NUMBER;
8 l_props DBMS_DBFS_CONTENT.PROPERTIES_T;
9 BEGIN
10 l_Return := 0;
11 DBMS_DBFS_CONTENT.createDirectory (
12 path => P_File_Path,
13 properties => l_props);
14 RETURN l_Return;
15 EXCEPTION
16 WHEN OTHERS THEN
17 l_Return := NVL(SQLCODE, -1);
18 P_ErrMsg := SQLERRM;
19 RETURN l_Return;
20 END CreateDirectory;
21 END MYUSER_PKG ;
22 /
Package body created.
SQL> show errors
No errors.You would need to check why some GRANT statement fails if you have other issue with other piece of code. -
CREATE VIEW in ABAP (Open SQL or Native SQL)
Hi all you experts!
I want to create a VIEW in ABAP. I have created Table Views using ABAP Dictionary (in transaction SE11), I don't have any problem with them.
But, what I need is to create a dynamic view, I mean, a view that can be created/replaced (or modified) at runtime. Is this possible with SAP Open SQL, I don't think so... that is why I tried to created using native SQL but it is not working.
Here is the code:
EXEC SQL.
CREATE VIEW [ZMXRFIV_GLPCA]
AS SELECT
T1.GL_SIRID,
T1.POPER,
T1.RBUKRS,
T1.RPRCTR,
T1.RACCT,
T1.HSL
FROM
GLPCA T1
INNER JOIN
SKA1 T2
ON
T1.RACCT = T2.SAKNR
WHERE
T1.RVERS = '000'
AND T1.RYEAR = '2008'
AND T1.KOKRS = 'PI01'
AND T2.KTOPL = 'PI00'
AND T2.XBILK <> 'X'.
ENDEXEC.
I have tried using quotes (") for the view name, parenthesis and even using only the name but this make no difference.
Do any of you experts have any idea?
PS: After creating the view I need to do a SELECT INTO TABLE to that view and finally delete this view and continue working with the data on the internal table.Hi ,
oh yes it is an object (well, how the database should handle it in any context if it wasn't)
i.e. for ORACLE you would have several thousands of them:
select count(*) from dba_objects where object_type ='VIEW'
If you avoid some kind of foreground processing (i.e. pull the data over the network) and handle the processing inside the database it can improve somehow performance a little (i.e. using the retieved rows of the view to stuff into a database table directly). But his may not always possible...
bye
yk -
Hi,
I am trying to create "View" in a Document Library and need to enable following:
1. Mark as default View
2. Folders -> Show this view : in Folders of Content Type : {Custom Content Type name}
I am using following code which sets "in Folders of Content Type : " to "Folder" rather than selecting custom content type despite passing Content Type ID of custom content type.
code:
var itemContentTypes = clientContext.LoadQuery(web.AvailableContentTypes.Where(ct => ct.Name == viewContentType));
clientContext.ExecuteQuery();
var itemContentType = itemContentTypes.FirstOrDefault();
view.ContentTypeId = itemContentType.Id;
view.DefaultViewForContentType = true;
view.Update();
clientContext.ExecuteQuery();
Please highlight what seems to be missing?
Thanks
SonalHi,
Before you set the content type ID for the view, you need to add the custom content type to the library firstly.
You can add the content type to library using OOTB feature “Add from existing site content types” in library settings or using Client Object Model.
Here is a code snippet for your reference:
var list = context.Web.Lists.GetByTitle(listTitle);
list.ContentTypesEnabled = true;
var contentType = context.Site.RootWeb.ContentTypes.GetById("0x0120");
list.ContentTypes.AddExistingContentType(contentType);
context.ExecuteQuery();
More information about add exist content type using Client Object Model:<o:p></o:p>
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.contenttypecollection.addexistingcontenttype%28v=office.15%29.aspx
Best regards,
ZhengyuGuo
Zhengyu Guo
TechNet Community Support -
Creating view if you got SQL right?
Hi,
I've a table called branch with following columns:
branch id, branch name, location, company
Now I've to get following display: number of branchs location wise per company... in SQL I'd write following query:
select count(branch_id), location from branch where company_id = 'oracle' group by location;
Now I am trying similar thing in ADF view, I've two attributes in my view:
location - i select mapped to column or sql - and write following in expression - select location from branch where company_id = 'oracle' group by location
number of branches - i select mapped to column or sql - and write following in expression - select count(branch_id) from branch where company_id = 'oracle' group by location
However it gives error. Can anyone help how to create view if I've got my SQL right?
Thanks.Just make a Expert mode VO (New View Object _>"Red_only Access through SQL Query") and put the following SQL -
select company_id,count(branch_id), location,branch_id from branch where company_id = 'oracle' group by location;And keep clicking next on the wizard ... your VO should get created with 4 fields ... CompanyId,Location,BranchId,CountBranchId (which you can rename if you want).
Run it in the AM you should see correct results ... You dont need to put specific SQLs in the attributes like what you are doing. -
Trouble Creating View Using Derived Values From With
I want to use the two values derived from the sql statements in my WITH to use in a view. This is my code:
WITH a AS(
SELECT
CASE
WHEN (SELECT stvterm_code
FROM stvterm
WHERE sysdate >= stvterm_start_date
AND sysdate <= stvterm_end_date) IS NOT NULL
THEN (SELECT stvterm_code
FROM stvterm
WHERE sysdate >= stvterm_start_date
AND sysdate <= stvterm_end_date)
ELSE
(SELECT min(stvterm_code)
FROM stvterm
WHERE stvterm_start_date > sysdate)
END cur_term
FROM dual),
b AS (
SELECT
CASE
WHEN (SELECT substr(cur_term,5, 2) FROM a) = '60' OR (SELECT substr(cur_term,5, 2) FROM a) = '40'
THEN (SELECT substr(cur_term,0, 4)||'20' FROM a)
WHEN (SELECT substr(cur_term,5, 2) FROM a) = '20'
THEN (SELECT to_char(to_number(cur_term)-100) FROM a)
END endof_prior_aidy_term
FROM dual
CREATE OR REPLACE VIEW jbartling.current_term AS
SELECT cur_term, endof_prior_aidy_term
FROM a,bHowever, I get the error ORA-00928: missing SELECT keyword. Is it possible to use WITH like this in creating a view? If not can someone show me another way to accomplish what I'm trying to do?Hi,
You need to put the CREATE at top, i.e
CREATE OR REPLACE VIEW jbartling.current_term AS
WITH a
SELECT .. FROM a,bRegards
Peter -
Create table using a dynamic SQL returns error.
DBMS_UTILITY.exec_ddl_statement (
'create table test_table as select column_names from table_name@dblink
where condition' )
i am using the above statement in a pl/sql procedure.
It throws an error saying
"Exact fetch returns more than requested no. of rows"
can any one help me on this please!!!
Very Urgent
Thanks in Advance.
Bala.Works for me. But the more important question would be the need to have this run within PL/SQL? Why do you want to do that? what is the requirement? can you not do this one time at SQL*Plus prompt and be done with it?
SQL> drop table emp ;
Table dropped.
SQL>
SQL>
SQL> exec dbms_utility.exec_ddl_statement('create table emp as select * from [email protected] where deptno = 10') ;
PL/SQL procedure successfully completed.
SQL> select count(*) from emp ;
COUNT(*)
3
1 row selected.
SQL> select count(*) from [email protected] ;
COUNT(*)
14
1 row selected.
SQL> select count(*) from [email protected] where deptno = 10 ;
COUNT(*)
3
1 row selected.
SQL>Message was edited by:
Kamal Kishore -
Creating database using command in SQL*plus
Hi,
Its not an urgent question.
I'm learning Oracle DBA. I have installed Oracle 9.2 in my windows system. And I am trying to create a database using SQL command.
OracleVersion : 9.2
Operating System Windows XP
CREATE DATABASE suri
USER SYS identified by manager
USER system identified by surendra
LOGFILE GROUP 1 ('F:\Oracle\oradata\suri\redo01.log') SIZE 100M,
GROUP 2 ('F:\Oracle\oradata\suri\redo02.log') SIZE 100M,
GROUP 3 ('F:\Oracle\oradata\suri\redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE 'F:\Oracle\oradata\suri\system01.dbf' size 200M EXTENT MANAGEMENT LOCAL
UNDO tablespace undots datafile 'F:\Oracle\oradata\suri\undots01.dbf' size 200M
DEFAULT TEMPORARY TABLESPACE tempts1 DATAFILE 'F:\Oracle\oradata\suri\temp01.dbf' SIZE 100M EXTENT MANAGEMENT LOCAL
I'm getting error like below while executing the CREATE DATABASE command.
ERROR at line 16:
ORA-25139: invalid option for CREATE TEMPORARY TABLESPACEI have validated the syntax but not able to find where the error is.
Please let me know if you need any further details.
Thanks in advance for your help.
Regards,
SuriWelcome.
why I got error when I use DATAFILE in CREATE DATABASE command (In oracle documentation also it shows as DATAFILE only)See http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_55a.htm#2127439
Also, error description may be helpful... -
Can we create LOV using free hand sql with out hardcoding
Hi gurus,
Dear All,
For some of the reporst we don't have universe, so we use to get the report with the help of free hand sql,
but here I have to hardcode the list of values by using @prompt, but instead of hardcoding is there any ways to get the list of vaues by using @prompt, if then can any one help me out.Yes and no.
When we use a LOV in a universe, the SQL is generated from the object definition. With Free Hand SQL (FHS) there is no universe. However...
If you create a very simple universe to host your LOV, and then reuse the same prompt text in your FHS then you can fake the LOV. This is not a great solution, but to be honest, FHS is never really a solution that I would consider. You might consider using Crystal to replace Deski in these cases. -
SQL HELP , URGENT PLEASE
Hi,
I want some help in writing a SQL Query .Its besically a hierarchical query. Let me lay down the table structure first to explain my requirements better.
PORP_TABLE(NODE_LEVEL int, WBS_ID int, WBS_NUMBER varchar(60), LFT int,RGT int)
SELECT NODE_LEVEL, WBS_ID, LFT,RGT FROM PROPOSAL_WBS PW WHERE PROPOSAL_REV_ID = 7000
(SAMPLE DATA)
NODE WBS
LEVEL WBS_ID NUMBER LFT RGT
0 7055 ROOT 1 24
1 7056 1 2 5
1 7088 2 6 9
2 7057 1.1 3 4
2 7089 2.1 7 8
2 7091 3.1 11 14
2 7103 3.2 15 16
2 7105 4.1 19 20
1 7090 3 10 17
3 7092 3.1.1 12 13
1 7104 4 18 23
2 7106 4.2 21 22
ALLOCATION_DETAIL( WBS_ID int, COST_ID int, PERIOD Date, AMOUNT Float)
sample data
WBS_ID , COST_ID , PERIOD , AMOUNT
7057 100 01-jan-2005 5000
7057 100 01-feb-2005 2000
7057 100 01-mar-2005 1000
7057 100 01-apr-2005 6000
7057 100 01-may-2005 3000
7057 100 01-jun-2005 45000
7106 100 01-mar-2005 8000
7106 100 01-apr-2005 7000
7106 100 01-may-2005 9000
Now the PORP_TABLE has got the parents and childs. Only the leaf nodes in the hierarchy has the values stored in the ALLOCATION_DETAIL table. Now here is the scenario
In the example 7055 is the root WBS . The Leaf WBS are the one with max extension in the wbs number ( in this case it is 1.1, 2.1, 3.1.1, 3.2, 4.1 and 4.2)
Now the Starting period for each leaf node in the ALLOCATION_TABLE could be differrent . What that means is WBS 1.1 could start in Jan -2003 and WBS 3.1 Could be Jul-2005 . So the ending perios are also differrent for differrent WBS . Some can span 2 years some can 5 years.
So how to write a query so it retrieves the value for all the Wbs starting from the MIN ( PERIOD ) upto the MAX(PERIOD), and it should roll up also. Now there is No connect by Prior or any analytic functions available for this . THIS NEEDS TO BE DONE ONLY THROUGH TRADITIONAL SQL STATEMENT . And NO DB FUNCTIONS CAN BE USED .
Now if the WBS is a parent node then it should have the sum of all its child nodes for the COST category.
SO THE RESULT SET SHOULD BRING LIKE THIS
WBS_NUMBER, PERIOD_NUMER, COST_CATEGORY , AMOUNT
ROOT
1
1.1
2
2.1
3
3.1
3.1.1
3.2
4
4.1
4.2
......Hi,
<br>Read String Aggregation Techniques</br>
<br>HTH,</br>
<br>Nicolas.</br> -
How to create TAX CODE in Spro...urgent please...
Hi sap guru's
While doing MIRO/MIR7/MIRA(logistics invoice verification). my cleint is using different tax code. i want to creat new TAX code for my cleint..
can anybody tell me how to create TAX code in SPRO.
ThanksHi Sakti,
Transaction code to create Tax code is FTXP.
Path is
IMG--> Logistic General --> Tax on good movements --> India --> Basic Settings --> Determination of Excise Duty --> Condition Based Excise Determination --> Define Tax code for Purchasing Department
After creating tax code dont forget to assign with your counrty code for that path is
IMG--> Logistic General --> Tax on good movements --> India --> Basic Settings --> Determination of Excise Duty --> Condition Based Excise Determination --> Assign tax code to company code
Hope your query is solved
Regards
Vivek
-- Reward for the Effort !! -
SQL QUERY, URGENT PLEASE HELP .....
Hi,
There is a table which stores the sales record, weekly basis.
For example
WEEK______ ITEMNO______SALES______QTY
200201_____10001______10,000______50
200202_____10001______18,000______55
200230_____10001______55,000_____330
Now the report should display the week nos and a Cumulative average.
like
ITEM NO - 10001
WEEKNO____WK-AVG____13WK-AVG____26WK-AVG____52WK-AVG
200201
200202
200203
200230
The WK-AVG is calculated for that perticular (weeks sales /weeks qty) but for 13WK-AVG,26-AVG and 52WK-AVG , The calculationis the (cumulative of last 13 week sales /cumulative of last 13 wk qty)
for example at week 200230 the 13WK-AVG should be
(cumulative sales from week 200218 to 200230 / cumulative qty from week 200218 to 200230 )
the same hold good for 26WK-AVG AND 52WK-AVG. Please suggest me how to do it . This is very urgent . Please help me .
Thanks
FerozFeroz,
One way is to use subselects. E.g.,
SELECT WK_AVG, 13WK_AVG, 26WK_AVG, 56WK_AVG FROM
(SELECT (SALES/QTY) AS WK_AVG FROM TABLE WHERE ITEMNO=x AND WEEK = ...),
(SELECT (SUM(SALES)/SUM(QTY)) AS 13WK_AVG WHERE ITEMNO=X AND WEEK > Y AND WEEK <= Z),
hope this helps.
regards,
Stewart
Maybe you are looking for
-
Downloading the data to external file
HI ABAPers, I have a dynamic internal table which i created using CREATE DATA statement and i have put in data into it. I have to download that internal table data into a external file. As the internal table is dynamically created it will be deref
-
i used the new update now my screen has a blue music symbol an arrow pointing up under it and a charger symbol it wont go away whats wrong
-
HT201302 photos from pc to my ipad
hi im having a hard time putting photos from my computer (xp) to my ipad.
-
need a fix to error message...AppleSyncNotifier.exe - Entry Point Not Found The procedure entry point sqlite3_wal_checkpoint could not be located in the dynamic link library SQLite3.dll
-
Call info from VOIP Router for billing purposes
Hi Pros, My client has a VOIP network where all routers have FXS Cards & Dial Peers configured --- No CallManager --- They want to bill calls using router outputs. Now, I thought of collecting debugging data on syslog servers. Can anybody help identi