Deepali
4th February 2004, 11:50
Hi,
Is there any function or method to copy a record from a table of one company to same table of another company.
For eg. I would like to copy a record from tdsls045 of company eg. 870 to tdsls045 of company eg. 771.
Your feedback on this is required urgently.
Ruskin
13th February 2004, 03:58
I don't think there is a tool or function to copy specific records from one company to another. There are (of course) session that will allow you to do the entire table.. These are things like;
- ttaad4228m000 (Convert/Recover Tables)
- ttaad4226m000 (Create Sequential Dump of Table) and ttaad4227m000 (Create Table from Sequential Dump)
- Exchange (NOTE: this will allow "specific" records to be exported)...
However, it is simple to write your own library, that will allow you to do this, or a quick SQL, such as;
select tdsls045.*
from tdsls045
where tdsls045._index1 = {orno, pono, sqnb}
and tdsls045._compnr = :source.comp
selectdo
tdsls045._compnr = target.comp
db.insert(ttdsls045, db.retry)
endselect
This is just a basic example (there would be a bit of validation required, such as the new record existing in the target company, if the table definitions were the same, etc)...
SriksAdi
14th February 2004, 08:26
In GTM (ttaad4100), open the table to be copied. Press 1(Copy) or select Copy Rows from Application Menu.
The systems asks for the table name and the company number, enter the values, and the data gets copied.
Sriks
evesely
16th February 2004, 15:20
Just remember that some tables, although not tdsls045, have a company number field in the table. In this case, you might need to run something like tfgld9004m000 or manually change the company number field (which can also be done in GTM).
Hitesh Shah
17th February 2004, 08:33
IF there are mandatory references or combined fields referring to other tables (like tdsls045.cmba & cmbb) and those values are not present in referred tables , it may give error 606.
jroberts
17th February 2004, 14:57
When copying multiple records from one baan company to another, the easiest method I have found has been to use the database tools, not the baan tools.
In Oracle SQL :
Insert into baandb.TTIBOM000211(select * from baandb.TTIBOM000210);
commit;
will copy the Bill of Materials Parameter table from company 210 into company 211.
I have extended this approach to creating new test companies for a few reasons.
- you can restrict your copy to specific records (via a where clause) instead of copying the entire table.
- better performance vs Baan Exchange or bdbpre \ post
The above noted concern about Baan company numbers can be addressed via a database UPDATE command, once the records have been copied.
Oracle SQL can be written that generates the insert or copy commands automatically.
Interesting Code sample :
select
'Copy from user/password@server'
|| ' insert BAANDB.' ||
substr(TABLE_NAME,1,9) || '180'
|| ' using select * from ', 'BAANDB.' ||substr(TABLE_NAME,1,12), ';'
from all_tables
where substr(table_name,7,3) in ('000')
and substr(table_name, 10,3) = '170'
order by table_name
which outputs :
Copy from user/password@server insert BAANDB.TCPCOM000180 using select * from BAANDB.TCPCOM000170 ;
Copy from user/password@server insert BAANDB.TCPRPD000180 using select * from BAANDB.TCPRPD000170 ;
Copy from user/password@server insert BAANDB.TPSPMG000180 using select * from BAANDB.TPSPMG000170 ;
Copy from user/password@server insert BAANDB.TTCCOM000180 using select * from BAANDB.TTCCOM000170 ;
Copy from user/password@server insert BAANDB.TTCEDI000180 using select * from BAANDB.TTCEDI000170 ;
and then that code can run against your database.
Note : Insert command is more efficient than the copy command.
Sorry for the long rambling post, but this has been really helpful to me and I wanted to share.
cazerpa
25th November 2014, 21:08
In GTM (ttaad4100), open the table to be copied. Press 1(Copy) or select Copy Rows from Application Menu.
The systems asks for the table name and the company number, enter the values, and the data gets copied.
Sriks
How can I copy using ttaad4100 but ignoring referential integrity constrainsts?
mark_h
26th November 2014, 15:34
In 4c4 you can always use ttaad4226m000 to create a sequential dump of a table, then use ttaad4227m000 to import the table. In the import you can turn off referential integrity constraints. Maybe you already know this - not sure. I really never use ttaad4100 for table copies.
vamsi_gujjula
26th November 2014, 18:05
i wonder how is the referential integrity is turned off ??/
mark_h
26th November 2014, 20:06
That is a good question. I am not sure how the session turns it off. I would assume (and probably be wrong) there is an import command that disables it that Baan runs in the background. In our case I would think it does some kind of oracle import with it turned off - but I really do not have a clue.