维护BP客商数据,需求: 新增公司代码3007
公司代码如下页面
实现如下效果,完成新增3007
核心代码段
DATA: ps_bpdata TYPE cvis_ei_extern,
ls_company TYPE cmds_ei_company.
ps_bpdata-partner-header-object_task = 'M'.
SELECT SINGLE partner_guid
INTO @DATA(lv_guid)
FROM but000
WHERE partner = @lv_kunnr.
IF sy-subrc = 0.
ENDIF.
ps_bpdata-partner-header-object_instance-bpartnerguid = lv_guid.
ps_bpdata-partner-header-object_instance-bpartner = lv_kunnr.
ps_bpdata-customer-header-object_instance-kunnr = lv_kunnr.
ps_bpdata-customer-header-object_task = 'U'.
"表示修改 客户 数据
ps_bpdata-customer-header-object_instance-kunnr = lv_kunnr.
ps_bpdata-customer-header-object_task = 'U'.
* 公司代码层级只作扩展
ls_company-task = 'I'.
ls_company-data-akont = cn_akont_kunnr.
ls_company-datax-akont = 'X'.
ls_company-data_key-bukrs = '3007'.
ls_company-data-sperr = xblck.
ls_company-datax-sperr = 'X' .
ls_company-data-loevm = loevm.
ls_company-datax-loevm = 'X' .
APPEND ls_company TO ps_bpdata-customer-company_data-company.
CLEAR ls_company.
供应商类似
ps_bpdata-customer-header-object_instance-kunnr = lv_kunnr.
ps_bpdata-customer-header-object_task = ‘U’.
替换为
ps_bpdata-vendor-header-object_instance-lifnr = lv_kunnr.
ps_bpdata-vendor-header-object_task = ‘U’.
APPEND ls_company TO ps_bpdata-customer-company_data-company.
替换为
APPEND ls_company TO ps_bpdata-vendor-company_data-company.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17913.html