Create table with references pointing to values in a different schema

Experts,
Is it possible to create table in one schema with references pointing to column values in a different schema?
Say, I have 2 schemas A and B
A has employee table and and B has dept table, I want to run the below alter statement, will this work?
ALTER TABLE A.EMP ADD (
FOREIGN KEY (DEPT_ID)
REFERENCES B.DEPT (DEPT_ID));
I know there is no sense in doing this, still would like to know for making some temporary workaround.
Regards,
Sarvan
Edited by: sarvan on Oct 21, 2011 12:30 AM

Yes this is possible with right privilege:
SQL> grant connect, resource to a identified by a;
Grant succeeded.
SQL> grant connect, resource to b identified by b;
Grant succeeded.
SQL> connect b/b
Connected.
SQL> create table p (x int primary key);
Table created.
SQL> grant references on p to a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> create table c (y int);
Table created.
SQL> alter table c add foreign key (y) references b.p(x);
Table altered.

Similar Messages

  • Unable to create table with column default value with date interval

    Please help to create table with calculated date defaullt value:
    CREATE TABLE emp (
      birth_date  DATE  DEFAULT sysdate + interval '3' day NOT NULL
    or
    CREATE TABLE emp (
      some_date DATE,
      birth_date  DATE  DEFAULT some_date NOT NULL
    or
    CREATE TABLE emp (
      some_date DATE,
      birth_date  DATE  DEFAULT some_date + interval '3' day NOT NULL
    below syntax error:
    TT1001: Syntax error in SQL statement before or at: "+"

    I'm afraid this is not possible; as per the SQL Reference, TimesTen only supports 'constant expressions' for the DEFAULT clause and none of these are constant expressions.
    Chris

  • Problem creating Allocation Table with Reference to a PO

    Dear Folks,
    I am having problems creating an allocation table with reference to a PO in T-code WA01.
    I read the SAP help that some prerequisites need to exist:
    ==> You can only reference order items flagged as being relevant to a stock split (the Allocation table relevant indicator in the additional item data).
    Can anyone advice me where to find this stock split indicator?
    Also, can anyone advice me how to reuse an allocation table? For example, I had previously created an allocation table with many articles and various allocation rules. I already generated follow on documents for this table.
    Say after 2 weeks, I have the similar requirements that I can make use of the same table, only with minor adjustments to the quantity. How do I create a new allocation table using the existing allocation table data?
    Thanks and Regards
    Junwen

    Any idea please?
    thanks

  • SO IDOC inbound create SO with reference to INV or SO #

    Hi all,
    I have a situation where I will get the inbound SO IDOC, through IDOC_INPUT_ORDERS and create a sales order with reference to a invoice number or another sales order (eg: consignment pick up and consignment fill up).
    Except modifying the standard formed BDC in the FM, by adding additional screen code into the BDC, is there any other way to do so?
    (eg: assign value into certain field in IDOC? Using another IDOC FM?)
    Please advice.
    Thanks.
    Best Regards,
    JL

    Hi ,
    At a high level, the IDOC processing executes in the following manner:
    1.     Interpret IDOC header segments and captures organizational, customer master and purchase
                    order header details. Performs user exits for each segment to process customizations to data
                    processing.
    2.     Interprets item level segments and captures item level details like material information. Again, it
                   performs user exits for each segment.
    3.     Sums up the order data and determines the posting criterion viz. creating order with reference
                  etc.
    4.     Builds up batch data communication sequence (BDC) with respect to the required screen
                    sequence of posting a sales order.
    5.     While building up the BDC data, system performs user exit to process customizations to BDC
                      data.
    6.     Calls transactions VA01 using the BDC data.
    7.     If the processing fails, an appropriate workitem is generated for workflow processing.
    User Exit - ZXVEDU03
    This user exit will be performed after each segment read in the IDOC processing function module. Exit is called during the perform interpret_idoc_orders in the idoc processing function module. The exit is executed before the BDC data building process and it is here where the invoice  number would be retrieved into a variable from segment E1EDK02.
    IF SEGMENT-SEGNAM = 'E1EDK02'.
        IF SEGMENT-SDATA(3) = 'Z43'.
           Save the  you Number XXXXXXXXXX into a temporary variable.
        Endif.
    Endif.
    User Exit - ZXVEDU04
    In the function module IDOC_INPUT_ORDERS, form call_va01_new_orders is performed wherein BDC data is built up for every screen required to post a sales order. User Exit ZXVEDU04 is performed at various stages during the built up of BDC data. It is here in this user exit that a coding needs to be performed to insert BDC data for assigning sales order to the invoice
    The BDC data for assign to invoice  should be added soon after the BDC data for purchase order type is generated. The following BDC data logic should be coded in the user exit to facilitate assign to invoice
    if you give me brief i can help you out more.
    if helpful REWARD points
    Thank you .
    Regards
    Ramana

  • Creating PO with reference to PR

    Hi experts,
    I am in a strange problem in our present business process
    the user need to create PO with reference to PR
    but with out using use roles
    i have tried with customising settings in IMG -
    MM-- Purchasing---PO--
    define Screen layout at document level in the i have made mandatory fields (PR at item level (ME21) document type (NB) and field selection (NBF) eventhough it is not woking
    please could any body can solve my problem?
    reward point will be give for useful answer
    regards
    raj

    Hai
    The problem is simple
    The path
    Img-> MM-> Purchasing-> Authorization Management
    select Define Function authorization for buyers
    enter new entries like CH & name it Purchase order
    In field selection NBF (Purchase order)
    now select the check box i.e reference to Purchase Requisition
    & save.
    then select
    maintaince users
    parameters
    enter EFB 7 enter Ch (i.e entry entered) & save
    if this is useful to you transfer this message to others who are facing the same problem.
    Sharing Knowledge is most important
    Regards & thanks
    Kalwa Pandarinath

  • Create table with storage parameters in a locally managed tablespace

    Hi,
    Can we create object with storage parameters in a locally managed tablespace.
    CREATE TABLE my_hash_table_6 (
    name VARCHAR2(30),
    value VARCHAR2(4000) )
    STORAGE (
    INITIAL 1M
    NEXT 512K
    PCTINCREASE 0
    MINEXTENTS 2
    MAXEXTENTS UNLIMITED )
    users default tablespace is locallly managed.
    Then this table's extent management will be managed as per the tablespace or as the storage parameters which
    were specified at the time of table creation.

    Why don't you try it yourself ?
    TEST@db102 > select * from dba_tablespaces
      2  where TABLESPACE_NAME='USERS';
    TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
    MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
    ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
    USERS                                8192          65536                       1
    2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
    SYSTEM    NO  AUTO   DISABLED NOT APPLY   NO
    TEST@db102 > CREATE TABLE my_hash_table_6 (
      2  name VARCHAR2(30),
      3  value VARCHAR2(4000) )
      4  STORAGE (
      5  INITIAL 1M
      6  NEXT 512K
      7  PCTINCREASE 0
      8  MINEXTENTS 2
      9* MAXEXTENTS UNLIMITED )
    TEST@db102 > /
    Table created.
    TEST@db102 > select * from user_segments
      2  where segment_name='MY_HASH_TABLE_6';
    SEGMENT_NAME
    PARTITION_NAME                 SEGMENT_TYPE       TABLESPACE_NAME
         BYTES     BLOCKS    EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
    MAX_EXTENTS PCT_INCREASE  FREELISTS FREELIST_GROUPS BUFFER_
    MY_HASH_TABLE_6
                                   TABLE              USERS
       2097152        256          2        1572864                       1
    2147483645                                         DEFAULT
    TEST@db102 >

  • Problem CREATE TABLE with PRIMARY KEY Still in Trouble ! Please Help!

    Hi there !
    I use the orcle 8i, and i don't know why i can't create table with any primary key EXample:
    SQL> CREATE TABLE O_caisses
    2 (No_caisse NUMBER(3) constraint caisses_pk PRIMARY KEY,
    3 NB_BILLETS NUMBER(5)
    4 )
    5 /
    CREATE TABLE O_caisses
    ERROR at line 1:
    ORA-18008: cannot find OUTLN schema
    ***********some Debuger show me this way: *********************
    Well there r certain point u got to notice when creating a table with constraints.
    1) U can create table with COLUMN level constraint.
    2) U can create table with TABLE level constraint.
    3) In COLUMN level constraint u can't give a constraint a name
    but only mention the type of constraint.
    4) In TABLE level constraint u can give a name to constraint.
    Following are the examples of both
    --COLUMN LEVEL
    CREATE TABLE O_caisses
    (No_caisse NUMBER(3) PRIMARY KEY,
    NB_BILLETS NUMBER(5));
    --TABLE LEVEL
    CREATE TABLE O_caisses
    (No_caisse NUMBER(3),
    NB_BILLETS NUMBER(5),
    constraint pk_caisse primary key (No_caisse));
    ********************And this is another one:*****************
    SQL>grant create any outline to username;
    BUT the problem is still present, i don't know what to do now !
    Please could some body help me !
    Thanks alot!
    Luong.

    The clue is in the error message: the OUTLN schema is missing.
    This is something Oracle 8i introduced to help manage the CBO (or soemthing equally geeky and internal). For some reason your database no longer has this user. It ought to be created automatically during installation (or upgrade) but catproct may not have completed probably or some over zealous admin type has dropped it.
    Solution is to re-install (or re-upgrade) as you cannot create this user on their own. Alas.
    HTH, APC

  • Bapi to create Invoice with reference to SalesOrder

    Hi All,
    I want to create Invoice with reference to SalesOrder ,
    can anybody help me regarding
    --> what is the Bapi to Create Invoice with reference to SalesOrder
    --> what are the import parameters
    Thanks in Advance
    Regards
    Srinivas

    Hi Giuseppi,
    Thanks to your reply,
    i have used BAPI_BILLINGDOC_CREATEMULTIPLE , i have given the following input values in the BILLINGDATAIN
      -- salesorg,distrchan,division,doc-type,sold-to,plant,material,doc-number,item-number , when  i execute the Bapi , i got the DocNo:0090021983 , but i did not find that DocNo. by executing the Bapi BAPI_BILLINGDOC_GETLIST.
    i found the short description for
    BAPI_BILLINGDOC_CREATEMULTIPLE -- is for Individual Customer Billing Document, is it the correct Bapi to create invoice
    what is the correct Bapi to create invoice based on the salesorder.
    RV_INVOICE_CREATE OR GN_INVOICE_CREATE OR BAPI_BILLINGDOC_CREATEMULTIPLE.
    Can u specify the import parameters for that Bapi.
    Thanks & Regards
    Srinivas

  • Error when creating PO with reference to PR

    Hello Expert,
    When creating PO with reference to PR I encountered with one error i.e. system is taking into consideration one to one relation of PR line item to PO line item. For example: I have created PR with one line item for XYZ value and with reference to PR line item I am creating one PO but with two line items in PO that means I am splitting PR value into two line items in PO, 1st line item with zero tax and second one is with tax.
    So there is one PR line item but in PO I am creating two line items with reference to single PR item. In this case system is giving error saying Item 001 WBS element XXXXXXXXXX budget exceeded. message no: BP604. However if I create single line item in PO then it wont give any error.
    Please suggest any customization setting is done for such kind of behavior of the system.
    Thanks
    Shyam

    Hi,
    SAP creates the requisition with item category "U" even in case of cross-company (intercompany) purchase requisition.
    When converting it to PO the item category becomes blank - as I tried and I got no error message.
    Please check your settings under SPRO > MM > Purchasing > Purchase Order > Define Document Types (V_T161). You will see (if standard settings have not been changed) that NB requisition type with "U" item category is allowed for NB purchase order type with " " (empty) item category.
    Regards,
    Csaba

  • How to create table with dynamic rows

    Hi Ppl,
    I have an array lets say with length of n. I want to creata table with 2 columns and no of rows = array length.
    lets say array length is 3 ( array[0] = 1, array[1] = 2, array[2] = 3) so the table should have 2 columns and 3 rows.
    After creation of table I want to display each array value in each row.
    Can somebody help me in this asap.
    Thanks \
    Ashish

    Hi, Thanks for reply... actually this is one part of rtf. I have put values from xml to an array and now I want to create a table with no of rows = length of array. so here xml will not be useful. could you pls think of it without xml.
    result is like
    lets says below is the array
    array[0] = a
    array[1] = b
    array[2] = c
    array length = 3
    so there should be a table of 2 coulmns and 3 rows. Second column of first row will show 'a', Second column of second row wil show 'b' and Second column of third row will show 'c'.
    Hope this is useful.
    Thakns
    Ashish

  • How to create table with row type in smart forms

    How to create table with row type in smart forms with out line type
    please explain me the procedure

    HI,
    A table type describes the structure and functional attributes of an internal table in ABAP. In ABAP programs you can reference a table type TTYP defined in the ABAP Dictionary with the command DATA <inttab> TYPE TTYP. An internal table <inttab> is created in the program with the attributes defined for TTYP in the ABAP Dictionary.
    A table type is defined by:
    its line type, that defines the structure and data type attributes of a line of the internal table
    the options for managing and accessing the data ( access mode) in the internal table
    the key ( key definition and key category) of the internal table
    The row type is defined by directly entering the data type, length and number of decimal places or by referencing a data element, structured type ( structure, table or view) or other table type. Or the row type can be a reference type.
    <b>for more info :</b> http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    Internal table
    Regards
    Sudheer

  • How to create complaints with reference to ECC Billing document (CRM 7.0)

    Hi experts!
    I use ECC 6.0 and CRM 7.0.
    I have to create CRM complaints (ZCLR - CLRP) with reference to ecc billing documents.
    I read the following topics and help:
    1. How to create complaints with referenceto ECC Billing document
    2. Re: How can we transfer billing documents from SAP ERP to CRM 2007?
    3. http://help.sap.com/saphelp_crm70/helpdata/en/46/029ba32e675c1ae10000000a1553f6/frameset.htm
    Made these settings:
    1. Define the Business object type
    Goto SPRO>CRM>Transaction>Settings for Complaints>Integration>Trnsaction Referencing>Define Object types for Transaction reference
    2. Assign Business Object Types to Transaction Types
    Goto SPRO>CRM>Transaction>Settings for Complaints>Integration>Trnsaction Referencing>Assign Business Object Types to Transaction Types
    3. Implement a BADI - CRM_COPY_BADI_EXTERN.Check Implementation CRM_COPY_BADI_BILLDO for more information on the coding for referencing the ECC Billing document.
    Goto SPRO>CRM>Transaction>Settings for Complaints>Integration>Trnsaction Referencing>BAdI: Create Complaint with Reference to External Transaction.
    but still do not know,
    1) if I should pre-replicate billing documents into CRM ?
    2) Or, the system uses the RFC to find these documents in ECC to create reference?
    Please help me.
    Best regards Kostya.
    Edited by: Kostya Khveshchenik on Oct 20, 2010 2:09 PM

    not resolved =(
    Edited by: Kostya Khveshchenik on Nov 19, 2010 8:50 AM

  • Create Order with reference to Contract header

    Hello,
    In copy control from Contract to order can  you please tell me if it is possible to copy only header data?
    Meaning ,when creating Order with reference to contract I would like to copy contract header data only
    Thanks,
    Dave

    Hi Dave,
    You can try this,
    Go to VTAA--> Select your copy control of contract to order --> Click at details --> Remove the check box of
    Copy item number
    Complete refrence
    Then double click at "Item" left side --> Select your item category --> Click at details --> Remove the check box of
    Copy Schedule lines
    Then try to create and revert back with your findings,
    Regards,
    MT

  • How to create PO with reference to Pr through BAPI

    Hi everybody
    I wanted to create PO with reference to PR through BAPI_PO_CREATE (4.6c), but i found there is no field to set PR info in the parameter. Is the bapi right for this case, or there are other functions?
    THANKS FOR ANY ADVICE!
    Best regards,
    Egg

    Hi abappers!
    I'm using bapi BAPI_PO_CREATE1 to create PO with reference to one or more PR. I have a problem with document date:
    If the delivery date of the PR is lower than creation date of PR, the document date of the PO is the delivery date (lower than sy-datum).
    If the delivery date of the PR is the same or higher than creation date of PR, the document date of the PO is the creation date of PR (sy-datum or high).
    I'm trying to change this date in poheader-doc_date, but the system ignores me. I'm sure this is the correct variable, because I use it to create other PO's without reference.
    Another thing confuses me is that if I create the PO with reference to the same PR from ME21N, the system doesn't allow me to indicate a document date lower than sy-datum.
    Thanks in advance,
    Jorge

  • OID users ( EUS) problem with grant create table with admin

    Hi,
    We activated enterprise users in the OID.
    There is a role APP_ADMIN that has the following grants:
    create user
    drop user
    create table with admin option
    this is for an application that creates BI schemas, so it needs to be able to create other users.
    I have granted these to a local role, and the user has access to the local role, thanks to the OID setup.
    The create and drop user work.
    however, the grant create table to another user does not work.
    Is there an issue with 'with admin option' grants in Enterprise user security?
    Regards,
    Peter

    If I grant
    grant create table to test_role with admin option;
    it does not work
    if I grant
    GRANT GRANT ANY PRIVILEGE to test_role WITH ADMIN OPTION;
    it does work.
    The test command as user with test_role is:
    grant create table to test_usr;
    very strange!
    If the user is a standard user and I create role test_role
    and grant create table to test_role with admin option it works.
    but if I convert the user to an EUS user and the same privilege is given to the role ( role is granted to a global role to an enterprise role)
    it doesnt work
    Edited by: Peter on Dec 7, 2012 2:36 PM

Maybe you are looking for