使用标准客户导入程序 - 弊端
近期用了一个别人写的客户导入程序。大概流程是:
1. 利用SQL Loader大批量将用户整理的客户主数据导入到客户化接口表
2.在程序中验证某些字段成功后,插入标准接口表
3.提交标准请求:Customer Interface
ln_request_id := fnd_request.submit_request( application => 'AR', program => 'RACUST', description => NULL, start_time => NULL, sub_request => FALSE, argument1 => 'N', argument2 => h.org_id ); COMMIT;
导入完毕之后发现有些字段并不能用这张接口表完毕,以下列举出来:
1.Receipt Method : 依据文档显示 ,眼下无公用的API去导这个字段,所以能够使用接口表 RA_CUST_PAY_METHOD_INT_ALL
能够在以上步骤中,多加一步插接口表RA_CUST_PAY_METHOD_INT_ALL
这张表的必须字段:
lr_customer_method.org_id := cux_fnd_util_pkg.get_field_value('HR_OPERATING_UNITS', 'ORGANIZATION_ID', 'NAME', lt_site_tbl(j).operating_unit); lr_customer_method.ORIG_SYSTEM_CUSTOMER_REF := lt_site_tbl(j).customer_number; lr_customer_method.PAYMENT_METHOD_NAME := lt_site_tbl(j).payment_method; lr_customer_method.PRIMARY_FLAG := 'Y'; lr_customer_method.START_DATE := SYSDATE; lr_customer_method.LAST_UPDATED_BY := g_user_id; lr_customer_method.LAST_UPDATE_DATE := SYSDATE; lr_customer_method.CREATED_BY := g_user_id; lr_customer_method.CREATION_DATE := SYSDATE;2.Payment Terms/Sales Territory /Sales Person/Warehouse
这堆货也没法用接口表导进去,说是要打补丁。
不打就用API吧,我使用的是hz_cust_account_site_v2pub.update_cust_site_use
DECLARE p_cust_site_use_rec HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_SITE_USE_REC_TYPE; x_return_status VARCHAR2(2000); x_msg_count NUMBER; xio_p_object_version NUMBER; x_msg_data VARCHAR2(2000); BEGIN fnd_global.apps_initialize(1231, 50886, 222); mo_global.init('AR'); --p_cust_site_use_rec.primary_salesrep_id := ; p_cust_site_use_rec.payment_term_id := 4; --p_cust_site_use_rec.warehouse_id := ; p_cust_site_use_rec.site_use_id := 3040; p_cust_site_use_rec.CUST_ACCT_SITE_ID := 2760; xio_p_object_version := 2; hz_cust_account_site_v2pub.update_cust_site_use('T', p_cust_site_use_rec, xio_p_object_version, x_return_status, x_msg_count, x_msg_data); IF x_return_status = fnd_api.g_ret_sts_success THEN --COMMIT; DBMS_OUTPUT.PUT_LINE('Updation of Customer Account is Successful '); DBMS_OUTPUT.PUT_LINE('Output information ....'); dbms_output.put_line('Object Version Number =' || xio_p_object_version); ELSE DBMS_OUTPUT.put_line('Updation of Customer Account got failed:' || x_msg_data); --ROLLBACK; FOR i IN 1 .. x_msg_count LOOP x_msg_data := fnd_msg_pub.get(p_msg_index => i, p_encoded => 'F'); dbms_output.put_line(i || ') ' || x_msg_data); END LOOP; END IF; dbms_output.put_line('***************************'); dbms_output.put_line('Output information ....'); dbms_output.put_line('x_return_status: ' || x_return_status); dbms_output.put_line('x_msg_count: ' || x_msg_count); dbms_output.put_line('xio_p_object_version: ' || xio_p_object_version); dbms_output.put_line('x_msg_data: ' || x_msg_data); dbms_output.put_line('***************************'); END;
假设不巧你某些字段导错了,想要大批量的清空某些字段的值。给它null然后更新是没实用的
假设是NUMBER类型。给FND_API.g_null_num
假设是VARCHAR类型,给FND_API.g_null_char
posted on 2017-07-31 10:35 yjbjingcha 阅读(154) 评论(0) 编辑 收藏 举报