Wednesday, July 29, 2015

Duplicating a Maximo Business Object or Maximo Table (Maximo 7.5)


Duplicating a Maximo Business Object or Maximo Table (Maximo 7.5)


In Database Configuration application in Maximo, you are not allowed to Duplicate an existing Object. But if there is a requirement, you can accomplish it using database back end operation.

Though object/attributes can be created from backend, but their entry must be populated in metadata tables of Maximo which are: MAXOBJECTCFG, MAXOBJECTCFG, MAXTABLECFG

How are we going to accomplish it:
  1. We will populate the Object and Attribute Data in Maximo Metadata Tables
  2. We will run config db which will create the Object and Attributes in the database
  3. We will create a custom SEQUENCE which will be associated with ID field of the Duplicated Object using back end SQL insert query.

Before we start, detailed knowledge about how database configuration works in Maximo is required.

CHANGED flags in Configuration or Metadata Tables of Maximo
  1. when you add an Object : CHANGED field in MAXOBJECTCFG table will be set to I
  2. when you add an Attribute:  CHANGED field in MAXATTRIBUTECFG table will be set to I
  3. an entry is added in MAXTABLECFG table - no flag in this table 
Note: On Deletion: flag will be set to R, on Change: flat will be set to A

Setting above flags are required when you insert records in Maximo Meta data Tables. Now take export of following tables using SQL Developer or any other tool.

<Ex-Object> here should be replaced with the Object Name which you want to duplicate. In this case, we are going to create a duplicate object of ITEM and we'll give the name to new object as NEWITEM


select * from MAXATTRIBUTECFG where OBJECTNAME ='<Ex-Object>';
select * from MAXOBJECTCFG where OBJECTNAME ='<Ex-Object>';
select * from MAXTABLECFG where tablename ='<Ex-Object>';

Post Export: Changes in MAXATTRIBUTECFG export file

Changes in MAXATTRIBUTECFG export excel
OBJECTNAME Custom Object Name
ATTRIBUTENAME Custom Attribute Name - you may retain the existing attribute name as well
ALIAS it will be same as the ATTRIBUTENAME, change it if you have made a change in ATTRIBUTENAME
AUTOKEY if required, create an Autokey and give that name here
ATTRIBUTENO you can give in sequence
CLASS if an Autokey is associated then provide 1 else it should be 0
CANAUTONUM remove existing class names, provide custom class if any
COLUMNNAME it will be same as the ATTRIBUTENAME, change it if you have made a change in ATTRIBUTENAME
DEFAULTVALUE you may change or retain it's value
DOMAINID you may change or retain it's value
EAUDITENABLED you may change or retain it's value
ENTITYNAME will always be same as the OBJECT name
ESIGENABLED you may change or retain it's value
ISLDOWNER set it to 1 it this custom attribute will have Long Description
ISPOSITIVE applicable for Numbers
LENGTH you may change or retain it's value
MAXTYPE you may change or retain it's value
MUSTBE it's related with SAMEASOBJECT and SAMEASATTRIBUTE concept
REQUIRED you may change or retain it's value
PERSISTENT you may change or retain it's value
PRIMARYKEYCOLSEQ this sequence depends on the business logic behind your application, this is Unique Index Sequence
REMARKS Description of the Attribute which is displayed on the screen when pressed for Help
SAMEASATTRIBUTE it's related with SAMEASOBJECT and SAMEASATTRIBUTE concept
SAMEASOBJECT it's related with SAMEASOBJECT and SAMEASATTRIBUTE concept
SCALE you may change or retain it's value
TITLE Screen Lable of the Custom Attribute
USERDEFINED it will be 1 by default
CHANGED Set it to I - this is most important, I stands for Insert
SEARCHTYPE you may change or retain it's value
MLSUPPORTED you may change or retain it's value
MLINUSE you may change or retain it's value
HANDLECOLUMNNAME Name of the handle column, for supporting DB2 text search.
MAXATTRIBUTEID MAXATTRIBUTECFGSEQ.NEXTVAL - this is most important
RESTRICTED you may change or retain it's value
LOCALIZABLE you may change or retain it's value
ROWSTAMP remove this row from your excel, it's not required
TEXTDIRECTION The orientation of text that you enter into fields. - Not Important
COMPLEXEXPRESSION Type of Complex Expression - Not Important

