Need Notification on creation of table
Hi,
I am looking for notification as soon a table is created in a document to perform some actions on it.
I tried looking for Responder service but there is no such service available for table creation.
Can some one suggest a way for the same? If I have to use Observer then which boss class shall I use for it and what should be the subject.
One approach is via CTextCommandPreProcess::InsertPreProcess(), see whether the inserted char has a table bound to it.
Note that is pretty early, e.g. at that point table attributes haven't been applied.
Later on the kTextStoryBoss subject notifies with change kTableModelBoss, protocol IID_IPRENOTIFYTABLESTRUCTURECHANGE.
This change is also seen on the kDocBoss subject so you can use a document observer.
The void* data appears to be your table's IID_ITABLELAYOUT.
The last change that I've seen with a simple table is the table style (2nd time during the bracketing kNewTableCmdBoss):
subject kDocWorkspaceBoss, change kApplyTableStyleCmdBoss, protocol IID_ITABLEMODEL given the command.
Similar Messages
-
Need Guide to create a table in SQL Server and Process data for JDBC
Dear All,
Scenario:JDBC to JDBC
I need to practice JDBC to JDBC scenario and for that i need to create a table in SQL server for sender ,receiver and update i have installed SQL Server and no idea about creation of table and Connection string for PI.
I want you to explain each and every step for the Table Creation ,Driver and connection string.
Thanks in Advance.Try searchin in the forum and then google. This forum is not for teaching the basics.
VJ -
Creation of tables using JDBC or SQLJ in webdynpro application
Hi,
I am trying to create tables in javadictionary(MaxDB)using my WebDynpro application.I tried creating tables using SQLJ and JDBC.But I was not able to do it.I can select and insert data into already created tables.
Whwn I tried creating a table using JDBC I encountered the following exception.
com.sap.sql.log.OpenSQLException: The SQL statement "CREATE TABLE TMP_DEPID (DEPID varchar(10) NOT NULL,DEPNAME VARCHAR(25))" contains the syntax error[s]: Open SQL syntax error: CREATE ... TABLE is not supported
SQL syntax error: "VARCHAR" is a reserved keyword and cannot be used as an unquoted identifier
Does this mean that creating tables is not supported?
Can anyone help me in this matter?
Thanks in advance,
regards
~Pradeep ShettyHi Pradeep,
Yes, OpenSQL does not support creation of tables. But why would you need to create tables at runtime?! The natural way is to create the model at design time of your application, i.e. with the Java DataDictionary.
However, if for any reason you really need to create database tables at runtime, you can achieve this by using a non-OpenSQL datasource, e.g. you could create a VendorSQL one and use it to obtain JDBC connections in your app. See also http://help.sap.com/saphelp_nw04/helpdata/en/c0/3ad4d5cdc66447a188b582aad537d3/frameset.htm.
Hope that helps!
Vladimir -
MDM Java API (Creation of table)
Hi,
can anyone help me for creation of tables in repository using MDM java API .
Can u Provide sample code for this.
Edited by: Srikanth Josyula on Jun 26, 2008 8:52 AMHi Srikanth,
Check with this code.It may be useful.
createflattable.java
Created on June 25, 2008, 5:08 PM
To change this template, choose Tools | Options and locate the template under
the Source Creation and Management node. Right-click the template and choose
Open. You can then make changes to the template in the Source Editor.
package tabletype;
import com.sap.mdm.commands.AuthenticateRepositorySessionCommand;
import com.sap.mdm.commands.CommandException;
import com.sap.mdm.commands.CreateRepositorySessionCommand;
import com.sap.mdm.commands.GetRepositoryRegionListCommand;
import com.sap.mdm.data.MultilingualString;
import com.sap.mdm.data.RegionProperties;
import com.sap.mdm.data.RegionalString;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.ConnectionPool;
import com.sap.mdm.net.ConnectionPoolFactory;
import com.sap.mdm.schema.TableProperties;
import com.sap.mdm.schema.commands.CreateTableCommand;
import com.sap.mdm.schema.commands.GetFieldListCommand;
import com.sap.mdm.schema.commands.GetTableListCommand;
import com.sap.*;
import com.sap.mdm.server.DBMSType;
import com.sap.mdm.server.RepositoryIdentifier;
import java.util.Locale;
public class createflattable {
/** Creates a new instance of createflattable */
public createflattable() {
private static MultilingualString createMultilingualString(RegionProperties[] regionPropertiesList, String baseString)
MultilingualString mlString = new MultilingualString();
for (int i = 0; i < regionPropertiesList.length; i++)
Locale locale = regionPropertiesList<i>.getLocale();
//Locale locale = regionPropertiesList<i>.getLocale();
String regionCode = regionPropertiesList<i>.getRegionCode();
String string = baseString + "_" + locale.getLanguage() + "_" + locale.getCountry();
RegionalString regionalstring = new RegionalString(string, regionCode);
mlString.set(regionalstring);
return mlString;
private static TableProperties createFlatTable(RegionProperties[] regionPropertiesList)
//MultilingualString tableName = createMultilingualString(regionPropertiesList, "NewTable" + System.currentTimeMillis());
MultilingualString tableName = createMultilingualString(regionPropertiesList, "first"+System.currentTimeMillis());
System.out.println("table is" +tableName);
TableProperties table = new TableProperties(TableProperties.FLAT);
table.setName(tableName);
table.setCode("NewCode" + System.currentTimeMillis());
table.setKeyMappable(true);
table.setDescription("");
return table;
public static void main(String[] args) {
// System Name
String tag = "";
ConnectionPool connections = null;
try {
connections = ConnectionPoolFactory.getInstance(tag);
catch (ConnectionException e)
e.printStackTrace();
return;
//////////////// specify the repository to use
//RepositoryName
String repositoryName = "";
//DataBase Name
String dbmsName = "";
RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);
/////// create a repository session
CreateRepositorySessionCommand sessionCommand = new CreateRepositorySessionCommand(connections);
sessionCommand.setRepositoryIdentifier(reposId);
try {
sessionCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
System.out.println("Currently connected to "+reposId);
String sessionId = sessionCommand.getRepositorySession();
/////////// authenticate the repository session
String userName = "";
String userPassword = "";
AuthenticateRepositorySessionCommand authCommand = new AuthenticateRepositorySessionCommand(connections);
authCommand.setSession(sessionId);
authCommand.setUserName(userName);
authCommand.setUserPassword(userPassword);
try {
authCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
//////////////////// retrieve the list of tables
GetTableListCommand tableListCommand = new GetTableListCommand(connections);
tableListCommand.setSession(sessionId);
try {
tableListCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
// get change stamp
// this is required when we make any kind of changes to the repository
int changeStamp = tableListCommand.getChangeStamp();
//////get repository regionlist
//A command for retrieving the list of regions supported by the repository.
// retrieve the available regions (languages) for the repository
// we need this to set up the table name for each region
GetRepositoryRegionListCommand gm = new GetRepositoryRegionListCommand(connections);
gm.setRepositoryIdentifier(reposId);
try {
gm.execute();
catch (CommandException e) {
e.printStackTrace();
return;
// RegionProperties[] rs = gm.getRegions();
RegionProperties[] regionPropertiesList = gm.getRegions();
TableProperties newtable = createFlatTable(regionPropertiesList);
CreateTableCommand c = new CreateTableCommand (connections);
c.setSession(sessionId);
c.setTable(newtable);
c.setInChangeStamp(changeStamp);
try {
c.execute();
System.out.println("sdf");
catch (CommandException e) {
e.printStackTrace();
return; -
Capacity Planning for Creation of Table
Hello Guys,
I just need some advise here.
I have been told to work out the space needed for the creation of a table.
The table in question would have three columns with datatypes [num(10), varchar(10),date] and would be loaded with 100,000 rows. How do I go about it.
Thanks in AdvanceTry with something like this, may help you.
Prerreqs: parameter OPTIMIZER_MODE != RULE.
grant to execute DBMS_SPACE
DDL Table creation:
CREATE TABLE SAMPLE
ID NUMBER(9),
NAME VARCHAR(50),
CREATE_DATE_TIME DATE,
MOD_DATE_TIME DATE,
USER_ID VARCHAR(15)
set serveroutput on
declare
calc_used_bytes NUMBER;
calc_alloc_bytes NUMBER;
cols sys.create_table_cost_columns;
begin
cols := sys.create_table_cost_columns
sys.create_table_cost_colinfo('NUMBER', 9),
sys.create_table_cost_colinfo('VARCHAR2', 50),
sys.create_table_cost_colinfo('VARCHAR2', 15),
sys.create_table_cost_colinfo('DATE', NULL),
sys.create_table_cost_colinfo('DATE', NULL)
DBMS_SPACE.CREATE_TABLE_COST (
tablespace_name => 'USERS',
--avg_row_size => 100, quitar comentario para 11g
row_count => 5000,
pct_free => 10,
used_bytes => calc_used_bytes,
alloc_bytes => calc_alloc_bytes
dbms_output.put_line('Used (M): '||round(calc_used_bytes/(1024*1024)));
dbms_output.put_line('Allocated (M): '||round(calc_alloc_bytes/(1024*1024)));
end;
/More info: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_space.htm#i1003180
Regards.
johnxjean
Edited by: johnxjean on 18-Mar-2011 09:43
Edited by: johnxjean on 18-Mar-2011 09:44 -
Significance of Initial (intial_extent)parameter while creation of table
Hi All,
I am designing a new schema for my 10g database and I am in process of creation of tablespaces and tables.
My Tablespace are extent management local autoallocate and auto segment space management.
With “segment space management Auto”, I understand that I don’t have to define storage clause in tablespace and freelist will be taken care by bitmap
My question is
while creation of tables what’s the significance of Intial (intial_extent in user_tables) parameter.?
Do I need to consider this parameter while defining large and small tables?
Is this not controlled by “auto segment space management.” Parameter of tablespace.?While it is unlikely to make a measurable impact on anything in practice, it is almost always preferable in theory, assuming perfect knowledge of the system, to have a few different tablespaces with different uniform extent sizes and to put each object in the appropriate tablespace for its size (i.e. giant tables in the tablespace with giant extent sizes, tiny tables in the tablespace with tiny extent sizes, etc.). The problem with this, however, is that you very rarely have perfect knowledge in advance about object sizes and growth and size patterns are likely to evolve over the life of the system, so you can suck up a great deal of DBA and developer time gathering and maintaining this sort of information as well as responding to changes over time (i.e. moving objects from one tablespace to another as their usage patterns change). For most systems, the potential benefit to having a perfect setup, rather than putting everything in an AUTOALLOCATE tablespace, is far smaller than the cost of actually doing so.
Unless you have some reason to believe that your application is in the minority where squeezing the last bit of storage efficiency is worth the hassle, I'd tend to suggest throwing everything in an AUTOALLOCATE tablespace.
Justin -
I need to know in which table the long text is stored
Using the transaction code 'AC03' , I go to the ' Create Service Master Page '. Navigating through the page , I could see a ' long text ' button . Once it is being clicked , the white space for text entry comes .
My query is this -> <b>I need to know in which table the long text is stored and the name of the field ??</b>
If one goes to the table 'ASMDT' , one can find a field 'KZLTX' , which is a long text indicator, but not a long text storage field ...... plz helpHi
Use the function module READ_TEXT for fetching the long text..
I came across similar situation in my project where i need to fetch the long text for Notification no.I have used the following code for fetching the Notificatin long text,you can just compare this logic and change accordingly.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'LTXT'
LANGUAGE = WA_STRUCT12-KZMLA
NAME = QMNUM
OBJECT = 'QMEL'
TABLES
LINES = INT_TAB13.
Specify LANGUAGE if you wanna fetch the long text regardless of the log on lang.The resulting long text will be stored in the itab INT_TAB13 which can be defined with reference to the structure TLINE.
Hope this helps.
Regards,
Hakim -
Problem regarding the creation of Table using CSS.
Hi ,
Here I have a Problem regarding the creation of Table using CSS.
In My Application i have a table with multiple rows(Rows are Dynamically added to the table).First i am setting the table with the following properties:
width:900px;
height : auto,
Overflow : visible,
Max-height: : 200px.
If I use above properties,I'm getting a table with 5 or 6 rows(height upto 200px).After that i am getting the Vertical ScrollBar.
The problem is when a table has many columns, Vertical and Horizontal Scrolls are coming at the time of setting the table. The table height is not Increasing dynamically.
How can i use "height" property in CSS? (I want the table height to be increased when the columns are more.)
Thanks & Regards
MadhaviHey humble user. Errr I'm trying to understand what ur trying to do. U want to create a section of a region destructively from an existing region right? If so select the option convert to new region (opt-comm-R or selecting it by right clicking). Check your audio bin to make sure. Whats the "merge" function? Are u refering to the glue tool?
-
Reg: Creation of Table Types
Hi All,
I have a small question regaridng the creation of Table type.
Let us suppose I am creating Table type for a custom table zsample which is having 5 fields. I am generally creating a structure similar to custom table and using that structure as line type for the table type. Let us suppose if there are any changes in the custom table like change in the order of fields or if new fields are added the table type will give dump.
My question is If I use the custom table itself as a line type, will there be any effect in the performance or some thing or I can go ahead and use it..
Thanks,
RaveeWhat dump are you expecting ???
It is idea behind the creation with reference to get structures and tables which always look like
the tables they refer to.
I can not see a possibilty for a dump as long as you create only an internal table.
A dump could appear, if the internal table is later used to update another db-table. But there it should be clear that the structure of an internal should be created with reference to the tables which they change.
Siegfried -
Dynamic creation of tables and data insertion in BODS
Specific requirement : We need to extract multiple tables from ERP system and stage them in BODS SQL server database.
As the need is for lot of tables , we want to come up with a generic Job which can be used for all the tables which have different sructures.
So BODS Job should create tables on the fly and also load data into different tables not having same structure. We can maintain a config table of all the tables to be extracted.
Any ideas?Dirk,
The job should be generic to cater to n number of tables , we are looking at one job where the source /Target structures are not imported so that it becomes generic and we don't know the count of tables that we will be extracting . We just like one job , which can extract tables as and when we add table names in the config table....... -
Dynamic Creation of Table and assign Datasource.
Hi Experts
My scenario is like this..
There are more than one RFC models and the output list of these models I need to display in a table format.. The display should happen conditionally as per the availabity of the data in the output list..I need to display the data from multiple models at the same time the said table..
Please let me know the methods to create a table with 5 columns and also how to assign the datasource programatically..
THanks and Regards
SUHi,
Use only one Table View context.
Model Contexts:
RFC1, RFC2, RFC3
I_Attr11 I_Attr21 I_Attr31
I_Attr12 I_Attr22 I_Attr32
I_Attr13 I_Attr23 I_Attr33
I_Attr14 I_Attr24 I_Attr34
I_Attr15 I_Attr25 I_Attr35
Table Control Context:
Table
I_Attr1
I_Attr2
I_Attr3
I_Attr4
I_Attr5
Execute each model individually and loop through all model contexts...append the rows from each model context to table context.
//access the table node
IWDTableNode tableNode = wdContext.nodeTable();
IWDTableElement tableElem;
//loop thugh the models
for(int i=0; i<RFC1.size(); i++)
tableElem = tableNode.createTableElement();
tableElem.setAttr1(RFC1.getRFC1ElementAt(i).getAttr11);
tableElem.setAttr2(RFC1.getRFC1ElementAt(i).getAttr12);
tableElem.setAttr3(RFC1.getRFC1ElementAt(i).getAttr13);
tableElem.setAttr4(RFC1.getRFC1ElementAt(i).getAttr14);
tableElem.setAttr5(RFC1.getRFC1ElementAt(i).getAttr15);
tableNode.addElement(tableElem);
//similarly loop thrugh the remaining 2 models and append the table context
Regards
Srikanth -
Please I need some help with a table
Hi All
I need some help with a table.
My table needs to hold prices that the user can update.
Also has a total of the column.
my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
I have tried using but as I need to set the toal with something like total
totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
Can any one please advise on some way I can get this to work ?
Thanks for reading
CraigHi there camickr
thanks for the help the other day
this is my full code....
package printing;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.DecimalFormat;
public class tablePanel
extends JDialog implements Printable {
BorderLayout borderLayout1 = new BorderLayout();
private boolean printing = false;
private Dialog1 dialog;
JPanel jPanel = new JPanel();
JTable table;
JScrollPane scrollPane1 = new JScrollPane();
DefaultTableModel model;
private String[] columnNames = {
private Object[][] data;
private String selectTotal;
private double total;
public tablePanel(Dialog1 dp) {
dp = dialog;
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
public tablePanel() {
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
private void jbInit() throws Exception {
jPanel.setLayout(borderLayout1);
scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
this.add(jPanel);
jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
scrollPane1.getViewport().add(table);
jPanel.setOpaque(true);
newTable();
addToModel();
addRows();
setTotal();
public static void main(String[] args) {
tablePanel tablePanel = new tablePanel();
tablePanel.pack();
tablePanel.setVisible(true);
public void setTotal() {
total = 0;
int i = table.getRowCount();
for (i = 0; i < table.getRowCount(); i++) {
String name = (String) table.getValueAt(i, 1);
if (!"".equals(name)) {
if (i != table.getRowCount() - 1) {
double dt = Double.parseDouble(name);
total = total + dt;
String str = Double.toString(total);
table.setValueAt(str, table.getRowCount() - 1, 1);
super.repaint();
public void newTable() {
model = new DefaultTableModel(data, columnNames) {
table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer,
int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (printing) {
c.setBackground(getBackground());
else {
if (row % 2 == 1 && !isCellSelected(row, col)) {
c.setBackground(getBackground());
else {
c.setBackground(new Color(227, 239, 250));
if (isCellSelected(row, col)) {
c.setBackground(new Color(190, 220, 250));
return c;
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (table.getSelectedColumn() == 1) {
table.setTableHeader(null);
table.setModel(model);
scrollPane1.getViewport().add(table);
table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
public void addToModel() {
Object[] data = {
"Price", "5800"};
model.addRow(data);
public void addRows() {
int rows = 20;
for (int i = 0; i < rows; i++) {
Object[] data = {
model.addRow(data);
public void printOut() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(tablePanel.this);
pj.printDialog();
try {
pj.print();
catch (Exception PrintException) {}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight = g2.getFontMetrics().getHeight();
int fontDesent = g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
double headerHeightOnPage = 16.0;
//double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
//System.out.println("this is the hedder heigth " + headerHeightOnPage);
double tableWidthOnPage = tableWidth * scale;
double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
double pageHeightForTable = oneRowHeight *numRowsOnAPage;
int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages) {
return NO_SUCH_PAGE;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
//bottom center
g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages), (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex * pageHeightForTable);
//If this piece of the table is smaller
//than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted =
numRowsOnAPage * pageIndex;
int numRowsLeft =
table.getRowCount()
- lastRowPrinted;
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight *
numRowsLeft));
//else clip to the entire area available.
else {
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale, scale);
printing = true;
try {
table.paint(g2);
finally {
printing = false;
//tableView.paint(g2);
g2.scale(1 / scale, 1 / scale);
g2.translate(0f, pageIndex * pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
//table.getTableHeader().paint(g2);
//paint header at top
return Printable.PAGE_EXISTS;
class TableRenderDollar extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean isFocused,
int row, int column) {
setHorizontalAlignment(SwingConstants.RIGHT);
Component component = super.getTableCellRendererComponent(
table,
value,
isSelected,
isFocused,
row,
column);
if( value == null || value .equals("")){
( (JLabel) component).setText("");
}else{
double number = 0.0;
number = new Double(value.toString()).doubleValue();
DecimalFormat df = new DecimalFormat(",##0.00");
( (JLabel) component).setText(df.format(number));
return component;
} -
Need some help with the Table Function Operator
I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
-- Source Table:
DROP TABLE "ZZZ_ROOM_MASTER_EX";
CREATE TABLE "ZZZ_ROOM_MASTER_EX"
( "ID" NUMBER(8,0),
"ROOM_NUMBER" VARCHAR2(200),
"FEATURES" VARCHAR2(4000)
-- Example Data:
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
-- Destination Table:
DROP TABLE "ZZZ_ROOM_FEATURES_EX";
CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
( "ROOM_NUMBER" VARCHAR2(200),
"FEATUREID" NUMBER(8,0),
"QUANTITY" NUMBER(8,0)
-- Types for output table:
CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
ID NUMBER(8,0),
QUANTITY NUMBER(8,0)
CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
-- Package Dec:
CREATE OR REPLACE
PACKAGE ZZZ_SANDBOX_EX IS
FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
END ZZZ_SANDBOX_EX;
-- Package Body:
CREATE OR REPLACE
PACKAGE BODY ZZZ_SANDBOX_EX IS
FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
AS
RETURN_VALUE FK_Table_EX := FK_Table_EX();
i NUMBER(8,0) := 0;
BEGIN
-- TODO: Put some real code in here that will actually read the
-- input string, parse it out, and put data in to RETURN_VALUE
WHILE(i < 3) LOOP
RETURN_VALUE.EXTEND;
RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
i := i + 1;
END LOOP;
RETURN RETURN_VALUE;
END UNFK;
END ZZZ_SANDBOX_EX;
I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
I can get the data from my source table to my destination table using the following SQL statement:
-- from source table joined with table function
INSERT INTO ZZZ_ROOM_FEATURES_EX(
ROOM_NUMBER,
FEATUREID,
QUANTITY)
SELECT
ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
UNFK.ID,
UNFK.QUANTITY
FROM
ZZZ_ROOM_MASTER_EX,
TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
INSERT
/*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
INTO
"ZZZ_ROOM_FEATURES_EX"
("ROOM_NUMBER",
"FEATUREID",
"QUANTITY")
(SELECT
"ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
"INGRP2"."ID" "ID_1",
"INGRP2"."QUANTITY" "QUANTITY"
FROM
(SELECT
"UNFK"."ID" "ID",
"UNFK"."QUANTITY" "QUANTITY"
FROM
TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
"ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!Hello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
I NEED TO KNOW ABOUT DRIVING TABLE...PLEASE
Well, My name is Adan. I am from Panama.. my english is not
good. But I'll try. I need to know about driving tables and how
have to choose a driving table and how optimizer proccess an sql
statment.
Example:
Employees have (1,000,000 rows),
dept have (100 rows)
Category have (100 rows)...
I need retrieved all employees with category and dept name for
those employee with salary > 100000
Well, What is the driving table and where i have to put this one
in the from clause ? What about order in the where predicate...
First ?
Select E.name, C.category, D.Departement
from Employees e, dept d, category c
where
and d.cat = c.cat
and e.deptno = d.deptno
and e.salary > 100000
Last ?
Select E.name,C.category, D.Departement
from dept d, category c ,Employees e
where
and d.cat = c.cat
and e.deptno = d.deptno
and e.salary > 100000
I apreciate your help....Thanks and sorry for my english....
Bye..Adam,
If you set your optimizer = choose and analyze the tables and
indexes to generate statistics, then your system can use the
Cost Based Optimizer (CBO) and, like David said, it will
automatically choose the best access path, and the order of
things will not matter.
If your optimizer is not set to choose or if there are no
statistics, then it will use the Rule Based Optimizer (RBO), in
which case, the only thing that matters is the order of the
tables in the from clause. When using RBO, the driving table
should be at the end of the from clause, in the right-most
position. The driving table is the one such that, after the
restrictions have been applied, returns the smallest number of
rows. You would have to compare the number of rows in the
employees table where salary > 100000 to the number of rows in
the dept table (100) and the number of rows in the category
table (100).
In RBO, if there are more than 100 rows in the employees table
where salary > 100000, then your from clause would be:
FROM employees e, dept d, category c
In RBO, if there are less than 100 rows in the employees table
where salary > 100000, then your from clause would be:
FROM category c, dept d, employees e
This is all that applies to the example you have given, however
there are other things that can apply in other situations. For
example, if there is an outer join to a table, the table that
has the (+) cannot be used as the driving table.
Barbara -
Creation of table in interactive form
hai,
any one can explain me the creation of table in interactive forms transcation code(sfp)
or any can send any material because i am new to this, how to build interactive forms
advance thanks.
regards,
shravanramidi .Hi,
TRy https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cacb9a7d-0c01-0010-1281-be4962c9ab3e
Regards,
Shiva Kumar(Reward if helpful).
Maybe you are looking for
-
I have a program that has three columns, in the first column it lists numbers 0-10, in the second column I need to get the square root of each number in the first column. How would I get those results. What is the formula for the square root and how
-
Apply CPUOCT2008 with both a physical and logical standby in place
Hello All, I'm trying to compile a decent set of steps for applying the CPUOCT2008 patch to our production RAC cluster which has both a logical and physical standby in place. I've read a tonne of documentation, including the CPU readme, DOCID 437276.
-
This is how the X-Fi soundcard should work. Ican do it with 2 soundcar
Hi There. For?some new X-Fi drivers and software I have a suggestion that would be awsome. First though, let me explain what I'm doing. I have 2 souncards. the first is an X-Fi Extreme music which is set as the primary soundcard. This souncard is pat
-
Hi All, I have a question about the HW key and license key for SAP on Solaris. As currently, we would like to replace the existing hard-disk with a larger one. And i would like to know that, can we using the same license generated before, or we need
-
JcomboBox How display names, but return ids?
I am implemeting a combobox from a table (id, name). I want display the names, but when the user select a item, I want to get the id corresponding to the name selected How i make this?