6
t’s now see how to register a custom table. You will need API named AD_DD for this. 1. First you register the table using the below API: 1 2 3 4 5 6 7 8 9 1 0 1 1 begin ad_dd.register_table (p_appl_short_name => 'CUSTOM', --Application name in which you want to register p_tab_name => 'ERPS_EMPLOYEE', --Table Name p_tab_type => 'T', -- T for Transaction data , S for seeded data p_next_extent => 512, -- default 512 p_pct_free => 10, -- Default 10 p_pct_used => 70 --Default 70 ); end; commit; 2. Secondly register each of the columns as below: Register Column EMP_ID 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 begin ad_dd.register_column (p_appl_short_name => 'CUSTOM', -- Application Name p_tab_name => 'ERPS_EMPLOYEE', --Table Name p_col_name => 'EMP_ID', --Column Name p_col_seq => 1, --Column Sequence p_col_type => 'NUMBER', --Column Data type p_col_width => 10, --Column Width p_nullable => 'N', --Use'N' if mandatory column otherwise 'Y' p_translate => 'N', --Use 'Y' if this has translatable values p_precision => null, --Decimal precision p_scale => NULL --Number

Table Registration

Embed Size (px)

Citation preview

t’s now see how to register a custom table.  You will need API named AD_DD for this.

1.  First you register the table using the below API:

1234567891011

beginad_dd.register_table(p_appl_short_name =>  'CUSTOM',        --Application name in which you want to registerp_tab_name         =>  'ERPS_EMPLOYEE', --Table Namep_tab_type         =>  'T',             -- T for Transaction data , S for seeded datap_next_extent      =>  512,             -- default 512p_pct_free         =>  10,              -- Default 10p_pct_used         =>  70               --Default 70);end;commit;

2. Secondly register each of the columns as below:Register Column EMP_ID

123456789101112131415

beginad_dd.register_column(p_appl_short_name =>   'CUSTOM',        --Application Namep_tab_name         =>   'ERPS_EMPLOYEE', --Table Namep_col_name         =>   'EMP_ID',        --Column Namep_col_seq          =>   1,               --Column Sequencep_col_type         =>   'NUMBER',        --Column Data typep_col_width        =>   10,              --Column Widthp_nullable         =>   'N',             --Use'N' if mandatory column otherwise 'Y'p_translate        =>   'N',             --Use 'Y' if this has translatable valuesp_precision        =>   null,            --Decimal precisionp_scale            =>   NULL             --Number of digits in number);end;Commit;

Register Column EMP_NAME

123456789101112

beginad_dd.register_column(p_appl_short_name =>   'CUSTOM',p_tab_name         =>   'ERPS_EMPLOYEE',p_col_name         =>   'EMP_NAME',p_col_seq          =>   2,p_col_type         =>   'VARCHAR2',p_col_width        =>   15,p_nullable         =>   'Y',p_translate        =>   'N',p_precision        =>   null,p_scale            =>   null

1314

);end;

Register Column EMP_TYPE

1234567891011121314

beginad_dd.register_column(p_appl_short_name =>   'CUSTOM',p_tab_name         =>   'ERPS_EMPLOYEE',p_col_name         =>   'EMP_TYPE',p_col_seq          =>   3,p_col_type         =>   'VARCHAR2',p_col_width        =>   15,p_nullable         =>   'Y',p_translate        =>   'N',p_precision        =>   null,p_scale           =>   null);end;commit;

3. Thirdly you register Primary Key if the table has any using the below code snippet:

1234567891011

Beginad_dd.register_primary_key(p_appl_short_name =>   'CUSTOM',             --Application Namep_key_name         =>   'EMP_ID_PK',          --Unique name for primary keyp_tab_name         =>   'ERPS_EMPLOYEE',      --Table Namep_description      =>   'Emp ID Primary Key', --Descriptionp_key_type         =>   'S',                  --S for Surrogate, D for Developerp_audit_flag       =>   'Y',p_enabled_flag     =>   'Y');end;commit;

4. Finally you register Primary Key column if your table has a primary key:

123456789

Beginad_dd.register_primary_key_column(p_appl_short_name =>  'CUSTOM',       --Application Namep_key_name         =>  'EMP_ID_PK',    --Primary Key name given abovep_tab_name         =>  'ERPS_EMPLOYEE',--Table Namep_col_name         =>  'EMP_ID',       --Primary Column namep_col_sequence     =>  1);             --Column seqend;commit;

Navigate to Application Developer responsibility > Application > Database > Table

Query for the table name that we have registered – “ERPS_EMPLOYEE”. Please note that you cannot register your table using this form in the front end. You will have to use API. This

form is only meant for viewing the information.

Check for the primary key information by clicking on the Primary Key button

Now in your Value set, you will be able to  use the table ERPS_EMPLOYEE without any errors.