Tuesday, April 29, 2014

How to run Api Hz_party_search.Find_parties Example


Doc ID 804145.1 
 
 --Create Party
DECLARE
   l_organization_rec   hz_party_v2pub.organization_rec_type;
   p_party_id           NUMBER;
   p_party_number       VARCHAR2 (20);
   p_profile_id         NUMBER;
   l_return_status      VARCHAR2 (2000);
   l_msg_count          NUMBER;
   l_msg_data           VARCHAR2 (2000);
BEGIN
   l_organization_rec.organization_name := 'Test Party';
   l_organization_rec.created_by_module := 'HZ_TRADING_COMMUNITY';
   hz_party_v2pub.create_organization ('T',
                                       l_organization_rec,
                                       l_return_status,
                                       l_msg_count,
                                       l_msg_data,
                                       p_party_id,
                                       p_party_number,
                                       p_profile_id);
   DBMS_OUTPUT.put_line ('l_return_status:' || l_return_status);
   IF l_msg_count > 1
   THEN
      FOR i IN 1 .. l_msg_count
      LOOP
         DBMS_OUTPUT.put_line (
               i
            || '. '
            || SUBSTR (fnd_msg_pub.get (p_encoded => fnd_api.g_false), 1, 255));
      END LOOP;
   END IF;
END;
l_return_status:S

PL/SQL procedure successfully completed.

-- In our test case DQM profile HZ: DQM syncronization method  is set at Batch - Ran the DQM synchronization program so the party is moved to --the HZ Staged tables

--- Now Find that party
 
DECLARE
   l_party_rec         hz_party_search.party_search_rec_type;
   l_site_list         hz_party_search.party_site_list;
   l_cont_list         hz_party_search.contact_list;
   l_cont_point_list   hz_party_search.contact_point_list;
   l_return_id         NUMBER;
   l_num_matches       NUMBER;
   l_ret_status        VARCHAR2 (2000);
   l_msg_count         NUMBER;
   l_msg_data          VARCHAR2 (2000);
   l_rule_id           NUMBER := 61;
BEGIN
   l_party_rec.party_name := 'Test Party';
   hz_party_search.find_parties (
p_init_msg_list        => fnd_api.g_true,
x_rule_id              => l_rule_id,
p_party_search_rec     => l_party_rec,
p_party_site_list      => l_site_list,
p_contact_list         => l_cont_list,
p_contact_point_list   => l_cont_point_list,
p_restrict_sql         => NULL-- ,p_match_type => NULL
,
p_search_merged        => 'N',
x_search_ctx_id        => l_return_id,
x_num_matches          => l_num_matches,
x_return_status        => l_ret_status,
x_msg_count            => l_msg_count,
x_msg_data             => l_msg_data);

   DBMS_OUTPUT.put_line ('l_return_status:' || l_ret_status);
   DBMS_OUTPUT.put_line ('l_num_matches:' || l_num_matches);
   IF l_ret_status <> 'S'
   THEN
      IF l_msg_count > 1
      THEN
         FOR i IN 1 .. l_msg_count
         LOOP
            DBMS_OUTPUT.put_line (
                  i
               || '.'
               || SUBSTR (fnd_msg_pub.get (p_encoded => fnd_api.g_false),
                          1,
                          255));
         END LOOP;
      END IF;
   END IF;
END;
 
 
l_return_status:S
l_num_matches:1


PL/SQL procedure successfully completed.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.