Hi,
I made a new data base and resotre a database to make a new company. I run a code unit to clean data from table which already got some old data.
For some forms like budget , Chart of account and some others too I get error setup key does not exist. Also when I try to run a sales history report it still shows me the error of not finding the item no 4130 and item catagory ACC which used to be in item table before but I already deleted those records by running the code unit now how to run this report?
Thanks in advance for your feedbacks.
regards
Sajid
0
Comments
Also keep in mind that deleting the data is not enough. You may have relations to deleted data. (Field with values pointing in missing records). Have you tried performing a Test on the database?
How to delete the relations of the deleted data?
regards,
Sajid
Also have you deleted the GLSetup to perhaps force the CompanyInitialization to execute?
Regarding the Setup try to Initialize the company, Or insert a new record in the appropriate setup.
Now, you mention that item no 4130 and item catagory ACC do not exist. However, the system asks for them. So, this means:
a) In some table that the report uses, there is a field that contains the value: 4130 and is used to link the item table. The field might be lacking the relation, but maybe C/AL uses it.
b) The values being asked are hard coded in the report (probably not)
From what I understand you ran a codeunit to empty the tables and keep only the setup. Are you sure that all the tables have been emptied?
Try using the debugger and posting here the part of the code that causes the error...
Please suggest.
regards
Then copy the code the debugger stopped and paste it here... That will show us where the problem is. (i.e. : The field "Location Code" in the Responsibility Center table is holding an old value...)
Yes I run the code unit to empty the table but not all tables but then I add the table which was not empty for example the location table. So after making empty the Location table I still get the same error as below;
I run the Test on table 38 as you suggested by going into Database information and it gave me the same error which I get creating the new PO it says as below;
Location does not exist;
Code XXX
The Location Code field in the Purchase Header table has a table relaionship to the Code field in the location table.
Purchase Header has the following fields and Value;
Document Type=Quote No,No=PQ00001
Regards,
Sajid
Keep in mind that when you insert a new PO some validation of fields may fill other fields such as "Location Code" with values from some setup or master data tables. So maybe the Responsibility Center or Vendor or other table has a value linked to the location table that is missing...
What you concluded is my question since begning. I have deleted all the data from Location table, Purchase header table and there is no data at all but still when I try to create the new PO or run the test for purchase header table I get this error which I mentioned in my earlier post. Question is how to find this error since it always try to find the location which has been deleted so where can I get this link which codeunit? Table ? If I create the location with same name which it mentioned in the error it works but I dont wanna create this location since this is for an other company.
Please guys help me.
regards
Assuming that the error comes from a table relation:
1. Open Object Designer
2. Create (Using the wizard) a new tabular form based on Table "Field"
3. Select all fields.
4. Run the form.
5. Apply a filter on Field RelationTableNo with value 14 (It is location table)
6. When you get the filtered result check that the fields in the shown tables are empty if the tables contain records.
I solved it finally. The problem was the company setup table where the location was defined which was deleted so I changed the location there and it solved the problem now I am able to make PO and Sales Orders.
Thank you all who tried to help me.
regards
Sajid