Lets make an example. The out-of-the-box attribute PO.VENDOR (Purchase Order - Vendor) is not mandatory. Unfortunately if you try to set as required using the Database Configuration application you will get the following error.
However, if you look into other PO attributes you will find many of these (CHANGEBY, ORGID, etc.) that are defined as required but have no default value. This means that Maximo is internally capable of handling this case.
To circumvent this restriction I use the procedure described hereafter.
Ensure there are no null values in the desired field. This is important because otherwise the configdb will fail with the error: Assignment of a NULL value to a NOT NULL column "VENDOR" is not allowed.
These are two sample SQL statements that can be used to check null values and to set a dummy value in these rows.
select * from PO where VENDOR is null;
update PO set VENDOR='...' where VENDOR is null;
Set the attribute and provide a dummy default value using the Database Configuration. Save your changes without applying the configuration. Do not run configdb!
Locate the PO.VENDOR row in the MAXATTRIBUTECFG table and clean the DEFAULTVALUE field.
Refresh the Database Configuration list view and check the definition of the PO.VENDOR attribute. It should now be listed as 'To be changed' and defined as required but without a default value.
Run configdb script of apply the configuration changes using the action menu.
Now open the Purchase Orders application and you will see the Company field marked with an asterisk.
If you want you can now reset the null values to the original recors.
update PO set VENDOR=null where VENDOR='...';
NOTE: I have used this procedure many times but I do not guarantee it always works on every possible database server. Never do this in a production environment without testing it on your development environment!
Source:http://maximodev.blogspot.com/2012/02/set-attribute-as-required-with-no.html
Tidak ada komentar:
Posting Komentar