VishalMistry
7th May 2009, 13:51
i am copying standard item (tiitm001) from one logistic company (101) to another (555). As all the required master data are same in both companies, i am able to copy the record through the customized session.

but the problem is after copying it does not allow to delete the record from the company where i have copied (555 company), because alongwith the item, it's reference counter details are also copied. where as, i am able to delete this item from ttaad4100.

also another issue is when i am running session ttaad4225m000 in 555 company, this newly copied items are automatically deleted from 555 company.

is there any way to nullyfy this reference counter details from newly copied item.

Thanking in advance,
Vishal

mark_h
11th May 2009, 16:09
How are you copying the record? If you are using record buffers then you may want to specify the actual fields instead of using the buffers.

VishalMistry
12th May 2009, 09:34
Hi,
I am following given below logic:
1.check if the item exists in target company
2.if item does not exists then perform select statement on source company with FOR UPDATE option
3.once the record is found, change the _compnr value from source to target company
4.change values in required fields and then do db.insert followed by commit.transaction

it works perfectly but if i try to delete this newly copied item from target company, it displays message indicating record can not be deleted. because the reference counter fields are having values of the source company, which i do not know how to change.

regards,
vishal

sushil
12th May 2009, 11:03
Hi,

I think you also need to copy

1.extension to item
2.relations between items and container

Regards,
Sushil Kumar Mudaliar

Hitesh Shah
12th May 2009, 16:02
U may check references for the copied item in target company ttaad4229m000 to know if there are any references to this item. There may be certain tables shared between source and target company which may be containing the copied item.

mark_h
12th May 2009, 16:12
Hi,
I am following given below logic:
1.check if the item exists in target company
2.if item does not exists then perform select statement on source company with FOR UPDATE option
3.once the record is found, change the _compnr value from source to target company
4.change values in required fields and then do db.insert followed by commit.transaction

it works perfectly but if i try to delete this newly copied item from target company, it displays message indicating record can not be deleted. because the reference counter fields are having values of the source company, which i do not know how to change.

regards,
vishal
I am not sure how to do that either - I know there is some other fields that need to be reset, but not what they are. I wonder if you moved the record to a temporary buffer, then executed a switch to company, pulled the temp buffer back in and then did an insert. I wonder if that would work - not sure never really tried this.