关闭

Oracle EBS Interface/API(5)--AR Invoices

1253人阅读 评论(0) 收藏 举报
分类:

系统版本:
          RDBMS : 9.2.0.6.0
         Oracle 应用产品 : 11.5.10.2  

快速参考
API:AR_INVOICE_API_PUB.CREATE_INVOICE
参数 说明 默认值
p_api_version API版本 1.0
p_init_msg_list 是否初始化信息列表 FND_API.G_FALSE
p_commit 是否Commit(Oracle事务处理) FND_API.G_FALSE
p_batch_source_rec AR事务处理批  
p_trx_header_tbl AR事务处理题头  
p_trx_lines_tbl AR事务处理行  
p_trx_dist_tbl AR事务处理分配  
p_trx_salescredits_tbl AR事务处理销售贷项  
x_return_status 返回值,执行结果返回标志 S表志成功,E表示错误
x_msg_count 返回值,消息记录条数  
x_msg_data 返回值,消息数据  

创建手工AR事务事,实例代码:

DECLARE
  l_return_status        varchar2(1);
  l_msg_count            number;
  l_msg_data             varchar2(2000);
  l_batch_id             number := 1;
  l_batch_source_rec     ar_invoice_api_pub.batch_source_rec_type;
  l_trx_header_tbl       ar_invoice_api_pub.trx_header_tbl_type;
  l_trx_lines_tbl        ar_invoice_api_pub.trx_line_tbl_type;
  l_trx_dist_tbl         ar_invoice_api_pub.trx_dist_tbl_type;
  l_trx_salescredits_tbl ar_invoice_api_pub.trx_salescredits_tbl_type;
  CURSOR cBatch IS
    select customer_trx_id
      from ra_customer_trx_all
     where batch_id = l_batch_id;
  CURSOR cValidTxn IS
    SELECT trx_header_id
      From ar_trx_header_gt
     WHERE trx_header_id not in
           (SELECT trx_header_id FROM ar_trx_errors_gt);
BEGIN
  fnd_client_info.set_org_context(114);
  --1.  Set applications context if not already set. 
  fnd_global.apps_initialize(user_id      => 1110,
                             resp_id      => 50268,
                             resp_appl_id => 222); --1318, 50559, 222);
  --2.  Populate header information.
  l_trx_header_tbl(1).trx_header_id := 1;
  --AR事务处理编号
  l_trx_header_tbl(1).trx_number := 'CXP151020_002'; 
  --客户收单方 地点ID
  l_trx_header_tbl(1).bill_to_customer_id := 1253; 
  --AR事务处理类型CUST_TRX_TYPE_ID-
  l_trx_header_tbl(1).cust_trx_type_id := 1002; 
  l_trx_header_tbl(1).trx_date :=trunc(sysdate);
  --3.  Populate batch source information.
  --批处理源
  l_batch_source_rec.batch_source_id := 1002; 
  --4.  Populate line 1 information.
  l_trx_lines_tbl(1).trx_header_id := l_trx_header_tbl(1).trx_header_id;
  l_trx_lines_tbl(1).trx_line_id := 1;
  --摘要
  l_trx_lines_tbl(1).DESCRIPTION := '手工AR事务处理'; 
  l_trx_lines_tbl(1).line_number := 1;
  --l_trx_lines_tbl(1).memo_line_id := 1;
  l_trx_lines_tbl(1).QUANTITY_INVOICED:=1;
  l_trx_lines_tbl(1).UNIT_SELLING_PRICE :=200;
  l_trx_lines_tbl(1).line_type := 'LINE';
  
  --分配行明细,主要设置会计会机科目为项目时,一定要指定分配行明细的分录帐户
  l_trx_dist_tbl(1).trx_dist_id :=1;
 l_trx_dist_tbl(1).trx_header_id :=1;
  l_trx_dist_tbl(1).trx_LINE_ID :=1;
  l_trx_dist_tbl(1).ACCOUNT_CLASS:='REC';
  l_trx_dist_tbl(1).AMOUNT:= 200;
  l_trx_dist_tbl(1).acctd_amount:=200;
  l_trx_dist_tbl(1).PERCENT :=100;
  l_trx_dist_tbl(1).CODE_COMBINATION_ID := 1494;
  
  l_trx_dist_tbl(1).trx_dist_id :=2;
 l_trx_dist_tbl(1).trx_header_id :=1;
  l_trx_dist_tbl(1).trx_LINE_ID :=1;
  l_trx_dist_tbl(1).ACCOUNT_CLASS:='REV';
  l_trx_dist_tbl(1).AMOUNT:= 200;
  l_trx_dist_tbl(1).acctd_amount:=200;
  l_trx_dist_tbl(1).PERCENT :=100;
  l_trx_dist_tbl(1).CODE_COMBINATION_ID := 12814;

  AR_INVOICE_API_PUB.create_invoice(p_api_version          => 1.0,
                                    p_batch_source_rec     => l_batch_source_rec,
                                    p_trx_header_tbl       => l_trx_header_tbl,
                                    p_trx_lines_tbl        => l_trx_lines_tbl,
                                    p_trx_dist_tbl         => l_trx_dist_tbl,
                                    p_trx_salescredits_tbl => l_trx_salescredits_tbl,
                                    x_return_status        => l_return_status,
                                    x_msg_count            => l_msg_count,
                                    x_msg_data             => l_msg_data);
  Dbms_Output.put_line('x_msg_data=' || l_msg_data);
  Dbms_Output.put_line('x_return_status=' || l_return_status);
  IF l_return_status = fnd_api.g_ret_sts_error OR
     l_return_status = fnd_api.g_ret_sts_unexp_error THEN
    dbms_output.put_line('unexpected errors found!');
  ELSE
    commit;
    For cValidTxnRec IN cvalidTxn loop
      IF (ar_invoice_api_pub.g_api_outputs.batch_id IS NOT NULL) THEN
        dbms_output.put_line('Invoice(s) suceessfully created!');
        dbms_output.put_line('Batch ID: ' ||
                             ar_invoice_api_pub.g_api_outputs.batch_id);
        l_batch_id := ar_invoice_api_pub.g_api_outputs.batch_id;
        for cBatchRec in cBatch loop
          dbms_output.put_line('Cust Trx Id ' || cBatchRec.customer_trx_id);
        end loop;
      ELSE
        dbms_output.put_line('Errors found!');
      END IF;
    
    End loop;
    commit;
  END IF;
  dbms_output.put_line('l_return_status: ' || l_return_status);
END;


 

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:344853次
    • 积分:4343
    • 等级:
    • 排名:第7188名
    • 原创:105篇
    • 转载:2篇
    • 译文:1篇
    • 评论:59条
    最新评论