从开发人员角度来看,B/P客户创建可以试用两种方法,第一种是使用BAPI FUNCTION,第二种是使用BAPI CALL METHOD。
个人更倾向于使用METHOD,因为METHOD方法只需要填充一个嵌套结构就可以实现B/P所有业务视图的填充,而BAPI FUNCTION在创建完客户后,需要调用很多其它的BAPI去扩展业务视图,代码量比较大。现在贴出两种实现方法。
-
CALL BAPI BAPI_BUPA_CREATE_FROM_DATA
DATA:l_partn_cat TYPE bapibus1006_head-partn_cat,
ls_central TYPE bapibus1006_central,
ls_partn_group TYPE bapibus1006_head,
ls_central_person TYPE bapibus1006_central_person,
ls_central_organ TYPE bapibus1006_central_organ,
l_partn_grp TYPE bapibus1006_head-partn_grp,
ls_central_group TYPE bapibus1006_central_group,
ls_address TYPE bapibus1006_address,
l_bpartner TYPE bapibus1006_head-bpartner,
lt_bapiadtel LIKE TABLE OF bapiadtel WITH HEADER LINE,
lt_bapiret2 LIKE TABLE OF bapiret2 WITH HEADER LINE,
lt_guid LIKE TABLE OF bus000___i WITH HEADER LINE,
lt_custo TYPE TABLE OF bus000_eew WITH HEADER LINE.
DATA:ls_but0bk TYPE but0bk,
lv_bkvid TYPE but0bk-bkvid,
lv_type TYPE char1,
l_str TYPE string,
l_role TYPE bapibus1006_head-partnerrole VALUE 'FLCU00'.
DATA:ls_bankdetail TYPE bapibus1006_bankdetail.
DATA:ls_bankdetail_x TYPE bapibus1006_bankdetail_x.
DATA:lt_return TYPE TABLE OF bapiret2.
DATA:ls_return TYPE bapiret2,
wa_return TYPE zfis_036_return.
"客户类型
l_partn_cat = '2'.
"客户全程
ls_central_organ-name1 = ps_in-name1.
"简称
ls_central-searchterm1 = ps_in-alias.
"创建日期
ls_central_organ-foundationdate = ps_in-time.
"国家代码
ls_address-country = 'CN'.
"城市
ls_address-city = 'GUANGZHOU'.
"邮政编码
ls_address-postl_cod1 = '000000'.
&#