EBS提交併發請求的簡單例子

freshairpeng發表於2014-05-12

定義變數:

--提交標準併發請求時的引數
    l_request_id1 NUMBER;
    l_request_id2 NUMBER;
    l_request_id3 NUMBER;
    l_request_id4 NUMBER;
    l_bl_result1  BOOLEAN;
    l_bl_result2  BOOLEAN;
    l_bl_result3  BOOLEAN;

 

   呼叫標準的請求,將三個介面表中的資料匯入到系統中。

   實現sql如下:

 

  

[xhtml] view plaincopy
  1. IF v_supplier_error_flag = 'N' AND v_supplier_site_error_flag = 'N' AND  
  2.        v_supplier_contact_error_flag = 'N' THEN  
  3.   
  4.       --分ou的匯入,並且初始化OU  
  5.       FOR l_cur_submit IN cur_submit LOOP  
  6.         v_org_id := NULL; --初始化ou  
  7.         v_org_id := get_org_id(l_cur_submit.org_name);  
  8.         --初始化環境變數  
  9.         set_policy_context(v_org_id);  
  10.         --呼叫標準的併發請求  
  11.         --呼叫供應商的併發請求  
  12.         l_request_id1 := fnd_request.submit_request('SQLAP', --應用簡稱  
  13.                                                     'APXSUIMP', --併發程式  
  14.                                                     '',  
  15.                                                     '',  
  16.                                                     FALSE,  
  17.                                                     'NEW',  
  18.                                                     1000,  
  19.                                                     'N',  
  20.                                                     'N',  
  21.                                                     'N',  
  22.                                                     chr(0));  
  23.         COMMIT;  
  24.         IF l_request_id1 IS NULL OR l_request_id1 = 0 THEN  
  25.           retcode := 2;  
  26.           errbuf  := '供應商介面匯入標準表出錯!';  
  27.           RETURN;  
  28.         END IF;  
  29.   
  30.         l_bl_result1 := fnd_concurrent.wait_for_request(l_request_id1, --等待的請求  
  31.                                                         1, --間隔時間  
  32.                                                         0, --等待時間  
  33.                                                         v_phase,  
  34.                                                         v_status,  
  35.                                                         v_dev_phase,  
  36.                                                         v_dev_status,  
  37.                                                         v_message);  
  38.   
  39.         IF v_dev_phase = 'COMPLETE' AND v_dev_status = 'NORMAL' THEN  
  40.   
  41.           --呼叫供應商地點的併發請求  
  42.           l_request_id2 := fnd_request.submit_request('SQLAP', --應用簡稱  
  43.                                                       'APXSSIMP', --併發程式  
  44.                                                       '',  
  45.                                                       '',  
  46.                                                       FALSE,  
  47.                                                       'NEW',  
  48.                                                       1000,  
  49.                                                       'N',  
  50.                                                       'N',  
  51.                                                       'N',  
  52.                                                       chr(0));  
  53.           COMMIT;  
  54.           IF l_request_id2 IS NULL OR l_request_id2 = 0 THEN  
  55.             retcode := 2;  
  56.             errbuf  := '供應商地點介面匯入標準表出錯!';  
  57.             RETURN;  
  58.           END IF;  
  59.   
  60.           l_bl_result2 := fnd_concurrent.wait_for_request(l_request_id2, --等待的請求  
  61.                                                           1, --間隔時間  
  62.                                                           0, --等待時間  
  63.                                                           v_phase,  
  64.                                                           v_status,  
  65.                                                           v_dev_phase,  
  66.                                                           v_dev_status,  
  67.                                                           v_message);  
  68.   
  69.           IF v_dev_phase = 'COMPLETE' AND v_dev_status = 'NORMAL' THEN  
  70.             --呼叫供應商地點聯絡人的併發請求  
  71.             l_request_id3 := fnd_request.submit_request('SQLAP', --應用簡稱  
  72.                                                         'APXSCIMP', --併發程式  
  73.                                                         '',  
  74.                                                         '',  
  75.                                                         FALSE,  
  76.                                                         'NEW',  
  77.                                                         1000,  
  78.                                                         'N',  
  79.                                                         'N',  
  80.                                                         'N',  
  81.                                                         chr(0));  
  82.             COMMIT;  
  83.             IF l_request_id3 IS NULL OR l_request_id3 = 0 THEN  
  84.               retcode := 2;  
  85.               errbuf  := '供應商地點聯絡人介面匯入標準表出錯!';  
  86.               RETURN;  
  87.             END IF;  
  88.             l_bl_result3 := fnd_concurrent.wait_for_request(l_request_id3, --等待的請求  
  89.                                                             1, --間隔時間  
  90.                                                             0, --等待時間  
  91.                                                             v_phase,  
  92.                                                             v_status,  
  93.                                                             v_dev_phase,  
  94.                                                             v_dev_status,  
  95.                                                             v_message);  
  96.             IF v_dev_phase <> 'COMPLETE' AND v_dev_status <> 'NORMAL' THEN  
  97.               retcode := 2;  
  98.               errbuf  := '供應商地點聯絡人介面匯入標準表出錯!';  
  99.               RETURN;  
  100.             END IF;  
  101.           END IF;  
  102.         END IF;  
  103.   
  104.         COMMIT;  
  105.       END LOOP; --結束loop迴圈  
  106. END IF;  



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14766526/viewspace-1159160/,如需轉載,請註明出處,否則將追究法律責任。

相關文章