ORACLE EBS删除PO API

以下代码为删除PO的API,还未做调试

DECLARE
  p_po_header_id NUMBER;
  l_api_name CONSTANT VARCHAR2(20) := 'delete_po';
  l_po_header_id     NUMBER;
  l_type_lookup_code VARCHAR2(80);
  l_ga_flag          po_headers_all.global_agreement_flag%TYPE; -- <GA FPI>
  l_deleted          BOOLEAN;
  --< CONTERMS FPJ START>
  l_conterms_flag po_headers_all.conterms_exist_flag%TYPE;
  -- l_k_doc_type should be %type based on contracts table but to circumvent
  -- the dependency varchar length hardcoded. Consider again when refactoring
  l_k_doc_type    VARCHAR2(150);
  l_return_status VARCHAR2(1);
  l_msg_data      VARCHAR2(2000);
  l_msg_count     NUMBER;
  --< CONTERMS FPJ END>    
BEGIN
  --Program start
  SELECT poh.po_header_id
        ,poh.type_lookup_code
        ,poh.global_agreement_flag
        ,nvl(poh.conterms_exist_flag
            ,'N')
    INTO l_po_header_id
        ,l_type_lookup_code
        ,l_ga_flag
        ,l_conterms_flag
    FROM po_headers_all poh
   WHERE poh.po_header_id = p_po_header_id;

  /* Call the procedure to delete the document */
  l_deleted := po_headers_sv1.delete_po(l_po_header_id
                                       ,l_type_lookup_code);

  -- <GA FPI START>: If document is a Global Agreement, 
  -- must also delete its Org Assignment entry from PO_GA_ORG_ASSIGNMENTS.
  -- 

  -- bug3239502
  -- We should delete org assignments as long as ga_flag is 'Y'. This will then cover
  -- both GA and GC.

  IF (l_ga_flag = 'Y') THEN
    po_ga_org_assign_pvt.delete_row(l_po_header_id);
  END IF;
  --
  -- <GA FPI END>

  --<CONTERMS FPJ START>
  IF l_conterms_flag = 'Y' THEN
    IF l_type_lookup_code = 'STANDARD' THEN
      l_k_doc_type := 'PO' || '_' || l_type_lookup_code;
    ELSIF l_type_lookup_code IN ('BLANKET'
                                ,'CONTRACT') THEN
      l_k_doc_type := 'PA_' || l_type_lookup_code;
    END IF; -- type lookup code
  
    -- call contracts to delete contract terms
    okc_terms_util_grp.delete_doc(p_api_version     => 1.0
                                 ,p_init_msg_list   => 'F'
                                 ,p_commit          => 'F'
                                 ,p_doc_id          => l_po_header_id
                                 ,p_doc_type        => l_k_doc_type
                                 ,p_validate_commit => 'F'
                                 ,x_return_status   => l_return_status
                                 ,x_msg_data        => l_msg_data
                                 ,x_msg_count       => l_msg_count);
  
    ---Return Status Handling
    IF (l_return_status <> 'S') THEN
      -- Show error messages
      raise_exception(x_return_status);
      /*po_util_c.display_errors(p_stat          => 'S',
      p_return_status => l_return_status,
      p_caller_proc   => 'PO_HEADERS_PKG1.delete_row',
      p_called_proc   => 'OKC_TERMS_UTIL_GRP.delete_doc');*/
    END IF; -- return status not success
  END IF; -- conterms flag
  --<CONTERMS FPJ END>    
  COMMIT;
  --Program end
END;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值