declare l_count NUMBER; l_return_status VARCHAR2(100); l_msg_count NUMBER := 0; l_msg_data VARCHAR2(4000); l_request_id NUMBER; reclass_err EXCEPTION; i NUMBER := 0; l_api_version CONSTANT NUMBER := 1.0; l_msg_list VARCHAR2(5) := fnd_api.g_false; l_commit_flag VARCHAR2(5) := fnd_api.g_false; l_validation_level VARCHAR2(5) := fnd_api.g_valid_level_full; l_debug_flag VARCHAR2(5) := fnd_api.g_false; l_calling_fn VARCHAR2(50) := 'Update Asset Desc Script'; l_trans_rec fa_api_types.trans_rec_type; l_asset_hdr_rec fa_api_types.asset_hdr_rec_type; l_asset_desc_rec fa_api_types.asset_desc_rec_type; l_asset_type_rec fa_api_types.asset_type_rec_type; l_asset_cat_rec fa_api_types.asset_cat_rec_type; l_asset_id NUMBER(15); l_description VARCHAR2(30); l_serial_number VARCHAR2(10); l_category_id NUMBER(15); l_transaction_type_code VARCHAR2(20) := NULL; l_transaction_date_entered DATE := NULL; l_temp_str VARCHAR2(640); BEGIN --初始化 fnd_profile.put('PRINT_DEBUG', 'Y'); dbms_output.enable(10000000); fa_srvr_msg.init_server_message; fa_debug_pkg.initialize; l_trans_rec.who_info.last_updated_by := 1001; l_trans_rec.who_info.last_update_login := 1001; l_trans_rec.who_info.last_update_date := SYSDATE; l_trans_rec.who_info.creation_date := l_trans_rec.who_info.last_update_date; l_trans_rec.who_info.created_by := l_trans_rec.who_info.last_updated_by; l_asset_hdr_rec.asset_id := 1580571; --l_asset_desc_rec.description := l_description; --l_asset_desc_rec.serial_number := l_serial_number; l_asset_desc_rec.tag_number := SUBSTR('Z50010100004941',1,7) || 'XXX' || SUBSTR('Z50010100004941',11);--Z50010100004941 --l_asset_cat_rec.desc_flex.attribute1 := 'Test Thru API'; --l_asset_cat_rec.desc_flex.attribute2 := 'Test2 Thru API'; l_return_status := NULL; dbms_output.put_line('calling FA_ASSET_DESC_PUB.update_desc'); fa_asset_desc_pub.update_desc( -- std parameters p_api_version => l_api_version, p_init_msg_list => l_msg_list, p_commit => l_commit_flag, p_validation_level => l_validation_level, x_return_status => l_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data, p_calling_fn => l_calling_fn, px_trans_rec => l_trans_rec, px_asset_hdr_rec => l_asset_hdr_rec, px_asset_desc_rec_new => l_asset_desc_rec, px_asset_cat_rec_new => l_asset_cat_rec); -- rollback; dbms_output.put_line('l_return_status ' || l_return_status); IF l_return_status = 'E' THEN l_msg_count := fnd_msg_pub.count_msg; IF (l_msg_count > 0) THEN dbms_output.put_line('l_msg_count ' || to_char(l_msg_count)); l_temp_str := substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false), 1, 230); dbms_output.put_line(l_temp_str); l_temp_str := NULL; FOR i IN 1 .. (l_msg_count - 1) LOOP l_temp_str := fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false); dbms_output.put_line(l_temp_str); END LOOP; ELSE dbms_output.put_line('dump: NO MESSAGE !'); END IF; RETURN; END IF; fa_srvr_msg.add_message(calling_fn => 'reclass.sql', NAME => 'FA_SHARED_END_SUCCESS', token1 => 'PROGRAM', value1 => 'FA_ASSET_DESC_PUB.update_desc'); EXCEPTION WHEN reclass_err THEN ROLLBACK WORK; fa_srvr_msg.add_message(calling_fn => 'reclass.sql', NAME => 'FA_SHARED_PROGRAM_FAILED', token1 => 'PROGRAM', value1 => 'FA_ASSET_DESC_PUB.update_desc'); l_msg_count := fnd_msg_pub.count_msg; IF (l_msg_count > 0) THEN l_temp_str := fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false); dbms_output.put_line('dump: ' || l_temp_str); FOR i IN 1 .. (l_msg_count - 1) LOOP l_temp_str := fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false); dbms_output.put_line('dump: ' || l_temp_str); END LOOP; ELSE dbms_output.put_line('dump: NO MESSAGE !'); END IF; WHEN OTHERS THEN ROLLBACK WORK; fa_srvr_msg.add_sql_error(calling_fn => 'fa_asset_desc_pub..update_desc'); RAISE fnd_api.g_exc_unexpected_error; END;