1 – Create database table by executing your script. For example:
CREATE TABLE "ITC_EMPLOYEE" ( "ITC_EMPLOYEE_ID" NUMBER(10,2) NOT NULL ENABLE, "NAME" VARCHAR2(50) NOT NULL ENABLE, "FATHERNAME" VARCHAR2(50), "AD_CLIENT_ID" NUMBER(10,0) NOT NULL ENABLE, "AD_ORG_ID" NUMBER(10,0) NOT NULL ENABLE, "ISACTIVE" CHAR(1) DEFAULT 'Y' NOT NULL ENABLE, "CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE, "CREATEDBY" NUMBER(10,0) NOT NULL ENABLE, "UPDATED" DATE DEFAULT SYSDATE NOT NULL ENABLE, "UPDATEDBY" NUMBER(10,0) NOT NULL ENABLE, CONSTRAINT "ITC_EMPLOYEE_PK" PRIMARY KEY ("ITC_EMPLOYEE_ID") ENABLE );
Following are the important point about database table:
- It is better to create primary-key (PK). The PK name should be: [table name] + “_ID” and type should be NUMBER if you want to leverage with full ADempiere AD features.
- Along with PK there should be 7 other fields: •AD_CLIENT_ID •AD_ORG_ID •ISACTIVE •CREATED •CREATEDBY•UPDATED •UPDATEDBY
2 – Activating the new table in the AD
Now we have to import that new table in ADempiere - here we again call it a Table :)
- · Login as System administrator in ADempiere. The user id and password is: SuperUser/System
- · Open ‘Table and Column’ window
- · Create a new record
- · Type into DB Table Name, the name of the newly created DB-table i.e ITC_EMPLOYEE
- · Set ‘Data Access Level’ to ‘All’ and check the item ‘Maintain Change Log’
- · Click on the button Create Columns from DB.
o This creates for each db-tablecolumn a corresponding AD Column.
o Check the automatic created Columns, especially the ID references (e.g. Number instead of Integer)
Now you can say that we have a physical database table that we created in step 1 & and we have an ADempiere logical table created in Step 2. First one is DB table and second one is AD table.
3 –Create an ADempiere window
- · Create a new entry in the ‘Window Tab & Field’ with the name ITC_EMPLOYEE . In the next tab i.e. ‘Tab’ create a new entry with the name EMPLOYEE and select ‘ITC_EMPLOYEE’ as it's table.
- · Use the button ‘Create Fields’ to create fields for all columns of the table. In the tab ‘Field Sequence’ you can choose the sequence of the fields in the new window and in the tab ‘Field’ you can select some view-related attributes. Set the read-only flag for ‘ITC_EMPLOYEE _ID’ (the id should be unchangeable).
- · To change the display properties (read-only, displayed or mandatory) of any fields see Display properties of columns and fields for more details.
4 – Create a MENU and attach your window with it. It's for your exercise.