Архив

Публикации с меткой ‘update’

OEBS API: Деактивация контрагента в HZ_PAPTIES (тип organization)

6 Октябрь 2014 Нет комментариев

Пример использования API для перевода контрагента (таблица HZ_PAPTIES) с типом «organization» в статус “Неактивно”:

declare
  p_party_id      number := 2661479911;
  --  
  l_organization_rec  HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE;
  l_party_rec         HZ_PARTY_V2PUB.PARTY_REC_TYPE;
  l_object_version_number number;
  --
  x_profile_id    NUMBER;  
  x_return_status VARCHAR2(1);
  x_msg_count     NUMBER;
  x_msg_data      VARCHAR2(4000);  
begin
  
  fnd_global.apps_initialize(-1, 20639, 200); --Диспетчер кредиторов - Кредиторы

  l_party_rec.party_id  := p_party_id;
  l_party_rec.status    := 'I';
  l_organization_rec.party_rec := l_party_rec;
  
  select hp.object_version_number into l_object_version_number 
  from hz_parties hp where hp.party_id = l_party_rec.party_id;
    
  HZ_PARTY_V2PUB.update_organization(p_init_msg_list               => fnd_api.g_false,
                                     p_organization_rec            => l_organization_rec,
                                     p_party_object_version_number => l_object_version_number,
                                     x_profile_id                  => x_profile_id,
                                     x_return_status               => x_return_status,
                                     x_msg_count                   => x_msg_count,
                                     x_msg_data                    => x_msg_data);
      
  dbms_output.put_line(x_return_status);
  if (x_return_status <> 'S') then
    fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
                              p_count   => x_msg_count,
                              p_data    => x_msg_data);
                                      
    dbms_output.put_line('ERROR update for party_id='||l_party_rec.party_id||':');
     
    if x_msg_count = 1 then
      dbms_output.put_line(x_msg_data);
    else
      FOR i IN 1 .. x_msg_count LOOP
        dbms_output.put_line(fnd_msg_pub.get(fnd_msg_pub.g_next,
                                             fnd_api.g_false));
      END LOOP;
    end if;
  end if;
  
  commit;
                             
end;


API для обновления полномочий (RESPONSIBILITY)

25 Февраль 2013 Нет комментариев

Пример использования API для обновления даты действия полномочий

BEGIN
  FOR cr IN (SELECT * FROM fnd_responsibility_vl
             WHERE responsibility_key LIKE 'XX%'
            ) 
  LOOP
    fnd_responsibility_pkg.update_row(
            x_responsibility_id         => cr.responsibility_id,
            x_application_id            => cr.application_id,
            x_web_host_name             => cr.web_host_name,
            x_web_agent_name            => cr.web_agent_name,
            x_data_group_application_id => cr.data_group_application_id,
            x_data_group_id             => cr.data_group_id,
            x_menu_id                   => cr.menu_id,
            x_start_date                => to_date('01-01-1951','dd-mm-yyyy'),
            x_end_date                  => cr.end_date,
            x_group_application_id      => cr.group_application_id,
            x_request_group_id          => cr.request_group_id,
            x_version                   => cr.VERSION,
            x_responsibility_key        => cr.responsibility_key,
            x_responsibility_name       => cr.responsibility_name,
            x_description               => cr.description,
            x_last_update_date          => SYSDATE,
            x_last_updated_by           => fnd_global.user_id,
            x_last_update_login         => fnd_global.login_id);
  END LOOP;

  COMMIT;
END;
/