chethu4u143
18th August 2010, 16:27
Hello,

I am facing problems in achieving the below request, baan Gurus please share your taught to make this happen.

Actually, My session updates/insert the item master data into the company "A" (current company)., Now my new request is, this Update/insert should also happen on company "X", say this company also exists under same package combination.
I tried doing following step and stuck up with 606 reference errors.

Once my update/insert is completed on company A, then call the new procedure to read this recent update/inserted data and update/insert into the new company "X". but this is not working, it is throwing reference error.
Item is not getting inserted into the company X.
i used switch.to.company, compnr.check, table,_compnr = X . but all are throwing me the same reference error.. please guide me to proceed on this.

thanks in advance.

mark_h
18th August 2010, 16:53
Post the code? It should work. I know I have done it in the past.

bdittmar
18th August 2010, 18:10
Hello,

I am facing problems in achieving the below request, baan Gurus please share your taught to make this happen.

Actually, My session updates/insert the item master data into the company "A" (current company)., Now my new request is, this Update/insert should also happen on company "X", say this company also exists under same package combination.
I tried doing following step and stuck up with 606 reference errors.

Once my update/insert is completed on company A, then call the new procedure to read this recent update/inserted data and update/insert into the new company "X". but this is not working, it is throwing reference error.
Item is not getting inserted into the company X.
i used switch.to.company, compnr.check, table,_compnr = X . but all are throwing me the same reference error.. please guide me to proceed on this.

thanks in advance.

Hello,
if reference error is shown, first check if the references are existing in target company.

With switch to company i'm using some checks.


e.g.:

function read.item.data.from.target.company()
{

ret.switch = switch.to.company(target.comp)

if ret.switch = 1 then

select tiitm001.pris
from tiitm001
where tiitm001._index1 = {:artikel}
selectdo
pris.113 = tiitm001.pris
cups113 = tiitm001.cups
endselect

endif |ret.switch(target)

}


function analyse.ret.switch()
{
if ret.switch = -1 then
message("Company not available !")
end()
endif

if ret.switch = -2 then
message("Change Company not allowed !")
end()
endif

if ret.switch = -3 then
message("Package Combination not identic !")
end()
endif

if ret.switch = -4 then
message("First day of week not identical !")
end()
endif

}


Regards

shah_bs
19th August 2010, 00:54
If you look at the table definition and make list of all the tables that Item Data refers to, and insert those records first into the target company (with skip.dupl, because most times the referenced records will be existing), it will work.

Of course, you must also check that the referenced tables and insert the records into table that THOSE tables refer to, but that should not be too many of them.

sushil
19th August 2010, 17:23
Hello,

By your problem description - we could make only rough suggestions or guess work - i would still recommend with what mark_h has suggested .

Post the code? It should work. I know I have done it in the past.

Regards,
Sushil Kumar Mudaliar

chethu4u143
21st August 2010, 04:46
Hi,

The Code works on other tables (table which is not having reference to other table ) but not on ITEM master table.
i agree to shah_bs, there is no data maintained in reference tables hence this error.
Now i tried inserting reference tables first., this is working.. But i want to get the list of reference table to this item master and accordingly which table has to be inserted first.. Ordering of tables.

as of now i am inserting,
item group - tiitm002
tcmcs023
tcmcs011
tcmcs018... etc

at last i will insert tiitm001 record. But how do i find the exact list of referring table ? Item master has more than 150 fields. also, after finding the list of tables, how to i decide which table insertion has to be made first ?

shah_bs
21st August 2010, 19:03
I am not at the work computer right now, so I do not have the exact session code - but there is a Print Table Definition for Current Package VRC session that will print all the tables that tiitm001 refers to - choose the option that will print all the field information.

As to the sequence of inserting the REFERRED TO table records, all the referred to table records need to be inserted first, obviously. In addition, if the REFERRED TO table is itself referring to another table, then THAT table's record need to be inserted before the REFERRED TO table record is inserted. And so on.

I do not think the sequence of inserting the REFERRED TO table records matter, as long as they are all inserted before the Item Master record is inserted.

Hitesh Shah
22nd August 2010, 16:43
I think ttadv4420m000 is a session which will give the reference info which shah_bs talked to u.

shah_bs
23rd August 2010, 04:38
I feel compelled to add some (belated) thoughts.

I do not know why you are making a copy of the item master - I am sure there are good business needs.

But remember that the Item Master (at least in BAAN IV c3) has fields like On Hand, On Order, Allocated, Cumulative Issues, etc which can be different in different companies. So, you have to consider making these zero in the target company, assuming that you are going to do independent transactions in that company.

chethu4u143
23rd August 2010, 10:49
Hi Shah_bs and Hitesh,

this is an business need, my company needs item master data alone to be in sync with two different companies.

I ran the session ttadv4420m000 and attached the list obtained, i have got the list of reference tables, do i need to insert all of these ?? or depending upon ref mode, Only mandatory needs to be inserted ?

Please suggest
below is the list, more info is in attached document.
tcmcs023
tcmcs015
tcmcs022
tcmcs018
tcmcs037
tttxt001
tcmcs006
tcmcs001
tcmcs001
tcmcs003
tcmcs016
tcmcs016
tdinv400
tirpt001
tcmcs001
tcmcs001
tcmcs024
tcmcs044
tcmcs002
tccom020
tttxt001
tcmcs001
tcmcs001
tcmcs024
tcmcs044
tdcms018
tdcms018
tcmcs028
tcmcs010
tttxt001
ticpr010
tccom001
tccom001
tppdm100
tiitm001
tcmcs012

sameer.don
23rd August 2010, 11:54
If you want the table in synch across multiple companies, can u not try sharing table across companies. u can use session Maintain Logical Tables (ttadv4420m000) for sharing item master.

Hitesh Shah
24th August 2010, 07:45
Ideally all reference tables records must be existing in other company . U can share reference tables with another company if overall functionality is not hampered.

Logical tables is ttaad4120m000 .

U need also to take care off what shah_bs told .

Regarding text copy , use text functions instead of just copy of text numbers.