learner
30th January 2008, 23:41
Hi,
I need to delete some thousands of Item from Item Master ( tcibd001 ) via exchange scheme. I already have a list of item in text file.
I wish to avoid writing a new session for the above requirement. Is it possible and easy to achieve via exchange scheme ???
Waiting for your reply.
regards
Learner
toolswizard
31st January 2008, 14:56
It is fairly easy.
Although you have a list, I would use exchange to dump the rows of information so you have a backup incase of a mistake. I am going to assume that there are no links to these items from anywhere else in the system.
The export exchange scheme can be done either by itself or as part of the import exchange scheme based on audit. I suggest seperate exchange schemes for the export and import, having the import based on audit.
If you do the export, use the based on audit. This will put an "I" in the first column of the row of data. This will have to be replaced by a "D" for delete. If there are two many rows, it could be difficult to do a search and replace due to file size.
(Suggested Option) Use 2 exchange schemes and add an ascii field in the data as the first field and put the "D" in yourself. You would not use the based on audit function for this option.
The import exchange scheme will be based on audit. The "D" will signal exchange to delete the row.
ashu2814
27th February 2008, 08:34
"you do the export, use the based on audit. This will put an "I" in the first column of the row of data. This will have to be replaced by a "D" for delete. If there are two many rows, it could be difficult to do a search and replace due to file size."
You suggested the above procedure . but it is not working.
Can you tell in detail how to delete through excahnge scheme
David Eagar
27th February 2008, 10:25
Are you sure you want to do this?? Items from General Item Data appear in many other tables - If ABSOLUTELY no transactions with these items, you are probably OK, but otherwise, I think you are heading for disaster
Han Brinkman
27th February 2008, 12:20
I agree with David, don't do it via exchange.
Write a small script that reads your text file and deletes your items by using afs calls that use the standard session of Baan.
Han
toolswizard
27th February 2008, 13:49
The reason you do it through exchange is to cover yourself in case you delete something you needed.
You can always import the file and bring back the rows.
Ashu2814,
I suggested two methods on the export with and without Audit. I would use the without audit.
The procedure will require to seperate Exchange Schemes.
Scheme One.
1. Create an Exchange Scheme NOT based on audit.
2. Create an Ascii File with all the fields from the table.
3. Add an extra Ascii field, example "xxxx", in the first position of the Ascii File, probably line 5.
4. Create an Export Batch and again include all the fields from the table. Add what ever you selection criteria is for selecting the rows to be delete.
5. Set the "xxxx" field to a constant "d"
6. Create and export your Scheme.
Scheme Two.
1. Create an Exchange Scheme based on audit.
2. Create an Ascii File with all the fields from the table.
3. (There is no xxxx field in this scheme)
4. Create an Import Batch
5 Create and import your Scheme, this will delete your records if there are no references.
In case you need to restore these rows, create a import scheme in scheme one and do a non regular import to restore your table.
This was off of memory, so it is possible I might have left out a detail or two.
I am often asked by my clients to remove data, disregarding any cautions that I may suggest, and I have used this procedure over and over to replace the data when they discovered it was not such a good idea to remove the data, or that maybe there were some rows that should not have been deleted.
This also work greate for field updates. If the event you need to change an field to a specific value and need to change it back, you will have the original values and indexes saved in an ascii file. The other option is to run an sql query to chagne the value, but I have not seen a developer save the original values in the event of a error.
ashu2814
28th February 2008, 06:11
toolwizard,
I tried your both option but they did not work .
for 1st method after exporting no records are getting deleted . the ascii file is created as
i,d,TEST,1204092905
i,d,TEST1,1204092905
there are only two records in my table . I have created this table for testing purpose .
2. When I tried using import method an error occured. I have attached the file .
Regards,
ashu
ashu2814
28th February 2008, 06:25
toolwizard,
I tried your both option but they did not work .
for 1st method after exporting no records are getting deleted . the ascii file is created as
i,d,TEST,1204092905
i,d,TEST1,1204092905
there are only two records in my table . I have created this table for testing purpose .
2. When I tried using import method an error occured. I have attached the file .
Regards,
ashu
toolswizard
28th February 2008, 13:28
Based on your two lines, I would guess that your export is based on audit. That is what is putting the "i" in the row. The "d" has to be the first position. Then in a SEPERATE exchange scheme, you have the import based on audit and it will read the "d" and delete the row.
IF you want to attach a word document with your exchange scheme screen shots and the two ascii files layouts, I can look at them and let you know if I see anything configured incorrectly.