Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Company Address - linked to deleted users

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

martin_voros
Active Contributor
0 Kudos

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

7 REPLIES 7

arpan_paik
Active Contributor
0 Kudos

I pressume that you need to delete orphaned user data. Try look into this thread --> [Thread|;

0 Kudos

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

Former Member
0 Kudos

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

martin_voros
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

Hi Bernhard,

Many thanks for the assistance, the answer was in Note 164297.

regards

Craig