本文主要是介绍ABAP - 使用cl_md_bp_maintain创建Vendor的BP,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
下面直接完整的代码演示,其中ms_request (接口的入参)和ms_response(接口的出参)的结构均为:ZSBC_VENDOR_INFO
因为嫌麻烦,所以给外围提供接口时,company name没有像表里弄成4个字段,而是一个长度为char160的COMPANY字段 ,所以在接受接口的这个值后,仍然要拆分成4个字段,保存到SAP的DB
company name的结构为
拆分company name的方法为:
下面是创建vendor的BP以及银行信息的完整代码:
METHOD create_vendor_cvi.
DATA: ls_orgdata TYPE bapibus1006_central_organ,
ls_split_name TYPE zsbc_split_company_name,
lv_partner_guid TYPE bu_partner_guid,
lt_cvi TYPE cvis_ei_extern_t,
ls_cvi TYPE cvis_ei_extern,
ls_company TYPE vmds_ei_company,
ls_role TYPE bus_ei_bupa_roles,
ls_taxnumber TYPE bus_ei_bupa_taxnumber,
ls_address TYPE bus_ei_bupa_address,
ls_bank_detail TYPE bus_ei_bupa_bankdetail,
lt_return_map TYPE mdg_bs_bp_msgmap_t,
ls_return TYPE bapiret2,
lt_return TYPE bapiret2_t,
lt_bapiretm TYPE bapiretm,
lv_msg TYPE string.
**********************************************************************
me->check_data( ).
CHECK ms_response-msg_type <> 'E'.
IF ms_request-category IS INITIAL.
ms_request-category = '2'. "default Organization
ENDIF.
"business partner data
ls_cvi-ensure_create-create_vendor = abap_true.
TRY.
CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c32
RECEIVING
uuid = DATA(lv_tmp_uuid).
lv_partner_guid = lv_tmp_uuid.
ls_cvi-partner-header-object_instance-bpartnerguid = lv_partner_guid.
CATCH cx_uuid_error INTO DATA(lo_ex).
ENDTRY.
**********************************************************************
ls_cvi-partner-header-object_task = 'M' . "I / U / M / D
ls_cvi-partner-central_data-common-data-bp_control-category = ms_request-category. "organization/individual
ls_cvi-partner-central_data-common-data-bp_control-grouping = gc_acctgroup_z095.
"TitleKey = Company
CASE ms_request-category.
WHEN '1'. "Individual
SELECT SINGLE title FROM tsad3
INTO ls_cvi-partner-central_data-common-data-bp_centraldata-title_key
WHERE person = abap_true.
ls_cvi-partner-central_data-common-data-bp_person-fullname = ms_request-fullname.
这篇关于ABAP - 使用cl_md_bp_maintain创建Vendor的BP的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!