MAXATTRIBUTECFG data is prepared in excel.

Post Export: Changes in MAXOBJECTCFG export file


Changes in MAXOBJECTCFG export excel
OBJECTNAME Custom Object name
CLASSNAME psdi.mbo.custapp.CustomMboSet OR your custom class name
DESCRIPTION Description of the custom object
EAUDITENABLED you may change or retain it's value
EAUDITFILTER you may change or retain it's value
ENTITYNAME It will be same as the new custom object name
ESIGFILTER not important
EXTENDSOBJECT applicable in case of View
IMPORTED not important, appicable in case you are importing this data through MIF
ISVIEW depends on your business scenario
PERSISTENT depends on your business scenario
SERVICENAME you may change or retain it's value
SITEORGTYPE you may change or retain it's value
USERDEFINED it will be 1 by default
CHANGED IMPORTANT - Change it I (I for Insert)
MAINOBJECT you may change or retain it's value
INTERNAL you may change or retain it's value
MAXOBJECTID MAXOBJECTCFGSEQ.NEXTVAL
ROWSTAMP Remove it, it's not required
TEXTDIRECTION not important

MAXATTRIBUTECFG data is prepared in excel.

Post Export: Changes in MAXTABLECFG export file


Changes in MAXTABLECFG export excel
TABLENAME Custom Object Name
ADDROWSTAMP 1
EAUDITTBNAME you may change or retain it's value
ISAUDITTABLE you may change or retain it's value
RESTOREDATA 0
STORAGEPARTITION don't change
TEXTSEARCHENABLED don't change
LANGTABLENAME you may remove it or change the value to create LANG table
LANGCOLUMNNAME change it if given value for LANGTABLENAME
UNIQUECOLUMNNAME NEWITEMID - Unique Column Name of the Object
ISLANGTABLE depends
MAXTABLEID MAXTABLECFGSEQ.NEXTVAL
ALTIXNAME not required
TRIGROOT NEWITEM - it's important
CONTENTATTRIBUTE not required
ROWSTAMP not required

 
MAXTABLECFG data is also prepared in excel.


As we have all the data prepared in excel, we have to create the Insert SQL Queries. This can be easily done by using Excel functions such as Concatenate.

Once you are done with all the prerequisite tasks described above, run the prepared SQL Insert Query in you database (take database backup first to avoid any issues).

Sequence: Using the folllowing query, create a Sequence which will be associated with NEWITEMID field in MAXATTRIBUTECFG.

1. Insert an entry into Maximo Metadata table
insert into MAXSEQUENCE (TBNAME,NAME,MAXRESERVED,SEQUENCENAME,MAXSEQUENCEID)
values

('OTECPRODMASTER','OTECPRODMASTERID',0,'OTECPRODMASTERSEQ',
MAXSEQUENCESEQ.NEXTVAL);
2. Create a sequence in database
CREATE SEQUENCE OTECPRODMASTERSEQ
      START WITH 1 INCREMENT BY 1 NO MAXVALUE NO CYCLE CACHE 24;

3. It's done now, SEQUENCENAME field in MAXATTRIBUTECFG is Non-persistent i.e. it's not in DB, Maximo business will fetch it's value using relationship and show it in DB Config application.

Once you commit the DB Changes, go to Database Configuration application in Maximo. When you hit Enter on the List tab, you will see newly created custom/duplicated Object NEWITEM and which will be marked for 'To be Added' and in Attributes tab, all the duplicated Attributes will be marked for 'To be Added'.

Now you can start the Admin Mode and run Configure Database. After the configuration is complete, duplicated object NEWITEM is ready to use.

I know this is a lengthy way but I just wanted to document it that duplication of an Object in Maximo can be accomplished using backend.

Thank you for reading...

1 comment: