Wednesday, June 1, 2011

Table Register in oracle apps using AD_DD Package

CREATE TABLE XXX_MTL_TRANS_INTERFACE
(
LINE_NO NUMBER(10),
ITEM_SEGMENT VARCHAR2(250 BYTE),
ORG_ID NUMBER,
FM_SERIAL_NUMBER VARCHAR2(100 BYTE),
TO_SERIAL_NUMBER VARCHAR2(100 BYTE),
SUBINVENTORY VARCHAR2(50 BYTE),
ORDER_NUMBER VARCHAR2(100 BYTE),
STATUS VARCHAR2(10 BYTE),
ERROR_CODE VARCHAR2(500 BYTE),
ATTRIBUTE1 VARCHAR2(250 BYTE),
ATTRIBUTE2 VARCHAR2(250 BYTE)
)

Now Registering steps:

Table Register:
------------------
declare
begin
ad_dd.register_table
('ONT','XXX_MTL_TRANS_INTERFACE','T');
end;

Column Register:
-------------------

declare
BEGIN
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','LINE_NO', 1, 'VARCHAR2', 10, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ITEM_SEGMENT', 2, 'VARCHAR2', 250, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ORG_ID', 3, 'number',10, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','FM_SERIAL_NUMBER', 4, 'VARCHAR2', 100, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','TO_SERIAL_NUMBER', 5, 'VARCHAR2', 100, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','SUBINVENTORY', 6, 'VARCHAR2', 50, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ORDER_NUMBER', 7, 'VARCHAR2', 100, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','STATUS', 8, 'VARCHAR2', 10, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ERROR_CODE', 9, 'VARCHAR2', 500, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ATTRIBUTE1', 10, 'VARCHAR2', 250, 'Y', 'N');
AD_DD.REGISTER_COLUMN ('ONT', 'XXX_MTL_TRANS_INTERFACE','ATTRIBUTE2', 11, 'VARCHAR2', 250, 'Y', 'N');
END;


Finally check in below query,whether it is registerd or not:
----------------------------------------------------------------

select table_name from fnd_tables
where table_name = 'XXX_MTL_TRANS_INTERFACE'

Usefull Links:
-----------------
http://www.exforsys.com/tutorials/oracle-apps/oracle-apps-table-registration-api.html

http://www.sap-img.com/oracle-database/script-to-register-and-unregister-custom-tables-and-columns.htm

No comments: