Tuesday, June 29, 2010

Technical Notes on Suppliers

Creation of a TCA party as a customer in AR followed by a creation of supplier in AP will lead to a duplicate party on AP side. To avoid this dupliacte issue one should create suppliers in AP first and then use AR to create an account. While creating supplier TCA tables get inserted and commited first prior to supplier table validation process, so there is a chance you may end up with the data in TCA but not AP. You might get an error "Supplier name already exists".
In this case we need to remove the TCA data in order to load the record successfully. Here is the query to find the records which are in TCA but not in AP.

select hp.*
from hz_parties hp
where created_by_module = 'AP_SUPPLIERS_API'
and party_type in ('ORGANIZATION', 'PERSON')
and not exists (select 1
from ap_suppliers ap
where ap.party_id = hp.party_id);

If HZ: Generate Party Number is set to "Yes" the Supplier Number is supposed to be system generated. In order for the profile to work correctly the DQM Staging Program from Trading Community Manager responsibility.

Supplier contact information is stored in two tables - HZ_PARTIES and HZ_RELATIONSHIPS.
There are two rows created in HZ_PARTIES table with party type PERSON and PARTY_RELATIONSHIP. Party is stored in Subject_ID and Object_ID. If you know the contact Party_ID, you can get the associated Relationship ID with the following sql query

SELECT Party_ID FROM hz_relationships hr
WHERE subject_id = party_id of the contacts PERSON type HZ_PARTIES ;

OR you can also query this way

SELECT subject_id FROM hz_relationships hr
WHERE party_id = party_id of PARTY_RELATIONSHIP type HZ_PARTIES
AND subject_type = 'PERSON'
AND relationship_code = 'CONTACT_OF' ;

No comments:

Post a Comment