Oracle EBS R12.1 FA 批量计划外折旧

在资产工作台上可以进行单个资产的计划外折旧,如果进行批量计划外折旧的话就需要进行开发客户化form或者webadi 进行数据上载后调用FA 标准API了

以下是标准API的demo示例

sql 复制代码
DECLARE

l_trans_rec FA_API_TYPES.trans_rec_type;
l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
l_unplanned_deprn_rec FA_API_TYPES.unplanned_deprn_rec_type;

l_return_status VARCHAR2(1);
l_mesg_count NUMBER;
l_mesg VARCHAR2(4000);

BEGIN

   fnd_global.apps_initialize(user_id => 3993, resp_id => 50890, resp_appl_id => 140);
   /*mo_global.init('FA');*/

   dbms_output.enable(1000000);

   FA_SRVR_MSG.Init_Server_Message;

   FOR i IN (SELECT fdp.book_type_code, xal.code_combination_id, fa.asset_id
               FROM FA_ADDITIONS_B           fa,
                    FA_DEPRN_DETAIL          fdd,
                    FA_DEPRN_PERIODS         fdp,
                    XLA_TRANSACTION_ENTITIES xte,
                    xla_events               xe,
                    XLA_AE_HEADERS           xah,
                    XLA_AE_LINES             xal
              WHERE fa.asset_id IN ( /*100023390, 100023389*/ 100023777)
                    AND fa.ASSET_ID = fdd.ASSET_ID
                    AND xte.SOURCE_ID_INT_1 = fdd.ASSET_ID
                    AND xte.SOURCE_ID_CHAR_1 = fdd.BOOK_TYPE_CODE  
                    AND xte.SOURCE_ID_INT_2 = fdd.PERIOD_COUNTER  
                    AND xte.SOURCE_ID_INT_3 = fdd.DEPRN_RUN_ID  
                    AND fdp.BOOK_TYPE_CODE = fdd.BOOK_TYPE_CODE  
                    AND fdp.PERIOD_COUNTER = fdd.PERIOD_COUNTER  
                    AND xte.ENTITY_ID = xe.ENTITY_ID  
                    AND xah.EVENT_ID = xe.EVENT_ID  
                    AND xah.AE_HEADER_ID = xal.AE_HEADER_ID  
                    AND xal.accounting_class_code = 'EXPENSE'  
                    AND xah.ledger_id = 2022  
                    AND xah.period_name = '2022-10')  
   LOOP  
   
      l_asset_hdr_rec.asset_id       := i.asset_id;  
      l_asset_hdr_rec.book_type_code := i.book_type_code;   
      l_unplanned_deprn_rec.code_combination_id := i.code_combination_id;
      l_unplanned_deprn_rec.unplanned_amount    := 99;   
      l_trans_rec.transaction_subtype := 'AMORTIZED';     
      /*
     参数l_trans_rec.transaction_subtype 需要注意,官方说明文档上说是可选项,但是如果为空得话,前提得是没有进行过减值调整。
     如果进行过减值调整必须是 AMORTIZED ,不然会报"您不能对已摊销调整的资产进行调整。请摊销此调整。"这样的错误
     */
      /*l_unplanned_deprn_rec.unplanned_type := 'UNPLAN';*/

 
      FA_UNPLANNED_PUB.do_unplanned(      
                                    -- std parameters     
                                    p_api_version      => 1.0,     
                                    p_init_msg_list    => FND_API.G_FALSE,    
                                    p_commit           => FND_API.G_FALSE,    
                                    p_validation_level => FND_API.G_VALID_LEVEL_FULL,    
                                    p_calling_fn       => NULL,   
                                    x_return_status    => l_return_status,   
                                    x_msg_count        => l_mesg_count,   
                                    x_msg_data         => l_mesg,  
                                    -- api parameters  
                                    px_trans_rec          => l_trans_rec, 
                                    px_asset_hdr_rec      => l_asset_hdr_rec,
                                    p_unplanned_deprn_rec => l_unplanned_deprn_rec);
   
      dbms_output.put_line('资产' || i.asset_id || '运行信息如下:');
      --dump messages
      l_mesg_count := fnd_msg_pub.count_msg;
   
      IF l_mesg_count > 0 THEN
      
         l_mesg := chr(10) || substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE), 1, 250);
         dbms_output.put_line(l_mesg);
      
         FOR i IN 1 .. (l_mesg_count - 1)
         LOOP
            l_mesg := substr(fnd_msg_pub.get(fnd_msg_pub.G_NEXT, fnd_api.G_FALSE), 1, 250);
         
            dbms_output.put_line(l_mesg);
         END LOOP;
      
         fnd_msg_pub.delete_msg();
      
      END IF;      
   
      IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN

         dbms_output.put_line('FAILURE');      
         rollback;      
      ELSE      
         dbms_output.put_line('SUCCESS');      
         dbms_output.put_line('THID' || to_char(l_trans_rec.transaction_header_id));

         dbms_output.put_line('ASSET_ID' || to_char(l_asset_hdr_rec.asset_id));
         commit;      
      END IF;      
   
   END LOOP;      

END;       
/

手工进行计划外折旧时,还有一个【从当前期间摊销】 的复选框。

当复选款选上时,当期及后期折旧计算方式:(当前净值-当前计划外折旧)/剩余寿命

当复选框不选时,当期及后期折旧及时方式:折旧金额维持不变,但是折旧寿命会变少,并且最后一期金额也会变少。

以下资料是对该复选框的说明:

https://blog.itpub.net/15218514/viewspace-674713/

或者 Oracle 官方文档 【Unplanned Depreciation in Oracle Assets (Doc ID 114298.1)】