Thursday, 7 April 2011

Registering Custom Table


 Registering Custom Table

You register your custom application tables using a PL/SQL procedure in the AD_DD package. Therefore you only need to register those tables (and all of their columns) that will be used with flexfields or Oracle Alert.
You can also use the AD_DD API to delete the registrations of tables and columns from Oracle Application Object Library tables should you later modify your tables. If you alterthe table later, then you may need to include revised or new calls to the table registration routines. To alter a registration you should first delete the registration, and then re-register the table or column. Remember, you should delete the column registration first, then the table registration. You should include calls to the tableregistration routines in a PL/SQL script. Though you create your tables in your own application schema, you should run the AD_DD procedures against the APPS schema. You must commit your changes for them to take effect.


The AD_DD API does not check for the existence of the registered table or column in the database schema, but only updates the required AOL tables. You must ensure that thetables and columns registered actually exist and have the same format as that defined using the AD_DD API. You need not register views.

 Registering Custom Table



To register your custom table under FND. 


1. Input is your custom table name. Execute these  4 queries 
2. Spool the records
3. Execute the spooled records in apps
4. Commit;




select 'EXEC '||'AD_DD.REGISTER_TABLE(''XXCUST'', '''||TABLE_NAME||''',''T'',8,10,90);' from all_tables
where table_name = :TABLE_NAME
/
select 'EXEC '||'AD_DD.REGISTER_COLUMN(''XXCUST'', '''||TABLE_NAME||''','''||COLUMN_NAME||''','||COLUMN_ID||','''||DATA_TYPE||''','||DATA_LENGTH||','''||NULLABLE||''',''N'');' from all_tab_columns
where table_name = :TABLE_NAME
ORDER BY COLUMN_ID
/
select 'EXEC '||'AD_DD.REGISTER_PRIMARY_KEY(''XXCUST'','''||INDEX_NAME||''','''||TABLE_NAME||''','''||ITYP_NAME||''',''S'',''Y'',''Y'');'
FROM ALL_INDEXES
WHERE table_name = :TABLE_NAME 
and uniqueness = 'UNIQUE'
/
select 'EXEC '||'AD_DD.REGISTER_PRIMARY_KEY_COLUMN(''XXCUST'','''||A.INDEX_NAME||''','''||A.TABLE_NAME||''','''||A.COLUMN_NAME||''','||A.COLUMN_POSITION||');'
FROM ALL_IND_COLUMNS A, ALL_INDEXES B
WHERE A.TABLE_NAME = :TABLE_NAME
AND A.INDEX_NAME = B.INDEX_NAME
AND B.UNIQUENESS = 'UNIQUE'
/

To delete the registered Tables, columns
select 'EXEC '||'AD_DD.DELETE_TABLE(''XXCUST'', '''||TABLE_NAME);' from all_tables
where table_name = :TABLE_NAME
/
select 'EXEC '||'AD_DD.REGISTER_COLUMN(''XXCUST'', '''||TABLE_NAME||''','''||COLUMN_NAME);' from all_tab_columns
where table_name = :TABLE_NAME
ORDER BY COLUMN_ID
/

No comments: