02-04-2011 2:24 PM
Hi,
Due to a company re-brand, I am trying to clean up the addresses to be assigned to users via SU01.
However when trying to delete some of the existing address it states "The address was not deleted - there are assignments to persons".
I have checked and no current users are assigned to the addreses to be deleted and I have also cleaned up all the previously deleted users and amended their addresses to a generic De-activated users address, but I am still unable to delete the addresses in question.
I have seen the address linked still to deleted users in table ADR7 but I cannot remove them.
Any ideas????
Many thanks
Craig
02-08-2011 4:45 AM
Hi,
I checked the code of SUCOMP and it's using standard BAPI BAPI_COMPANY_DELETE to delete address. Here is a code that checks if address is still used.
SELECT SINGLE * FROM USR21
WHERE ADDRNUMBER = USCOMPANY-ADDRNUMBER.
and
SELECT SINGLE * FROM USADDEF
WHERE ADDRNUMBER = USCOMPANY-ADDRNUMBER.
if there is at least one user with this address then this address can't be deleted. You can also see that there is no condition if user is deleted or not. The second query just checks if this address is used as default address.
I would check what users still have this address in table USR21. If there are some already deleted users in this set then I agree with David and I would leave it as it is.
Sorry, after submitting my comment I realized that you are getting a different message. It looks like you get it from routine check_any_persons_in_company in include LSZA0F10 (function group SZA0). So if you have some basic debugging skills you can just put break point here and see why SAP thinks that address is still in use.
Cheers
Added additional comment.
Edited by: Martin Voros on Feb 8, 2011 3:51 PM
02-04-2011 2:52 PM
02-07-2011 9:48 AM
Hi Arpan,
We tried the SUSR_SAP_OFFICE_BUFFER_CLEAR function module, did not appear to make any difference, SU01 still states old data related to user account when we look at re-creating a user.
Address could still not be deleted.
Thanks anyway,
regards
Craig
02-07-2011 7:19 PM
Hi Craig
I tried replicating this:
1. created a TEST company in SUCOMP
2. created a ZTEST1 user ID and assigned the TEST company
3. tried to delete the TEST company and got a red warning message that it was still being used
4. swapped ZTEST1 user ID's company to another and saved
5. deleted the TEST company
All okay but then did the following
1. created a TEST company in SUCOMP
2. created a ZTEST2 user ID and assigned the TEST company - saved
3. strike swapped ZTEST2 user ID's company to another and saved strike
4. deleted ZTEST2 user ID
5. tried to delete the TEST company and got a red warning message that it was still being used
6. created ZTEST2 again using the old SAP office data and swapped the TEST company to another
7. tried to delete the TEST company and got a red warning message that it was still being used
8. so now QAS has a TEST company entry that I can't delete...
Not okay...anyhoo...
Searching "SUCOMP" brought up one close thread but it didn't seem to have been resolved, another had the following:
1) When a company address is assigned to a user in transaction SU01 (on the "Address" tab), the time zone of the company address is copied to the "Personal time zone" screen field on the "Fixed values" tab.
Technical information:
The USLOGOND-TZONE data field, which continues to be dealt with in the ADDRESS_IMP_SUBSCREEN_PAI (Include LSUU5F01) form routine, is used in the program. When you save, the time zone is stored in the TZONE database field of the USR02 table.
I have the same issue with my current client but I don't (personnally) agree with deleting this information as it's almost like master data such as plants that 'go off-line' but can never be deleted. IMHO I would accept that the entries are there and that it's another of those 'don't delete users' scenarios.
Sorry I couldn't provide anything positive
Kind regards
David
Edited by: David Berry on Feb 7, 2011 7:20 PM
Edited by: David Berry on Feb 8, 2011 8:53 AM
02-08-2011 4:45 AM
Hi,
I checked the code of SUCOMP and it's using standard BAPI BAPI_COMPANY_DELETE to delete address. Here is a code that checks if address is still used.
SELECT SINGLE * FROM USR21
WHERE ADDRNUMBER = USCOMPANY-ADDRNUMBER.
and
SELECT SINGLE * FROM USADDEF
WHERE ADDRNUMBER = USCOMPANY-ADDRNUMBER.
if there is at least one user with this address then this address can't be deleted. You can also see that there is no condition if user is deleted or not. The second query just checks if this address is used as default address.
I would check what users still have this address in table USR21. If there are some already deleted users in this set then I agree with David and I would leave it as it is.
Sorry, after submitting my comment I realized that you are getting a different message. It looks like you get it from routine check_any_persons_in_company in include LSZA0F10 (function group SZA0). So if you have some basic debugging skills you can just put break point here and see why SAP thinks that address is still in use.
Cheers
Added additional comment.
Edited by: Martin Voros on Feb 8, 2011 3:51 PM
02-08-2011 10:03 AM
Hi Martin,
Many thanks for your post, we have had a look at what you suggested, it appears the data is being held in Table ADCP but we cannot find anything on SDN or OSS that relates to the clearing of data from this table.
Many thanks
Regards
Craig
02-08-2011 1:45 PM
Hello Craig,
please try the soluton of SAP note #450176.
If that does not help, use SAP note #164297.
b.rgds, Bernhard
Edited by: Bernhard Hochreiter on Feb 8, 2011 2:45 PM
02-09-2011 2:19 PM
Hi Bernhard,
Many thanks for the assistance, the answer was in Note 164297.
regards
Craig